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