Skip to content
Snippets Groups Projects
Commit 5d9f404f authored by Zitnik, Anze's avatar Zitnik, Anze
Browse files

"Smarter" waiting for ZAP to start in cscan plugin.

parent 3319d071
Branches
No related tags found
No related merge requests found
--- plugin/zap.py 2015-11-24 16:46:07.543884068 +0000
+++ /tmp/zap.py 2015-11-25 08:33:33.983165539 +0000
@@ -78,7 +78,7 @@
print 'Starting ZAP ...'
global child_pid
- proc = subprocess.Popen([cmd,'-daemon'])
+ proc = subprocess.Popen([cmd,'-daemon', '-config', 'api.disablekey=true'])
child_pid = proc.pid
print 'Waiting for ZAP to load, 10 seconds ...'
@@ -129,4 +129,4 @@
#EOF
if __name__ == "__main__":
- main()
\ No newline at end of file
+ main()
19a20
> import psutil
81c82
< proc = subprocess.Popen([cmd,'-daemon'])
---
> proc = subprocess.Popen([cmd,'-daemon', '-config', 'api.disablekey=true'])
84,85c85,94
< print 'Waiting for ZAP to load, 10 seconds ...'
< time.sleep(10)
---
> print 'Waiting for ZAP to load...'
> max_wait=60
> import time
> import psutil
> time1=time.time()
> while True:
> if 8080 in [i.laddr.port for i in psutil.Process(proc.pid).connections() if i.status=='LISTEN']:
> break
> if time.time()-time1 > max_wait:
> raise Exception("ZAP wait timeout")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment