Skip to content

Commit

Permalink
Fixed threads reliability
Browse files Browse the repository at this point in the history
7 seconds with 3 threads on Windows
  • Loading branch information
elddy committed Sep 9, 2020
1 parent 083a5da commit e39773f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion NimScan.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions modules/scanner.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ""
Expand Down

0 comments on commit e39773f

Please sign in to comment.