This blog post is a memo of python code snippets that I found particularly useful and good in the field of scanning and hacking.From a week I am working on one of the best module 'Scapy'.Then today I finally created a script which can execute syn stealth scan.
Execute the Scapy Code For $Syn Stealth Sc@n:
#!/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() |
Top comments (0)