Created
October 9, 2019 17:19
-
-
Save powerexploit/158606d8c60827abbeca86880d2e020c to your computer and use it in GitHub Desktop.
pingscanner using python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
#pingscanner.py | |
import sys | |
from scapy.all import * | |
ip = sys.argv[1] # command line argument | |
icmp = IP(dst=ip)/ICMP() | |
#icmp = IP(dst=ip)/TCP() | |
#IP defines the protocol for IP addresses | |
#dst is the destination IP address | |
#TCP defines the protocol for the ports | |
resp = sr1(icmp,timeout=10) | |
if resp == None: | |
print("This host is down") | |
else: | |
print("This host is up") | |
Hello, Ankit! Good positng, thank you. Btw, it's more general to write
resp is None
becauseNone
is a singleton. Also explicit imports are more preferred (in PEP-8) likefrom scapy.all import IP, ICMP, sr1
hey @rudyryk sorry for late reply but its same as
from scapy.all import * but i appreciate your response! I will be aware in next time
Hello! Why do I get this error on running?
PermissionError: [Errno 1] Operation not permitted
How do I resolve it?
Hello! Why do I get this error on running?
PermissionError: [Errno 1] Operation not permittedHow do I resolve it?
run script as root.
if you are using Ubuntu run it as :
sudo python3 pingscanner.py 192.168.x.x.
How to run this script without root/sudo permission?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, Ankit! Good positng, thank you. Btw, it's more general to write
resp is None
becauseNone
is a singleton. Also explicit imports are more preferred (in PEP-8) likefrom scapy.all import IP, ICMP, sr1