MCPcopy Create free account
hub / github.com/OWASP/Python-Honeypot / ModuleProcessor

Class ModuleProcessor

modules/ssh/weak_password/__init__.py:11–50  ·  view source on GitHub ↗

this is the processor to run after docker machine is up to grab the log files or do other needed process...

Source from the content-addressed store, hash-verified

9
10
11class ModuleProcessor:
12 """
13 this is the processor to run after docker machine is up to grab the log
14 files or do other needed process...
15 """
16
17 def __init__(self):
18 self.kill_flag = False
19 self.log_filename = 'tmp/ohp_ssh_weak_password_logs.txt'
20 self.log_filename_dump = 'tmp/ohp_ssh_weak_password_files_logs.json'
21 self.stop_execution = False
22 self.DIRECTORY_TO_WATCH = os.getcwd() + "/tmp/ohp_ssh_weak_container/"
23 self.EXCLUDES = ['/dev']
24 self.module_name = "ssh/weak_password"
25 if not os.path.exists(self.DIRECTORY_TO_WATCH):
26 os.makedirs(self.DIRECTORY_TO_WATCH)
27
28 def processor(self):
29 """
30 processor function will be called as a new thread and will be die when
31 kill_flag is True
32 :return:
33 """
34 newFileHandler = FileMonitor()
35 newFileHandler.log_filename = self.log_filename
36 newFileHandler.log_filename_dump = self.log_filename_dump
37 newFileHandler.DIRECTORY_TO_WATCH = self.DIRECTORY_TO_WATCH
38 newFileHandler.EXCLUDES = self.EXCLUDES
39 newFileHandler.module_name = self.module_name
40 thread = threading.Thread(target=newFileHandler.run, args=(), name="ssh_weak_password_processor")
41 if os.path.exists(self.log_filename):
42 os.remove(self.log_filename) # remove if exist from past
43 thread.start() # Start the execution
44 while not self.kill_flag:
45 try:
46 time.sleep(0.1)
47 except Exception:
48 pass
49 newFileHandler.stop()
50 terminate_thread(thread)
51
52
53def module_configuration():

Callers 1

module_configurationFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected