Skip to content

Commit

Permalink
shodan: finish on invalid page
Browse files Browse the repository at this point in the history
  • Loading branch information
xmendez committed Apr 15, 2019
1 parent fa28eb2 commit 1c00d49
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/wfuzz/plugin_api/payloadtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def __init__(self, dork, page, limit):
self.api = shodan.Shodan(key)
self._dork = dork
self._page = MyCounter(page)
self._page_limit = limit
self._page_limit = self._page() + limit

self.results_queue = Queue(self.MAX_ENQUEUED_RES)
self.page_queue = Queue()
Expand All @@ -166,7 +166,7 @@ def _do_search(self):
self.page_queue.task_done()
continue

if page > self._page_limit:
if page >= self._page_limit:
self.page_queue.task_done()
self.results_queue.put(None)
continue
Expand All @@ -182,7 +182,10 @@ def _do_search(self):
self.page_queue.put(self._page.inc())
except shodan.APIError as e:
self.page_queue.task_done()
self.results_queue.put(e)
if "Invalid page size" in str(e):
self.results_queue.put(None)
else:
self.results_queue.put(e)
continue

def __iter__(self):
Expand Down

0 comments on commit 1c00d49

Please sign in to comment.