If you want to run an AjaxSpider with ZAP (Zed Attack Proxy), you do not need to explicitly set "passive scan rules" before running the AjaxSpider.
Passive scan rules are enabled by default in ZAP, and they will automatically be applied to the requests generated by the AjaxSpider. Therefore, you do not need to take any additional steps to enable passive scan rules specifically for AjaxSpider scanning.
However, you can customize which passive scan rules are applied by modifying the "Scan Policy" in the ZAP options. The Scan Policy allows you to enable or disable specific passive scan rules, so you can tailor the scanning to your specific needs.
To run an AjaxSpider in ZAP, you can use the following code:
python
Copy code
# Import the ZAP API client
from zapv2 import ZAPv2
# Create a ZAP API client
zap = ZAPv2()
# Start the AjaxSpider
zap.ajaxSpider.scan('
http://example.com')
This will start the AjaxSpider scanning the specified target URL. If you want to enable specific scanners during the AjaxSpider scan, you can use the api.pscan.enableScanners(ids) method that you mentioned in your question. However, as mentioned above, you do not need to enable passive scan rules specifically for AjaxSpider scanning, as they are enabled by default.