-
Notifications
You must be signed in to change notification settings - Fork 383
/
eggshell.py
executable file
·159 lines (139 loc) · 4.64 KB
/
eggshell.py
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/usr/bin/python
from modules import server
from modules import helper as h
import sys, os
#banner
class EggShell:
def __init__(self):
h.generate_keys()
self.server = server.Server()
if len(sys.argv) == 2 and sys.argv[1] == "debug":
self.server.debug = True
else:
self.server.debug = False
self.payloads = self.import_payloads()
self.banner_text = h.GREEN+"""
.---. .-. . . . \\ `.
| ( )| | | o \\ `.
|--- .-.. .-.. `-. |--. .-. | | \\ `.
| ( |( |( )| |(.-' | | o \\ .`
'---'`-`| `-`| `-' ' `-`--'`-`- \\ .`
._.' ._.' `"""+h.COLOR_INFO+"""
.".
/ |
/ /
/ ,"
.-------.--- /
"._ __.-/ o. o\
" ( Y )
) /
/ (
/ I
.-" |
/ _ \ \
/ `. ". ) /' )
Y )( / /(,/
,| / )
( | / /
" \_ (__ (__
"-._,)--._,)
"""+h.WHITE+"\nVersion: 3.1.1\nCreated By Lucas Jackson (@neoneggplant)\n"+h.ENDC
self.main_menu_text = h.WHITE+"-"*40+"\n"+"""Menu:\n
1): Start Server
2): Start MultiHandler
3): Create Payload
4): Exit
""" + "\n"+h.NES
# Actions
def print_payload(self,payload,number_option):
print " " * 4 + str(number_option) + "): " + payload.name
def start_single_server(self):
if not self.server.set_host_port():
return
self.server.start_single_handler()
def start_multi_handler(self):
if not self.server.set_host_port():
return
self.server.start_multi_handler()
def prompt_run_server(self):
if raw_input(h.NES+"Start Server? (Y/n): ") == "n":
return
else:
if raw_input(h.NES+"MultiHandler? (y/N): ") == "y":
self.server.start_multi_handler()
else:
self.server.start_single_handler()
def import_payloads(self):
path = "modules/payloads"
sys.path.append(path)
modules = dict()
for mod in os.listdir(path):
if mod == '__init__.py' or mod[-3:] != '.py':
continue
else:
m = __import__(mod[:-3]).payload()
modules[m.name] = m
return modules
def exit_menu(self):
exit()
def choose_payload(self):
print h.WHITE+"-"*40+h.ENDC
print "Payloads:\n"
number_option = 1
for key in self.payloads:
payload = self.payloads[key]
self.print_payload(payload,number_option)
number_option += 1
print ""
while 1:
try:
# choose payload
option = raw_input(h.info_general_raw("Choose an payload> "))
if not option:
continue
selected_payload = self.payloads[self.payloads.keys()[int(option) - 1]]
# set host and port
self.server.set_host_port()
# generate payload
selected_payload.run(self.server)
#run
self.prompt_run_server()
break
except KeyboardInterrupt:
break
except Exception as e:
print e
break
def menu(self,err=""):
while 1:
try:
h.clear()
if err:
print err
if self.server.debug:
print "Debug On"
sys.stdout.write(self.banner_text)
option = raw_input(self.main_menu_text)
choose = {
"1" : self.start_single_server,
"2" : self.start_multi_handler,
"3" : self.choose_payload,
"4" : self.exit_menu
}
try:
choose[option]()
self.menu()
except KeyError:
if option:
self.menu("Oops: " + option + " is not an option")
else:
self.menu()
except KeyboardInterrupt:
continue
# TODO: quit socket listener
except KeyboardInterrupt:
print "\nBye!"
exit()
if __name__ == "__main__":
eggshell = EggShell()
eggshell.menu()