TL-BOTS/TL.EXPLOIT_SCAN/EXPLOIT.GoAhead/scrap.beee6f.py

48 lines
1.3 KiB
Python

#!/usr/bin/python
# Python scanner, RCE Exploit CCTV
# Usage: python3 scrap.py 1000
from urllib.request import Request, urlopen
import time, random
# Shodan API
req = Request("https://www.shodan.io/search?query=GoAhead+5ccc069c403ebaf9f0171e9517f40e41", headers={'User-Agent': 'Mozilla/5.0'})
while 1:
try:
webpage = str(urlopen(req).read())
ips = []
while webpage.find("Document Error: Unauthorized") != -1:
webpage = webpage[webpage.find("Document Error: Unauthorized")-40:]
ips.append(webpage[webpage.find("<a href=")+9:webpage.find("\">Document Error")])
webpage = webpage[100:]
check = []
for ip in ips:
check.append(ip.strip("http://").strip("s://"))
reader = open("output.txt", "r")
data = reader.read()
reader.close()
current = data.split("\n")
while "\n" in current != -1:
current.remove("\n")
new = []
for ip in check:
if ip not in current:
new.append(ip)
current.append(ip)
writestring = ""
for ip in current:
writestring += ip + "\n"
writer = open("output.txt", "w")
writer.write(writestring[:len(writestring)-1])
writer.close()
time.sleep(15)
consoleprint = ""
for ip in new:
consoleprint += ip + ", "
if len(new) != 0:
print(str(len(new)) + " new IPs added: " + consoleprint[:len(consoleprint)-2])
except Exception as printouterror:
print(printouterror)