From e39773f67e0d28e53b6ae3671d8f996be8554273 Mon Sep 17 00:00:00 2001 From: elddy <69467775+elddy@users.noreply.github.com> Date: Wed, 9 Sep 2020 10:33:49 +0300 Subject: [PATCH] Fixed threads reliability 7 seconds with 3 threads on Windows --- NimScan.nim | 1 - modules/scanner.nim | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/NimScan.nim b/NimScan.nim index 213b0a9..356219f 100644 --- a/NimScan.nim +++ b/NimScan.nim @@ -21,7 +21,6 @@ proc main() = host = getHostByName(host).addrList[0] printC(info, "Target IP -> " & host) - if current_mode == mode.all: ## In filtered mode use rawsockets printC(warning, "In rawsockets mode") diff --git a/modules/scanner.nim b/modules/scanner.nim index 9ea95ef..0f0e23f 100644 --- a/modules/scanner.nim +++ b/modules/scanner.nim @@ -59,7 +59,7 @@ proc scan_thread(supSocket: SuperSocket) {.thread.} = #[ Sniffer thread ]# -proc sniffer_thread*(supSocket: SuperSocket) {.thread.} = +proc sniffer_thread(supSocket: SuperSocket) {.thread.} = var host = supSocket.IP port_seq = supSocket.ports @@ -98,8 +98,8 @@ proc startScanner*(host: var string, scan_ports: seq[int]) = if not thr[i].running: let supSocket = SuperSocket(IP: host, ports: ports) createThread(thr[i], scan_thread, supSocket) ## Threads working on windows only + sleep(timeout) break current_ports - sleep(1) thr.joinThreads() echo ""