I tried this API call, and the zap-api-scan.py is giving me an error.
So here is the test I want to implement:
1) I want to test whether certain URL (e.g:
http://localhost/test) are accessible (it return an HTTP status code of 200)
2) If the URL is accessible then there is a vulnerability
I suceeded to do this but not in a beautfiul way, here is how I did it:
1) I created a custom JavaScript script to capture response and check the url of response and status code
2) I loaded and enabled this JS script via the Python API in the zap-api-scan.py file (zap.script.load/zap.script.enable)
3) I added the wanted URL to the ZAP scope via the Python API in the zap-api-scan.py: zap.core.access_url(
http://localhost/test)
So it's working well, but there is two problem:
1)
If I want to add other test case scenario, I will have to heavily
modify zap-api-scan.py again, and I want to avoid it and contain these
test cases inside one file only
2) I don't want to execute any other test (SQL Injection, ...), other that the custom one I created for that particular URL (
http://localhost/test)
However, I think I might achieve this scan with the help of hooks, I created a hook and I succesfully executed the code inside my hooks, since I have access to the zap object context in that hook, I guess I can now raise alert to the zap proxy core and sucessfuly implement my custom test case.