Created
July 9, 2015 09:19
-
-
Save anshumanbh/d9881fadd6bc194fcaed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import subprocess | |
import time | |
import urllib | |
from pprint import pprint | |
from zapv2 import ZAPv2 | |
import sys | |
print 'Starting ZAP ...' | |
subprocess.Popen(["zap.sh","-daemon","-port 8090","-host 0.0.0.0"],stdout=open(os.devnull,'w')) | |
print 'Waiting for ZAP to load, 10 seconds ...' | |
time.sleep(10) | |
target = sys.argv[1] | |
print target | |
zap = ZAPv2() | |
print 'Accessing target %s' % target | |
zap.urlopen(target) | |
time.sleep(2) | |
print 'Spidering target %s' % target | |
zap.spider.scan(target) | |
time.sleep(2) | |
while (int(zap.spider.status) < 100): | |
print 'Spider progress %: ' + zap.spider.status | |
time.sleep(2) | |
print 'Spider completed' | |
time.sleep(5) | |
print 'Scanning target %s' % target | |
zap.ascan.scan(target) | |
while (int(zap.ascan.status) < 100): | |
print 'Scan progress %: ' + zap.ascan.status | |
time.sleep(5) | |
print 'Scan completed' | |
with open("/zap/ZAP_2.4.0/report.xml", "w") as f: | |
f.write(zap.core.xmlreport) | |
f.close() | |
zap.core.shutdown() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment