processor function will be called as a new thread and will be die when kill_flag is True :return:
(self)
| 20 | self.log_filename_dump = 'tmp/ohp_smtp_honeypot_logs.json' |
| 21 | |
| 22 | def processor(self): |
| 23 | """ |
| 24 | processor function will be called as a new thread and will be die when kill_flag is True |
| 25 | :return: |
| 26 | """ |
| 27 | if os.path.exists(self.log_filename): |
| 28 | os.remove(self.log_filename) # remove if exist from past |
| 29 | while not self.kill_flag: |
| 30 | if os.path.exists(self.log_filename): |
| 31 | os.rename(self.log_filename, self.log_filename_dump) |
| 32 | data_dump = open(self.log_filename_dump).readlines() |
| 33 | for data in data_dump: |
| 34 | data = json.loads(data) |
| 35 | insert_to_credential_events_collection( |
| 36 | CredentialEvent( |
| 37 | ip_src=data['ip'], |
| 38 | module_name=data['module_name'], |
| 39 | date=data['date'], |
| 40 | username=data['username'], |
| 41 | password=data['password'], |
| 42 | ) |
| 43 | ) |
| 44 | os.remove(self.log_filename_dump) |
| 45 | time.sleep(0.1) |
| 46 | |
| 47 | |
| 48 | def module_configuration(): |
nothing calls this directly
no test coverage detected