Advertisement
Nici3000

Untitled

Mar 5th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. socket = require("socket")
  2. lanVS,port = "192.168.2.",22
  3. timeout = 0.2
  4.  
  5. loadingBar = true
  6. loadingBarWidth = 60
  7.  
  8. ips = {}
  9.  
  10. if loadingBar then
  11. print("Geschätzte zeit: "..timeout*256 .."s")
  12. for i=1,loadingBarWidth do
  13. io.write("_")
  14. end
  15. print()
  16. end
  17. for i=0,254 do
  18. tcp = assert(socket.tcp())
  19. tcp:settimeout(timeout)
  20. if not loadingBar then
  21. print(lanVS..i)
  22. else
  23. if math.floor(loadingBarWidth/256*(i+1)) ~= math.floor(loadingBarWidth/256*(i+2)) then
  24. io.write("#")
  25. end
  26. end
  27. if tcp:connect(lanVS..i, port) == 1 then
  28. if not loadingBar then
  29. print(lanVS..i.." has open port: "..port)
  30. end
  31. table.insert(ips,i)
  32. end
  33. tcp:close()
  34. end
  35.  
  36. print("\nRecap:")
  37. for i=1,#ips do
  38. print(lanVS..ips[i]..":"..port)
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement