Created
October 19, 2019 15:09
-
-
Save powerexploit/54b9739fa59506d808283f194f5f8342 to your computer and use it in GitHub Desktop.
Stealth Syn Scanner to check open ports
This file contains 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/python | |
#Robot.py | |
from scapy.all import * | |
from pyfiglet import Figlet | |
logo = Figlet(font='graffiti') | |
print(logo.renderText('%R%\nfs0c131y..%')) | |
ip = input("Enter the ip address or url:\n") | |
port = int(input("Enter the port number:\n")) | |
def checkhost(): | |
ping = IP(dst=ip)/ICMP() | |
res = sr1(ping,timeout=1,verbose=0) | |
if res == None: | |
print("This host is down") | |
else: | |
print("This host is up") | |
#function to check open port | |
def checkport(): | |
tcpRequest = IP(dst=ip)/TCP(dport=port,flags="S") | |
tcpResponse = sr1(tcpRequest,timeout=1,verbose=0) | |
try: | |
if tcpResponse.getlayer(TCP).flags == "SA": | |
print(port,"is listening") | |
except AttributeError: | |
print(port,"is not listening") | |
checkhost() | |
checkport() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment