Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- socket = require("socket")
- lanVS,port = "192.168.2.",22
- timeout = 0.2
- loadingBar = true
- loadingBarWidth = 60
- ips = {}
- if loadingBar then
- print("Geschätzte zeit: "..timeout*256 .."s")
- for i=1,loadingBarWidth do
- io.write("_")
- end
- print()
- end
- for i=0,254 do
- tcp = assert(socket.tcp())
- tcp:settimeout(timeout)
- if not loadingBar then
- print(lanVS..i)
- else
- if math.floor(loadingBarWidth/256*(i+1)) ~= math.floor(loadingBarWidth/256*(i+2)) then
- io.write("#")
- end
- end
- if tcp:connect(lanVS..i, port) == 1 then
- if not loadingBar then
- print(lanVS..i.." has open port: "..port)
- end
- table.insert(ips,i)
- end
- tcp:close()
- end
- print("\nRecap:")
- for i=1,#ips do
- print(lanVS..ips[i]..":"..port)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement