forked from maschhoff/nextcloud_securipy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.py
36 lines (23 loc) · 896 Bytes
/
check.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
Nextcloud Security Checker
2020 maschhoff github.com/maschhoff
"""
import requests
import settings
import json
import noti
config=settings.loadConfig()
def check(url):
# Request POST https://scan.nextcloud.com/api/queue
data_send = {"url":url}
se=requests.post('https://scan.nextcloud.com/api/queue', data=json.dumps(data_send), headers={'X-CSRF': 'true', 'Content-Type': 'application/json'})
se=se.json()
# Request GET https://scan.nextcloud.com/api/result/ UUID
res=requests.get('https://scan.nextcloud.com/api/result/'+se["uuid"], data="", headers={'X-CSRF': 'true', 'Content-Type': 'application/json'})
res=res.json()
# Notify
if res["rating"]<4:
noti.notifyAll("Rating down to: "+res["rating"])
if len(res["vulnerabilities"])>0:
noti.notifyAll("vulnerabilities found "+len(res["vulnerabilities"]))
check(config["url"])