Skip to content

Commit

Permalink
Merge pull request #445 from stratosphereips/alya/fix_numbering_tws
Browse files Browse the repository at this point in the history
Fix numbering timewindows
  • Loading branch information
AlyaGomaa authored Feb 1, 2024
2 parents be55403 + ff72c3e commit de9992d
Show file tree
Hide file tree
Showing 22 changed files with 470 additions and 459 deletions.
11 changes: 7 additions & 4 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,29 @@


@pytest.fixture
def mock_rdb():
def mock_db():
# Create a mock version of the database object
with patch('slips_files.core.database.database_manager.DBManager') as mock:
yield mock.return_value

def do_nothing(*arg):
"""Used to override the print function because using the self.print causes broken pipes"""
"""Used to override the print function because using the self.print causes
broken pipes"""
pass

@pytest.fixture
def input_queue():
"""This input_queue will be passed to all module constructors that need it"""
"""This input_queue will be passed to all module constructors that need
it"""
input_queue = Queue()
input_queue.put = do_nothing
return input_queue


@pytest.fixture
def profiler_queue():
"""This profiler_queue will be passed to all module constructors that need it"""
"""This profiler_queue will be passed to all module constructors that need
it"""
profiler_queue = Queue()
profiler_queue.put = do_nothing
return profiler_queue
Expand Down
13 changes: 8 additions & 5 deletions slips_files/core/database/database_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,11 @@ def add_out_notice(self, *args, **kwargs):
def add_out_ssl(self, *args, **kwargs):
return self.rdb.add_out_ssl(*args, **kwargs)

def getProfileIdFromIP(self, *args, **kwargs):
return self.rdb.getProfileIdFromIP(*args, **kwargs)
def get_profileid_from_ip(self, *args, **kwargs):
return self.rdb.get_profileid_from_ip(*args, **kwargs)

def get_first_flow_time(self, *args, **kwargs):
return self.rdb.get_first_flow_time(*args, **kwargs)

def getProfiles(self, *args, **kwargs):
return self.rdb.getProfiles(*args, **kwargs)
Expand Down Expand Up @@ -664,8 +667,8 @@ def add_new_older_tw(self, *args, **kwargs):
def add_new_tw(self, *args, **kwargs):
return self.rdb.add_new_tw(*args, **kwargs)

def getTimeTW(self, *args, **kwargs):
return self.rdb.getTimeTW(*args, **kwargs)
def get_tw_start_time(self, *args, **kwargs):
return self.rdb.get_tw_start_time(*args, **kwargs)

def getAmountTW(self, *args, **kwargs):
return self.rdb.getAmountTW(*args, **kwargs)
Expand Down Expand Up @@ -892,7 +895,7 @@ def get_branch(self, *args, **kwargs):
return self.rdb.get_branch(*args, **kwargs)

def add_alert(self, alert: dict):
twid_starttime: float = self.rdb.getTimeTW(alert['profileid'], alert['twid'])
twid_starttime: float = self.rdb.get_tw_start_time(alert['profileid'], alert['twid'])
twid_endtime: float = twid_starttime + RedisDB.width
alert.update({'tw_start': twid_starttime, 'tw_end': twid_endtime})
return self.sqlite.add_alert(alert)
Expand Down
2 changes: 1 addition & 1 deletion slips_files/core/database/redis_db/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def get_disabled_modules(self) -> list:
else:
return {}

def set_input_metadata(self, info:dict):
def set_input_metadata(self, info: dict):
"""
sets name, size, analysis dates, and zeek_dir in the db
"""
Expand Down
Loading

0 comments on commit de9992d

Please sign in to comment.