OWASP ZAP not being started from Powershell.

254 views
Skip to first unread message

Salman Khwaja

unread,
Oct 2, 2016, 4:28:28 AM10/2/16
to OWASP ZAP User Group
Hi, 
I am trying to open OWASP ZAP API Daemon from powershell. when I link it up with TFS, it is always giving me some problems and API does not seems to be running properly. Can one of you please comments if I am doing anything wrong. Following is my Powershell scripts. 


Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
cd
\
C
:
$env
:Owasp_path="C:\Program Files (x86)\OWASP\Zed Attack Proxy"
# cd "$env:OWASP_Path"
# cd "C:\Program Files (x86)\OWASP\Zed Attack Proxy"
# start-process .\Zap.bat -daemon -host %ProxyHost% -port %ProxyPort%
# ./Zap.bat -daemon -host $env:ProxyHost -port $env:ProxyPort -config api.disablekey=true
# start-job -scriptblock {./Zap.bat -daemon -host $env:ProxyHost -port $env:ProxyPort -config api.disablekey=true}


start
-job -scriptblock {
 cd
"$env:OWASP_Path";
   
./Zap.bat -daemon -host $env:ProxyHost -port $env:ProxyPort -config api.disablekey=true
   
}
 
echo
"Going in for the Sleep of 10 Seconds"
start
-sleep -s 10
get-job Job1
receive
-job Job1

kingthorin+owaspzap

unread,
Oct 2, 2016, 6:17:15 AM10/2/16
to OWASP ZAP User Group
Do you get any stout or stderr output?

Have you tried echoing your environment vars to make sure they're set and being used effectively?

Write-Output $env:ProxyPort

Salman Khwaja

unread,
Oct 2, 2016, 6:50:16 AM10/2/16
to OWASP ZAP User Group
Yep. On one agent it runs smoothly. On another, where visual studio is installed, it does not runs.I am echoing back the environment vars in my code. Ain't I. 

kingthorin+owaspzap

unread,
Oct 2, 2016, 9:10:42 PM10/2/16
to OWASP ZAP User Group
The example you provided uses environment vars but there's no assurance that they're properly set or returned.

If you have it working one place and not another, then you need to limit the differences and troubleshoot it.

Without some output or something more specific than "giving problems" and "does not seem to be working properly"...like there's not much we can help with.

Salman Khwaja

unread,
Oct 2, 2016, 11:39:27 PM10/2/16
to OWASP ZAP User Group
My apologies. I will check and confirm.

Salman Khwaja

unread,
Oct 9, 2016, 2:53:32 AM10/9/16
to OWASP ZAP User Group
Hi, 

I have checked and found the following differences. Those agents which are having VISUAL STUDIO are having weird problems when running Powershell. Sometimes it runs, sometimes it doesn't. 

The other machines, where Visual Studio is not installed, there with powershell, the ZAP is running as a background job successfully. 

What are the Environment Variables ZAP is dependent on ? .....

kingthorin+owaspzap

unread,
Oct 9, 2016, 8:20:00 AM10/9/16
to OWASP ZAP User Group
ZAP isn't dependant upon env vars, your script is.
Reply all
Reply to author
Forward
0 new messages