Skip to content

Commit 6272a59

Browse files
author
github-actions
committed
revert shodan commit
1 parent 76728a4 commit 6272a59

File tree

2 files changed

+2
-42
lines changed

2 files changed

+2
-42
lines changed

bbot/modules/shodan_idb.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import time
2-
31
from bbot.modules.base import BaseModule
42

53

@@ -52,16 +50,11 @@ class shodan_idb(BaseModule):
5250
# we get lots of 404s, that's normal
5351
_api_failure_abort_threshold = 9999999999
5452

55-
# since there are rate limits, we set a lower qsize
56-
# this way when our queue is full, we don't overwhelm the API
57-
_qsize = 100
53+
# there aren't any rate limits to speak of, so our outgoing queue can be pretty big
54+
_qsize = 500
5855

5956
base_url = "https://internetdb.shodan.io"
6057

61-
async def setup(self):
62-
await super().setup()
63-
self.last_request_time = 0
64-
6558
def _incoming_dedup_hash(self, event):
6659
return hash(self.get_ip(event))
6760

@@ -70,16 +63,6 @@ async def handle_event(self, event):
7063
if ip is None:
7164
return
7265
url = f"{self.base_url}/{ip}"
73-
74-
# Rate limiting: ensure at least 1 second between requests
75-
current_time = time.time()
76-
time_since_last = current_time - self.last_request_time
77-
if time_since_last < 1:
78-
await self.helpers.sleep(1 - time_since_last)
79-
80-
# Update the last request time
81-
self.last_request_time = time.time()
82-
8366
r = await self.api_request(url)
8467
if r is None:
8568
self.debug(f"No response for {event.data}")

bbot/test/test_step_2/module_tests/test_module_shodan_idb.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,3 @@ def check(self, module_test, events):
5858
if e.type == "TECHNOLOGY" and e.data["technology"] == "cpe:/a:microsoft:outlook_web_access:15.0.1367"
5959
]
6060
)
61-
62-
63-
class TestShodan_IDB_RateLimit(ModuleTestBase):
64-
config_overrides = {"dns": {"minimal": False}}
65-
module_name = "shodan_idb"
66-
67-
async def setup_before_prep(self, module_test):
68-
await module_test.mock_dns(
69-
{
70-
"blacklanternsecurity.com": {"A": ["1.2.3.4"]},
71-
"autodiscover.blacklanternsecurity.com": {"A": ["2.3.4.5"]},
72-
"mail.blacklanternsecurity.com": {"A": ["3.4.5.6"]},
73-
}
74-
)
75-
76-
module_test.httpx_mock.add_response(
77-
url="https://internetdb.shodan.io/1.2.3.4",
78-
status_code=429,
79-
json={"error": "Rate limit exceeded"},
80-
)
81-
82-
def check(self, module_test, events):
83-
pass

0 commit comments

Comments
 (0)