2021-11-30 21:33:27,534 Trigger hook: zap_pre_shutdown, args: 1
Pre shutdown method begin <----- (prints from within my hook file)
2021-11-30 21:33:27,535 Starting new HTTP connection (1): zap:80
ERROR HTTPConnectionPool(host='zap', port=80): Max retries exceeded with url: /JSON/stats/view/stats/?keyPrefix=stats.auth.success (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f3e83b748b0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
2021-11-30 21:33:27,640 I/O error: HTTPConnectionPool(host='zap', port=80): Max retries exceeded with url: /JSON/stats/view/stats/?keyPrefix=stats.auth.success (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f3e83b748b0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/urllib3/connection.py", line 158, in _new_conn
conn = connection.create_connection(
File "/usr/local/lib/python3.8/dist-packages/urllib3/util/connection.py", line 57, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
----------------------
So I can't make a request to the proper endpoint. I also tried /JSON/stats/view/stats/, as well as other endpoints, but receive the same errors.
Thanks for your help!!
2021-12-01 14:27:01,187 Trigger hook: zap_pre_shutdown, args: 1
Pre shutdown method begin
2021-12-01 14:27:01,189 Starting new HTTP connection (1): localhost:38059
2021-12-01 14:27:01,192 http://localhost:38059 "GET http://zap/JSON/stats/view/stats/?keyPrefix=stats.auth.success HTTP/1.1" 200 2
ERROR <class 'StopIteration'>
2021-12-01 14:27:01,192 Unexpected error: <class 'StopIteration'>
Traceback (most recent call last):
File "/zap/zap-api-scan.py", line 589, in main
trigger_hook('zap_pre_shutdown', zap)
File "/zap/zap_common.py", line 131, in trigger_hook
response = hook_fn(*args_list, **kwargs)
File "/zap/wrk/zap-view-stats.py", line 14, in zap_pre_shutdown
print(zap.stats.stats("stats.auth.success"))
File "/usr/local/lib/python3.8/dist-packages/zapv2/stats.py", line 37, in stats
return six.next(six.itervalues(self.zap._request(self.zap.base + 'stats/view/stats/', params)))
StopIteration