DEV Community

powerexploit
powerexploit

Posted on • Edited on

5

Syn Stealth Scan With Power Of Python & Scapy

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()
view raw robot.py hosted with ❤ by GitHub

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay