ZAP.bat issue

290 views
Skip to first unread message

sonawan...@gmail.com

unread,
Nov 28, 2022, 7:40:36 AM11/28/22
to OWASP ZAP User Group
Hello

I am having one small bat file to start zap but now I am getting one weird issue

java -Dwebdriver.chrome.logfile=C:\Users\user\Desktop\owasp\automation\chromedriver.log -jar zap-2.12.0.jar -port 8084 -config api.key=8uhfd4rrlmune7mveoedc7ckfm -config scanner.attackOnStart=true -config view.mode=attack
Error: Unable to access jarfile zap-2.12.0.jar

------------------------------------------------------------------------------------------------
The content of bat file is  - 

echo "Invoking OWASP ZAP"
Start cmd.exe /k "C:\program Files\owASP\Zed Attack Proxy\zap.bat" -port 8084 -config api.key=8uhfd4rrlmune7mveoedc7ckfm -config scanner.attackOnStart=true -config view.mode=attack
echo "OWASP ZAP Started Successfully"

--------------------------------------------------------------------------------------------------------------------------

I tried running it with Elevated Access as well, still it threw same error

(chrome and chromedrivers are compatible with each other)

KUBO, Yoshihito

unread,
Nov 28, 2022, 7:53:57 AM11/28/22
to zaprox...@googlegroups.com
Hello

    Error of "unable to access jarfile" raised for various kinds of reasons. Typical reason is that specification of jar file is invalid. Try to specify the path of zap-2.12.0.jar by full path.
 
---------------------------------------------------------------------------
久保 由仁(KUBO, Yoshihito)
---------------------------------------------------------------------------


2022年11月28日(月) 21:40 sonawan...@gmail.com <sonawan...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "OWASP ZAP User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zaproxy-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/zaproxy-users/e72e909f-d258-4a0a-a5ec-ce86acd7cd19n%40googlegroups.com.

sonawan...@gmail.com

unread,
Nov 28, 2022, 8:05:28 AM11/28/22
to OWASP ZAP User Group
Hello

Thank you for quick response,

As you can see - in my batch file, I am not passing any path for .JAR file

also When i manually start C:\Program Files\OWASP\Zed Attack Proxy\zap.bat file (or open zap application) it works perfect - means there is no issue with Java version as well...

The error appears only when i try to run above batch file

(I am on latest version 2.12.0  --- on earlier version same file used to work without any issue) 

KUBO, Yoshihito

unread,
Nov 28, 2022, 8:29:58 AM11/28/22
to zaprox...@googlegroups.com
Hello.

    I've copied your script and place the bat file in the same directory as  zap-2.12.0.jar file.   When I launch the bat file from inside of the same directory, it works fine.  But  I launch the bat file from outside of the directory by specifying the full path of bat file,  the message of  "Error: Unable to access jarfile zap-2.12.0.jar" is displayed and failed to launch ZAP.  

 
---------------------------------------------------------------------------
久保 由仁(KUBO, Yoshihito)
---------------------------------------------------------------------------


2022年11月28日(月) 22:05 sonawan...@gmail.com <sonawan...@gmail.com>:

sonawan...@gmail.com

unread,
Nov 29, 2022, 7:59:56 AM11/29/22
to OWASP ZAP User Group
Hello 

Thank you for investigating further, i agree the same behavior i also observed.

@ZAP Team
How to handle this - i guess some correction in zap.bat file is required.

(as of now i have supplied full path in zap.bat file and its working but need to work on fixed solution)

thc...@gmail.com

unread,
Nov 29, 2022, 8:30:45 AM11/29/22
to zaprox...@googlegroups.com
Change your bat to cd to the directory and then execute the zap.bat file.

Best regards.

On 29/11/2022 12:59, sonawan...@gmail.com wrote:
> Hello
>
> Thank you for investigating further, i agree the same behavior i also
> observed.
>
> @ZAP Team
> How to handle this - i guess some correction in zap.bat file is required.
>
> (as of now i have supplied full path in zap.bat file and its working but
> need to work on fixed solution)
>
> On Monday, November 28, 2022 at 6:59:58 PM UTC+5:30 jiu3...@gmail.com wrote:
>
>> Hello.
>>
>> I've copied your script and place the bat file in the same directory
>> as zap-2.12.0.jar file. When I launch the bat file from inside of the
>> same directory, it works fine. But I launch the bat file from outside of
>> the directory by specifying the full path of bat file, the message of
>> "Error: Unable to access jarfile zap-2.12.0.jar" is displayed and failed to
>> launch ZAP.
>>
>>
>> ---------------------------------------------------------------------------
>> 久保 由仁(KUBO, Yoshihito)
>> jiu3...@gmail.com
>> ---------------------------------------------------------------------------
>>
>>
>> 2022年11月28日(月) 22:05 sonawan...@gmail.com <sonawan...@gmail.com>:
>>
>>> Hello
>>>
>>> Thank you for quick response,
>>>
>>> As you can see - in my batch file, I am not passing any path for .JAR file
>>>
>>> also When i manually start *C:\Program Files\OWASP\Zed Attack
>>> Proxy\zap.bat* file (or open zap application) it works perfect - means
>>> there is no issue with Java version as well...
>>>
>>> The error appears only when i try to run above batch file
>>>
>>> (I am on latest version 2.12.0 --- on earlier version same file used to
>>> work without any issue)
>>>
>>> On Monday, November 28, 2022 at 6:23:57 PM UTC+5:30 jiu3...@gmail.com
>>> wrote:
>>>
>>>> Hello
>>>>
>>>> Error of "unable to access jarfile" raised for various kinds of
>>>> reasons. Typical reason is that specification of jar file is invalid. Try
>>>> to specify the path of zap-2.12.0.jar by full path.
>>>>
>>>>
>>>> ---------------------------------------------------------------------------
>>>> 久保 由仁(KUBO, Yoshihito)
>>>> jiu3...@gmail.com
>>>>
>>>> ---------------------------------------------------------------------------
>>>>
>>>>
>>>> 2022年11月28日(月) 21:40 sonawan...@gmail.com <sonawan...@gmail.com>:
>>>>
>>>>> Hello
>>>>>
>>>>> I am having one small bat file to start zap but now I am getting one
>>>>> weird issue
>>>>>
>>>>>
>>>>> *java
>>>>> -Dwebdriver.chrome.logfile=C:\Users\user\Desktop\owasp\automation\chromedriver.log
>>>>> -jar zap-2.12.0.jar -port 8084 -config api.key=8uhfd4rrlmune7mveoedc7ckfm
>>>>> -config scanner.attackOnStart=true -config view.mode=attackError: Unable to
>>>>> access jarfile zap-2.12.0.jar*
>>>>>
>>>>> *------------------------------------------------------------------------------------------------*
>>>>> *The content of bat file is - *
>>>>>
>>>>> echo "Invoking OWASP ZAP"
>>>>> Start cmd.exe /k "C:\program Files\owASP\Zed Attack Proxy\zap.bat"
>>>>> -port 8084 -config api.key=8uhfd4rrlmune7mveoedc7ckfm -config
>>>>> scanner.attackOnStart=true -config view.mode=attack
>>>>> echo "OWASP ZAP Started Successfully"
>>>>>
>>>>>
>>>>> --------------------------------------------------------------------------------------------------------------------------
>>>>>
>>>>> I tried running it with Elevated Access as well, still it threw same
>>>>> error
>>>>>
>>>>> (chrome and chromedrivers are compatible with each other)
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "OWASP ZAP User Group" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to zaproxy-user...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/zaproxy-users/e72e909f-d258-4a0a-a5ec-ce86acd7cd19n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/zaproxy-users/e72e909f-d258-4a0a-a5ec-ce86acd7cd19n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "OWASP ZAP User Group" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to zaproxy-user...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/zaproxy-users/2114bc03-93f1-4d36-b2e2-b06b7ab9ead0n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/zaproxy-users/2114bc03-93f1-4d36-b2e2-b06b7ab9ead0n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>

sonawan...@gmail.com

unread,
Nov 30, 2022, 1:45:07 AM11/30/22
to OWASP ZAP User Group
Hey thanks Thc202

what an easy solution... how i missed it... (i was thinking for all possible complex solutions for this...and missed this simple solution)

Thank you once again.... 

KUBO, Yoshihito

unread,
Nov 30, 2022, 3:45:05 AM11/30/22
to zaprox...@googlegroups.com
Hello.

  How is the following one-liner? 
 
  cd  [path to the directory containing zap.bat file]  && zap.bat

  Could you let me know why you need to launch the bat file from outside of the directory that contains zap.bat file?

---------------------------------------------------------------------------
久保 由仁(KUBO, Yoshihito)
---------------------------------------------------------------------------


2022年11月30日(水) 15:45 sonawan...@gmail.com <sonawan...@gmail.com>:

sonawan...@gmail.com

unread,
Nov 30, 2022, 6:14:18 AM11/30/22
to OWASP ZAP User Group
Hello

Sometime to automate ZAP in DevOps i need to write command to start ZAP using this batch file

Reply all
Reply to author
Forward
0 new messages