cescobarresi / ciscoreputation

Get the Cisco's talosintelligence.com reputation for an ip address
MIT License
28 stars 13 forks source link

Error in ciscoreputation script #5

Closed fredericpougnault closed 5 years ago

fredericpougnault commented 6 years ago

Hello,

Since one week, when I execute ciscoreputation script I have this error

Traceback (most recent call last): File "/usr/bin/ciscoreputation", line 9, in load_entry_point('ciscoreputation==2.0.1', 'console_scripts', 'ciscoreputation')() File "/usr/lib/python2.6/site-packages/ciscoreputation/init.py", line 4, in main do_main() File "/usr/lib/python2.6/site-packages/ciscoreputation/ciscoreputation.py", line 97, in do_main data = get_data(arguments['']) File "/usr/lib/python2.6/site-packages/ciscoreputation/ciscoreputation.py", line 43, in get_data 'query_entry':search_string File "/usr/lib/python2.6/site-packages/requests/models.py", line 802, in json return json.loads(self.text, **kwargs) File "/usr/lib64/python2.6/site-packages/simplejson/init.py", line 307, in loads return _default_decoder.decode(s) File "/usr/lib64/python2.6/site-packages/simplejson/decoder.py", line 335, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib64/python2.6/site-packages/simplejson/decoder.py", line 353, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded

paagalladka commented 5 years ago

Hello @fredericpougnault,

Just replace headers={'referer':'https://talosintelligence.com/reputation_center/lookup?search=%s'%search_string} with headers={'referer':'https://talosintelligence.com/reputation_center/lookup?search=%s'%search_string, 'User-agent': 'Mozilla/5.0'}

in ciscoreputation.py.

@cescobarresi : Can u please update the source to have a userAgent info. Thanks

fredericpougnault commented 5 years ago

Hello @paagalladka,

Thank you for your response its works.

Regards,

cescobarresi commented 5 years ago

Thanks @fredericpougnault for pointing out the error and thanks to @paagalladka for supplying a useful answer. I just fixed this issue. While I was there I though to simply rewrite the print statements to be compatible with python3.

Version v2.1.4 is available at PyPi