Jan-26-2021, 12:23 PM
im tying to get my local ip then generate a range list then ping each one of them to check who is live and who is dead
this is my code :
this is my code :
import socket
import ipaddress
import os
import nmap
getmy_ip = socket.gethostname()
getmy_ip = socket.gethostbyname(getmy_ip)
net4 = ipaddress.ip_network("192.168.1.0/24")
for x in net4.hosts():
ping = os.popen("ping {x}").read()
#scan1 = nmap.PortScanner()
#scan1 = scan1.scan(str(x))
#print(scan1)
Output:ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not known
ping: {x}: Name or service not knownwhy and how i can solve it in simple why please :(
