MCPcopy Index your code
hub / github.com/AutoRecon/AutoRecon / start_heartbeat

Function start_heartbeat

autorecon/main.py:129–165  ·  view source on GitHub ↗
(target, period=60)

Source from the content-addressed store, hash-verified

127 termios.tcsetattr(sys.stdin.fileno(), termios.TCSADRAIN, terminal_settings)
128
129async def start_heartbeat(target, period=60):
130 while True:
131 await asyncio.sleep(period)
132 async with target.lock:
133 count = len(target.running_tasks)
134
135 if config['verbose'] >= 1:
136 tasks_list = []
137 for tag, task in target.running_tasks.items():
138 task_str = tag
139
140 if config['verbose'] >= 2:
141 processes = []
142 for process_dict in task['processes']:
143 if process_dict['process'].returncode is None:
144 processes.append(str(process_dict['process'].pid))
145 try:
146 for child in psutil.Process(process_dict['process'].pid).children(recursive=True):
147 processes.append(str(child.pid))
148 except psutil.NoSuchProcess:
149 pass
150
151 if processes:
152 task_str += ' (PID' + ('s' if len(processes) > 1 else '') + ': ' + ', '.join(processes) + ')'
153
154 tasks_list.append(task_str)
155
156 tasks_list = ': {bblue}' + ', '.join(tasks_list) + '{rst}'
157 else:
158 tasks_list = ''
159
160 current_time = datetime.now().strftime('%H:%M:%S')
161
162 if count > 1:
163 info('{bgreen}' + current_time + '{rst} - There are {byellow}' + str(count) + '{rst} scans still running against {byellow}' + target.address + '{rst}' + tasks_list)
164 elif count == 1:
165 info('{bgreen}' + current_time + '{rst} - There is {byellow}1{rst} scan still running against {byellow}' + target.address + '{rst}' + tasks_list)
166
167async def keyboard():
168 input = ''

Callers 1

scan_targetFunction · 0.85

Calls 1

infoFunction · 0.90

Tested by

no test coverage detected