Guest User

Untitled

a guest
Feb 24th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. import os
  2.  
  3. os.system('clear')
  4. ip = int(input('IP INICIAL (192.168.0.1); '))
  5. print ('Testing...')
  6. for i in 100:
  7. rs = os.system('ping -c1', ip, +i)
  8. if rs == 0:
  9. print ('O', ip, 'ta on')
  10.  
  11. ip = input('IP INICIAL (192.168.0.1); ').split('.')
  12.  
  13. >>> ip = input('IP INICIAL (192.168.0.1); ').split('.')
  14. IP INICIAL (192.168.0.1); 192.168.1.1
  15. >>> ip
  16. ['192', '168', '1', '1']
  17.  
  18. ip = list(map(int, input('IP INICIAL (192.168.0.1); ').split('.')))
  19.  
  20. >>> ip = list(map(int, input('IP INICIAL (192.168.0.1); ').split('.')))
  21. IP INICIAL (192.168.0.1); 192.168.1.1
  22. >>> ip
  23. [192, 168, 1, 1]
  24.  
  25. import os
  26.  
  27. os.system('clear')
  28. ips = list(map(int, input('IP INICIAL (192.168.0.1); ').split('.')))
  29. print ('Testing...')
  30. for i in range(1,101): # faltou range aqui
  31. ip[3] = i # mudar a ultima parte do ip para o numero em questão
  32. ip_formatado = '.'.join([str(n) for n in ip]) # criar o texto que representa o ip
  33. rs = os.system('ping -c 1 {}'.format(ip_formatado)) # executar o comando
  34. if rs == 0:
  35. print ('O ', ip_formatado, ' ta on')
Add Comment
Please, Sign In to add comment