-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsend.py
More file actions
executable file
·28 lines (25 loc) · 760 Bytes
/
send.py
File metadata and controls
executable file
·28 lines (25 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
import random
import sys
import socket
from scapy.all import *
from probe import *
def send(iface):
for i in range(10):
pkt = scapy.all.Ether(src=get_if_hwaddr(iface), dst='ff:ff:ff:ff:ff:ff')
pkt = pkt / scapy.all.IP(dst=addr) / \
scapy.all.TCP(dport=1234, sport=random.randint(49152,65535)) / str(i)
# pkt.show2()
sendp(pkt, iface=iface, verbose=False)
time.sleep(0.5)
pass
if __name__ == '__main__':
if len(sys.argv)<2:
print('pass 2 arguments: <destination>')
exit(1)
addr = socket.gethostbyname(sys.argv[1])
iface = get_if()
print("sending on interface {} to {}".format(iface, str(addr)))
send(iface)