-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHidden_Ping_MSG.py
More file actions
executable file
·52 lines (47 loc) · 1.21 KB
/
Copy pathHidden_Ping_MSG.py
File metadata and controls
executable file
·52 lines (47 loc) · 1.21 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
import argparse
import socket
from scapy.all import *
from time import sleep
def Craft_Packet(IP_dest, MSG, Spam):
# Check IP
STR = ''
for i in MSG:
STR += i
STR += " "
try:
socket.inet_aton(IP_dest)
except:
print("IP is not valid")
return
# Craft IP
packet=IP(dst=IP_dest, ttl= 64)/ICMP()/Raw(load=STR)
try:
# If spam mode
if(Spam):
while 1:
reply=send(packet)
else:
reply=send(packet)
except:
# If exception
print("Cannot send packet")
def Hidden_Ping_MSG(args):
# Simple parser
parser = argparse.ArgumentParser(description="Hide MSG in Ping data", usage=("Hidden_Ping -D destination_IP -M Message [-S]"))
parser.add_argument("-D", action="store", dest="IP")
parser.add_argument("-M", action="store", dest="Message", type=str, help="Only extended ASCII characters", nargs='*')
parser.add_argument("-S", action="store_true", dest="Spam", help="Optionnal, Spam mode")
try:
# Split args
options = parser.parse_args(args.split())
IP = options.IP
Spam = options.Spam
Message = options.Message
if not(IP):
# If error using the crafter, print help
print(parser.usage)
else:
# Craft Packet and send it
Craft_Packet(IP, Message, Spam)
except:
print("Error.")