-
Notifications
You must be signed in to change notification settings - Fork 0
/
myZAP.py
34 lines (28 loc) · 1 KB
/
myZAP.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
#Packaging for EC2 Ubuntu
from zapv2 import ZAPv2
import logging, time
logging.basicConfig(filename='wessy.log', level=logging.DEBUG)
def fMYZAP(vURL):
try:
zapScore = 0
#API Key
f = open("pwessy.txt", "r")
apikey = f.readline()
print(apikey)
localProxy = {"http": "http://127.0.0.1:8080", "https": "http://127.0.0.1:8080"}
zap = ZAPv2(proxies=localProxy, apikey=apikey)
zap.urlopen(vURL)
zap.spider.scan(url=vURL, apikey=apikey)
while (int(zap.spider.status()) < 100):
time.sleep(20)
response = zap.core.alerts()
for item in response:
holdSTR = str(item)
if(holdSTR.find('''risk': 'High''') > 1):
zapScore -= 10
elif(holdSTR.find('''risk': 'Medium''') > 1):
zapScore -= 5
return zapScore
except Exception as e:
print('Zap error ' + str(e))
logging.DEBUG('Zap error ' + str(e))