MCPcopy
hub / github.com/jtesta/ssh-audit / target_worker_thread

Function target_worker_thread

src/ssh_audit/ssh_audit.py:1384–1407  ·  view source on GitHub ↗
(host: str, port: int, shared_aconf: AuditConf)

Source from the content-addressed store, hash-verified

1382
1383# Worker thread for scanning multiple targets concurrently.
1384def target_worker_thread(host: str, port: int, shared_aconf: AuditConf) -> Tuple[int, str]:
1385 ret = -1
1386 string_output = ''
1387
1388 out = OutputBuffer()
1389 out.verbose = shared_aconf.verbose
1390 my_aconf = copy.deepcopy(shared_aconf)
1391 my_aconf.host = host
1392 my_aconf.port = port
1393
1394 # If we're outputting JSON, turn off colors and ensure 'info' level messages go through.
1395 if my_aconf.json:
1396 out.json = True
1397 out.use_colors = False
1398
1399 out.v("Running against: %s:%d..." % (my_aconf.host, my_aconf.port), write_now=True)
1400 try:
1401 ret = audit(out, my_aconf, print_target=True)
1402 string_output = out.get_buffer()
1403 except Exception:
1404 ret = -1
1405 string_output = "An exception occurred while scanning %s:%d:\n%s" % (host, port, str(traceback.format_exc()))
1406
1407 return ret, string_output
1408
1409
1410def builtin_manual(out: OutputBuffer) -> int:

Callers

nothing calls this directly

Calls 4

vMethod · 0.95
get_bufferMethod · 0.95
OutputBufferClass · 0.90
auditFunction · 0.85

Tested by

no test coverage detected