()
| 63 | |
| 64 | |
| 65 | def 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 | |
| 97 | def resultHandler(status, payload): |
no test coverage detected