Two question about ZAP API

45 views
Skip to first unread message

洪嘉佑

unread,
Mar 28, 2023, 4:15:45 AM3/28/23
to zaprox...@googlegroups.com
Question 1
How can I get only passive scanning results or active scanning results by using the  GET /JSON/core/view/alerts/   endpoint? 

Question 2
I've used  GET /JSON/ascan/view/scanPolicyNames endpoint to get the scanPolicyNames and I only get "Default Policy", can I use any API endpoint to import more policies? 

Simon Bennetts

unread,
Mar 28, 2023, 4:34:53 AM3/28/23
to OWASP ZAP User Group
Replies inline:

On Tuesday, 28 March 2023 at 09:15:45 UTC+1 irving...@gmail.com wrote:
Question 1
How can I get only passive scanning results or active scanning results by using the  GET /JSON/core/view/alerts/   endpoint?

You cant.
You can either:
  • Call that endpoint after the passive scan queue has been empties and before you start an active scan
  • Retrieve all of the alerts and then filter them locally using the sourceid - search for a type of "Alert Source" on https://www.zaproxy.org/docs/constants/ to see the possible values
 
Question 2
I've used  GET /JSON/ascan/view/scanPolicyNames endpoint to get the scanPolicyNames and I only get "Default Policy", can I use any API endpoint to import more policies? 

Yes:  /JSON/ascan/action/importScanPolicy

Cheers,

Simon

洪嘉佑

unread,
Mar 31, 2023, 6:47:05 AM3/31/23
to zaprox...@googlegroups.com
Hi,

Replies to Q1:

I've used  GET /JSON/spider/action/scan/ to start a spider scanning . After the spider scanning finished, I used    GET /JSON/core/view/alerts/
to get the alert information but it says that there is no alert being raised. 
It replies like this:
{
"alerts": []
} I'd like to know why this happened and how can I make it works

Replies to Q2:

The document (https://www.zaproxy.org/docs/api/#ascanactionimportscanpolicy) indicates that  GET /JSON/ascan/action/importScanPolicy/
endpoint requires a query parameter "path, which is a file system path. 

So does it mean I need to get an policy file online and install it on my local machine or I can get those files through zap ? 


Thanks for your replying 


---------- Forwarded message ---------
寄件者: Simon Bennetts <psi...@gmail.com>
Date: 2023年3月28日 週二 下午4:34
Subject: [zaproxy-users] Re: Two question about ZAP API
To: OWASP ZAP User Group <zaprox...@googlegroups.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/adb92c31-217a-489a-8d86-a36592d4ab43n%40googlegroups.com.

Simon Bennetts

unread,
Mar 31, 2023, 6:49:36 AM3/31/23
to OWASP ZAP User Group
Have you waited for the passive scan queue to empty?

The policy file needs to be locally accessible.

FYI you may find the Automation Framework an easier option for automating ZAP: https://www.zaproxy.org/docs/automate/automation-framework/

Cheers,

Simon

洪嘉佑

unread,
Apr 12, 2023, 7:50:07 AM4/12/23
to zaprox...@googlegroups.com
Dear Simon:

Replied to Q1 :
Yes I have used endpoint JSON/pscan/view/recordsToScan to check that there are no  records the passive scanner still has to scan by showing 
{
"recordsToScan": "0"
}


Replied to Q2:
Does zap's  Github repository provide some download links of scan policies?


Thanks for your replying 
Simon Bennetts <psi...@gmail.com> 於 2023年3月31日 週五 下午6:49寫道:
Reply all
Reply to author
Forward
0 new messages