Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy address cannot be configured #91

Open
jgsuess opened this issue Nov 13, 2019 · 3 comments
Open

Proxy address cannot be configured #91

jgsuess opened this issue Nov 13, 2019 · 3 comments

Comments

@jgsuess
Copy link

jgsuess commented Nov 13, 2019

I have a scenario where proxy port 8080 is occupied.

zap.sh -daemon -config proxy.port=9090

succeeds, while

zap-cli start --start-options '-config proxy.port=9090'

yields

[INFO]            Starting ZAP daemon
[ERROR]           Another process is listening on http://127.0.0.1:8080

which seems to be an error.

@jgsuess
Copy link
Author

jgsuess commented Nov 14, 2019

It needs to be

zap-cli  --port 9090 start 

This is not obvious, however.

@jgsuess
Copy link
Author

jgsuess commented Nov 14, 2019

But shutdown fails:

zap@josuess-Latitude-7490:/zap$ zap-cli --port 9090 shutdown
[INFO]            Shutting down ZAP daemon
Traceback (most recent call last):
  File "/usr/local/bin/zap-cli", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 26, in new_func
    return ctx.invoke(f, ctx.obj, *args[1:], **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/zapcli/cli.py", line 67, in shutdown_zap_daemon
    zap_helper.shutdown()
  File "/usr/local/lib/python2.7/dist-packages/zapcli/zap_helper.py", line 104, in shutdown
    self.zap.core.shutdown()
  File "/usr/local/lib/python2.7/dist-packages/zapv2/core.py", line 291, in shutdown
    return six.next(six.itervalues(self.zap._request(self.zap.base + 'core/action/shutdown/', {'apikey': apikey})))
  File "/usr/local/lib/python2.7/dist-packages/zapv2/__init__.py", line 159, in _request
    data = self._request_api(url, get)
  File "/usr/local/lib/python2.7/dist-packages/zapv2/__init__.py", line 149, in _request_api
    return self.session.get(url, params=query, proxies=self.__proxies, verify=False)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",))

@jgsuess
Copy link
Author

jgsuess commented Nov 14, 2019

There is a bug in https://github.com/Grunny/zap-cli/blob/master/zapcli/zap_helper.py#L49
The apikey is assigned only after it is used to instantiate the api. The api then defaults to an empty key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant