ValueError: No JSON object could be decoded

266 views
Skip to first unread message

skzaproxy

unread,
Mar 10, 2016, 5:43:01 AM3/10/16
to OWASP ZAP User Group
Hi,

I am running the following code (portion of code):

import time
from pprint import pprint
from zapv2 import ZAPv2
target = 'https://15.154.xxx.x'
zap = ZAPv2()
# Use the line below if ZAP is not listening on 8090
# zap = ZAPv2(proxies={'http': 'http://127.0.0.1:8090', 'https': 'http://127.0.0.1:8090'})
# do stuff
print 'Accessing target %s' % target
# try have a unique enough session...
zap.urlopen(target)
# Give the sites tree a chance to get updated
time.sleep(2)
print 'Spidering target %s' % target
zap.spider.scan(target)
# Give the Spider a chance to start
time.sleep(2)
while (int(zap.spider.status()) < 100):
    print 'Spider progress %: ' + zap.spider.status()
    time.sleep(2)

......................

Getting following error:


Accessing target https://15.154.xxx.x
Spidering target https://15.154.xxx.x
Traceback (most recent call last):
  File "zap6.py", line 20, in <module>
    zap.spider.scan(target)
  File "c:\Python27\lib\site-packages\zapv2\spider.py", line 148, in scan
    return next(self.zap._request(self.zap.base + 'spider/action/scan/', params)
.itervalues())
  File "c:\Python27\lib\site-packages\zapv2\__init__.py", line 141, in _request
    return json.loads(self.urlopen(url + '?' + urllib.urlencode(get)))
  File "c:\Python27\lib\json\__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "c:\Python27\lib\json\decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "c:\Python27\lib\json\decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded



I am able to access : http://localhost:8090/
And also able to access API.

I get same error even if I use API key.

I am using owasp....2.4.3 with API package as 2.4-0.0.7.....
Please let me know how to proceed.

Thanks in advance.

Regards



skzaproxy

unread,
Mar 10, 2016, 5:55:18 AM3/10/16
to OWASP ZAP User Group
config.xml
Auto Generated Inline Image 1

thc...@gmail.com

unread,
Mar 10, 2016, 6:38:36 AM3/10/16
to zaprox...@googlegroups.com
Hi.

By default the ZAP API client will try to connect to port 8080.
If ZAP is listening on other port you need to configure the ZAP API
client accordingly, like the following:

> zap = ZAPv2(proxies={'http': 'http://127.0.0.1:8090', 'https': 'http://127.0.0.1:8090'})


Best regards.
> --
> You received this message because you are subscribed to the Google
> Groups "OWASP ZAP User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to zaproxy-user...@googlegroups.com
> <mailto:zaproxy-user...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages