mirror of
https://github.com/autistic-symposium/sec-pentesting-toolkit.git
synced 2025-05-02 23:05:11 -04:00
scapy scripts (including ddos)
This commit is contained in:
parent
2acc68c3dd
commit
8ca96e0b02
28 changed files with 172723 additions and 125 deletions
24
Network_and_802.11/scapy/tcp_handshake.py
Executable file → Normal file
24
Network_and_802.11/scapy/tcp_handshake.py
Executable file → Normal file
|
@ -4,26 +4,14 @@ __author__ = "bt3"
|
|||
|
||||
from scapy.all import *
|
||||
|
||||
# Set port & MAC address
|
||||
FAKE_IP = "10.0.4.4" # Use something that nobody else is going to have
|
||||
MAC_ADDR = "60:67:20:eb:7b:bc" # My actual MAC address
|
||||
|
||||
# Broadcast our fake IP address
|
||||
srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(psrc=FAKE_IP, hwsrc=MAC_ADDR))
|
||||
|
||||
source_port += 1
|
||||
ip_header = IP(dst=dest, src=FAKE_IP) # Set the source port to
|
||||
ans = sr1(ip_header / TCP(dport=80, sport=source_port, flags="S", seq=random.randint(0, 1000))) # SYN
|
||||
# ans is the SYN-ACK
|
||||
reply = ip_header / TCP(dport=80, sport=source_port, seq=ans.ack, ack = ans.seq + 1, flags="A") # ACK
|
||||
send(reply) # Send ACK
|
||||
pkt = ip_header / TCP(dport=80, sport=source_port, seq=reply.seq, flags="AP") / "GET / HTTP/1.1\r\n\r\n" # Send our real packet
|
||||
send(pkt)
|
||||
|
||||
|
||||
ip = IP(src='192.168.1.114', dst='192.168.1.25')
|
||||
SYN = TCP(sport=1024, dport=80, flags='S', seq=12345)
|
||||
packet = ip/SYN
|
||||
|
||||
SYNACK = sr1(packet)
|
||||
ack = SYNACK.seq + 1
|
||||
ack = SYNACK.seq + 1
|
||||
ACK = TCP(sport=1024, dport=80, flags='A', seq=12346, ack=ack)
|
||||
send(ip/ACK)
|
||||
PUSH = TCP(sport=1024, dport=80, flags='', seq=12346, ack=ack)
|
||||
data = "HELLO!"
|
||||
send(ip/PUSH/data)
|
Loading…
Add table
Add a link
Reference in a new issue