MCPcopy
hub / github.com/Xyntax/POC-T / run

Function run

lib/controller/engine.py:65–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63
64
65def run():
66 initEngine()
67 if conf.ENGINE is ENGINE_MODE_STATUS.THREAD:
68 for i in range(th.threads_num):
69 t = threading.Thread(target=scan, name=str(i))
70 setThreadDaemon(t)
71 t.start()
72 # It can quit with Ctrl-C
73 while 1:
74 if th.thread_count > 0 and th.is_continue:
75 time.sleep(0.01)
76 else:
77 break
78
79 elif conf.ENGINE is ENGINE_MODE_STATUS.GEVENT:
80 from gevent import monkey
81 monkey.patch_all()
82 import gevent
83 while th.queue.qsize() > 0 and th.is_continue:
84 gevent.joinall([gevent.spawn(scan) for i in xrange(0, th.threads_num) if
85 th.queue.qsize() > 0])
86
87 dataToStdout('\n')
88
89 if 'errmsg' in th:
90 logger.error(th.errmsg)
91
92 if th.found_single:
93 msg = "[single-mode] found!"
94 logger.info(msg)
95
96
97def resultHandler(status, payload):

Callers 1

mainFunction · 0.90

Calls 5

dataToStdoutFunction · 0.90
initEngineFunction · 0.85
setThreadDaemonFunction · 0.85
errorMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected