Skip to content

Shodan requests occasionally time out #1

Description

@DakotaNelson

Requests from the Shodan module occasionally return with the following:

[2014-11-30 17:50:17,149: ERROR/MainProcess] Task celery.local.shodanTask[ecfeb5d1-fd61-4022-b4fd-42d4fded7c48] raised unexpected: ModuleException('Request to https://api.shodan.io/shodan/host/search returned with error 500.\n Response body: {"error": "The search request has timed out or your query was invalid."}',)
Traceback (most recent call last):
  File "/home/dnelson/.pyenv/versions/3.3.3/lib/python3.3/site-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/home/dnelson/.pyenv/versions/3.3.3/lib/python3.3/site-packages/celery/app/trace.py", line 437, in __protected_call__
    return self.run(*args, **kwargs)
  File "/home/dnelson/.pyenv/versions/3.3.3/lib/python3.3/site-packages/celery/local.py", line 167, in <lambda>
    __call__ = lambda x, *a, **kw: x._get_current_object()(*a, **kw)
  File "/home/dnelson/.pyenv/versions/3.3.3/lib/python3.3/site-packages/celery/app/trace.py", line 438, in __protected_call__
    return orig(self, *args, **kwargs)
  File "/home/dnelson/.pyenv/versions/3.3.3/lib/python3.3/site-packages/celery/app/task.py", line 420, in __call__
    return self.run(*args, **kwargs)
  File "/projects/pushpin-web/pushpin-app/map/tasks.py", line 68, in shodanTask
    module.run(location.name,location.latitude,location.longitude,location.radius)
  File "/projects/pushpin-web/pushpin-app/modules/shodan.py", line 19, in run
    results = self.search_shodan_api(query, limit)
  File "/projects/pushpin-web/pushpin-app/modules/module.py", line 142, in search_shodan_api
    resp = self.request(url, content=payload)
  File "/projects/pushpin-web/pushpin-app/modules/module.py", line 87, in request
    raise ModuleException("Request to " + url + " returned with error " + str(r.status_code) + ".\n Response body: " + r.text)
modules.module.ModuleException: Request to https://api.shodan.io/shodan/host/search returned with error 500.
 Response body: {"error": "The search request has timed out or your query was invalid."}

Which is almost certainly caused by the request timing out, since this was an issue in recon-ng. Since celery is set up how it is, one Shodan request timing out causes the rest to be canceled, which is unfortunate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions