Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion modules/ip_info/ip_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import time
import asyncio
import multiprocessing
from functools import lru_cache


from modules.ip_info.jarm import JARM
Expand Down Expand Up @@ -93,14 +94,25 @@ async def open_dbs(self):
self.reading_mac_db_task = asyncio.create_task(self.read_mac_db())

async def read_mac_db(self):
"""
waits 10 mins for the update manager to download the mac db and
opens it for reading. retries opening every 3s
"""
trials = 0
while True:
if trials >= 60:
# that's 10 mins of waiting for the macdb (600s)
# dont wait forever
return

try:
self.mac_db = open("databases/macaddress-db.json", "r")
return True
except OSError:
# update manager hasn't downloaded it yet
try:
time.sleep(3)
time.sleep(10)
trials += 1
except KeyboardInterrupt:
return False

Expand Down Expand Up @@ -186,6 +198,7 @@ def get_vendor_online(self, mac_addr):
):
return False

@lru_cache(maxsize=700)
def get_vendor_offline(self, mac_addr, profileid):
"""
Gets vendor from Slips' offline database databases/macaddr-db.json
Expand Down
Loading
Loading