Grunny/zap-cli

ZAPHelper.run_spider() tries to convert self.zap.spider.status() to int, but it raises ValueError

Closed this issue · 1 comments

self.zap.spider.status() returns "Does Not Exist" but run_spider() tries to convert it to int()

$ python -m pdb /usr/local/bin/zap-cli spider http://127.0.0.1:10080/
> /usr/local/bin/zap-cli(4)<module>()
-> import re
(Pdb) c
[INFO]            Running spider...
Traceback (most recent call last):
  File "/usr/lib/python2.7/pdb.py", line 1314, in main
    pdb._runscript(mainpyfile)
  File "/usr/lib/python2.7/pdb.py", line 1233, in _runscript    self.run(statement)
  File "/usr/lib/python2.7/bdb.py", line 400, in run
    exec cmd in globals, locals
  File "<string>", line 1, in <module>
  File "/usr/local/bin/zap-cli", line 4, in <module>
    import re
  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 160, in spider_url
    zap_helper.run_spider(url)
  File "/usr/local/lib/python2.7/dist-packages/zapcli/zap_helper.py", line 131, in run_spider
    while int(self.zap.spider.status()) < 100:
ValueError: invalid literal for int() with base 10: 'Does Not Exist'
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /usr/local/lib/python2.7/dist-packages/zapcli/zap_helper.py(131)run_spider()
-> while int(self.zap.spider.status()) < 100:
(Pdb) p self.zap.spider.status()
u'Does Not Exist'

Hi @MikimotoH :). Thanks for reporting the bug. I've released a fix for it, so if you upgrade zap-cli to the latest version (0.2.1) you should hopefully no longer see this issue. Please let me know if the issue is fixed!