77from slips_files .common .parsers .config_parser import (
88 ConfigParser ,
99)
10+ from slips_files .core .structures .alerts import (
11+ dict_to_alert ,
12+ Alert ,
13+ )
1014from ..fidesModule .messaging .message_handler import MessageHandler
1115from ..fidesModule .messaging .network_bridge import NetworkBridge
1216from ..fidesModule .model .configuration import load_configuration
@@ -72,7 +76,8 @@ def init(self):
7276 # so it shouldnt be stored in the current output dir, it should be
7377 # in the main slips dir
7478 self .sqlite = SQLiteDB (
75- self .logger , os .path .join (os .getcwd (), self .__trust_model_config .database )
79+ self .logger ,
80+ os .path .join (os .getcwd (), self .__trust_model_config .database ),
7681 )
7782
7883 def read_configuration (self ):
@@ -189,11 +194,10 @@ def main(self):
189194 # if there's no string data message we can continue waiting
190195 if not msg ["data" ]:
191196 return
192- alert_info : dict = json .loads (msg ["data" ])
193- profileid = alert_info ["profileid" ]
194- target = profileid .split ("_" )[- 1 ]
197+ alert : dict = json .loads (msg ["data" ])
198+ alert : Alert = dict_to_alert (alert )
195199 self .__alerts .dispatch_alert (
196- target = target ,
200+ target = alert . profile . ip ,
197201 confidence = 0.5 ,
198202 score = 0.8 ,
199203 )
@@ -212,6 +216,7 @@ def main(self):
212216 return
213217 self .__intelligence .request_data (ip )
214218
215- # TODO: delete whole if below, exists for testing purposes for tests/integration_tests/test_fides.py
219+ # TODO: the code below exists for testing purposes for
220+ # tests/integration_tests/test_fides.py
216221 self .get_msg ("fides2network" )
217222 self .get_msg ("fides2slips" )
0 commit comments