-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathudp-msg-sender.py
More file actions
56 lines (45 loc) · 1.53 KB
/
udp-msg-sender.py
File metadata and controls
56 lines (45 loc) · 1.53 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python3
#Created by PepeBigotes
import os, ctypes
try: is_admin = (os.getuid() == 0)
except AttributeError: is_admin = (ctypes.windll.shell32.IsUserAnAdmin() != 0)
if not is_admin:
print("[!] You need root/admin priviledges to run this script")
print(" Forgot to use sudo?")
exit()
try: from scapy.all import *
except ImportError:
print("[!] You need to have Scapy installed to run this script")
print(" Try 'pip3 install scapy' or 'sudo apt install python3-scapy'")
exit()
os.system('cls' if os.name=='nt' else 'clear')
print("""\
_ _
_ _ _| |___ _____ ___ ___ ___ ___ ___ _| |___ ___
| | | . | . | | |_ -| . | |_ -| -_| | . | -_| _|
|___|___| _| |_|_|_|___|_ | |___|___|_|_|___|___|_|
|_| |___|
KEEP IN MIND THAT YOUR MESSAGES ARE NOT ENCRYPTED!
""")
try:
LOCAL_IP = get_if_addr(conf.iface)
print(f"Host: {LOCAL_IP}")
PORT = int(input("Port: "))
DEST_IP = input("Dest IP: ")
except KeyboardInterrupt:
print("\nKeyboardInterrupt")
exit()
def send_msg(dst, msg):
pkt = IP(dst=dst) /\
UDP(sport=PORT ,dport=PORT) /\
msg
send(pkt, verbose=0)
#print(bytes(pkt[UDP].payload).decode("utf-8"))
print("\nWrite your message and press ENTER to send it. Press CTRL+C to exit script")
try:
while True:
msg = str(input(" > "))
send_msg(DEST_IP, msg)
except KeyboardInterrupt:
print("\nKeyboardInterrupt")
exit()