Issue I'm seeming to have is timeout never occurs upon false connections. the
main point is to grab the ssh version.
import asyncnet, asyncdispatch, strutils, random
var
serVer: string
port = "22"
output = ""
proc genAddr(): string =
randomize()
var
ip0 = rand(1..255)
ip1 = rand(255)
ip2 = rand(255)
ip3 = rand(255)
return (join([$ip0, $ip1, $ip2, $ip3], "."))
proc main() {.async.} =
var
sock0 = newAsyncSocket()
sock1 = newAsyncSocket()
sock2 = newAsyncSocket()
res0: string
res1: string
res2: string
host0 = genAddr()
host1 = genAddr()
host2 = genAddr()
echo "Trying: " & host0
await sock0.connect(host0, Port(22))
echo "Trying: " & host1
await sock1.connect(host1, Port(22))
echo "Trying: " & host2
await sock2.connect(host2, Port(22))
res0 = await sock0.recvLine()
res1 = await sock1.recvLine()
res2 = await sock2.recvLine()
echo res0
echo res1
echo res2
waitFor main()
Run
'''