()
| 165 | info('{bgreen}' + current_time + '{rst} - There is {byellow}1{rst} scan still running against {byellow}' + target.address + '{rst}' + tasks_list) |
| 166 | |
| 167 | async def keyboard(): |
| 168 | input = '' |
| 169 | while True: |
| 170 | if select.select([sys.stdin],[],[],0.1)[0]: |
| 171 | input += sys.stdin.buffer.read1(-1).decode('utf8') |
| 172 | while input != '': |
| 173 | if len(input) >= 3: |
| 174 | if input[:3] == '\x1b[A': |
| 175 | input = '' |
| 176 | if config['verbose'] == 3: |
| 177 | info('Verbosity is already at the highest level.') |
| 178 | else: |
| 179 | config['verbose'] += 1 |
| 180 | info('Verbosity increased to ' + str(config['verbose'])) |
| 181 | elif input[:3] == '\x1b[B': |
| 182 | input = '' |
| 183 | if config['verbose'] == 0: |
| 184 | info('Verbosity is already at the lowest level.') |
| 185 | else: |
| 186 | config['verbose'] -= 1 |
| 187 | info('Verbosity decreased to ' + str(config['verbose'])) |
| 188 | else: |
| 189 | if input[0] != 's': |
| 190 | input = input[1:] |
| 191 | |
| 192 | if len(input) > 0 and input[0] == 's': |
| 193 | input = input[1:] |
| 194 | for target in autorecon.scanning_targets: |
| 195 | async with target.lock: |
| 196 | count = len(target.running_tasks) |
| 197 | |
| 198 | tasks_list = [] |
| 199 | if config['verbose'] >= 1: |
| 200 | for tag, task in target.running_tasks.items(): |
| 201 | elapsed_time = calculate_elapsed_time(task['start'], short=True) |
| 202 | |
| 203 | task_str = '{bblue}' + tag + '{rst}' + ' (elapsed: ' + elapsed_time + ')' |
| 204 | |
| 205 | if config['verbose'] >= 2: |
| 206 | processes = [] |
| 207 | for process_dict in task['processes']: |
| 208 | if process_dict['process'].returncode is None: |
| 209 | processes.append(str(process_dict['process'].pid)) |
| 210 | try: |
| 211 | for child in psutil.Process(process_dict['process'].pid).children(recursive=True): |
| 212 | processes.append(str(child.pid)) |
| 213 | except psutil.NoSuchProcess: |
| 214 | pass |
| 215 | |
| 216 | if processes: |
| 217 | task_str += ' (PID' + ('s' if len(processes) > 1 else '') + ': ' + ', '.join(processes) + ')' |
| 218 | |
| 219 | tasks_list.append(task_str) |
| 220 | |
| 221 | tasks_list = ':\n ' + '\n '.join(tasks_list) |
| 222 | else: |
| 223 | tasks_list = '' |
| 224 |
no test coverage detected