Skip to content

Instantly share code, notes, and snippets.

@ziot
Created August 10, 2016 00:22
Show Gist options
  • Select an option

  • Save ziot/bf9cf0213adfcd16ecedd596bdefb06d to your computer and use it in GitHub Desktop.

Select an option

Save ziot/bf9cf0213adfcd16ecedd596bdefb06d to your computer and use it in GitHub Desktop.
import ConfigParser, json, os, subprocess, re, time, sys, socket, ssl, requests, logging, threading
from requests.packages.urllib3.exceptions import InsecureRequestWarning, InsecurePlatformWarning, SNIMissingWarning
from multiprocessing import Pool
from netaddr import *
from socket import socket
from OpenSSL import SSL
import hashlib
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
requests.packages.urllib3.disable_warnings(InsecurePlatformWarning)
requests.packages.urllib3.disable_warnings(SNIMissingWarning)
def all_perms(elements):
if len(elements) <=1:
yield elements
else:
for perm in all_perms(elements[1:]):
for i in range(len(elements)):
yield perm[:i] + elements[0:1] + perm[i:]
def getTargets():
targets = []
list = [
"Chameleon",
"Execution",
"Two",
"Dust",
"Mute",
"Miniature",
"Steel",
"Static",
]
perms = all_perms(list)
for perm in perms:
targets.append("".join(perm))
return targets
def md5(str):
return hashlib.md5(str).hexdigest()
def checkFor1057(folder):
folder = folder.title()
host = 'http://{}/{}'.format("lostboy.net",folder)
# print 'checking {}'.format(folder)
try:
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0',
}
r = requests.get(host, timeout=0.5, verify=False, allow_redirects=True, headers=headers)
if md5(r.text) not in ['73d8d51028a468a56d7f10125c346b76']:
print 'page discovered: {}'.format(folder)
except:
return
def lostScan(processes):
lastIncomplete = 0
print 'using {} processes'.format(processes)
pool = Pool(processes)
print 'loading targets'
target = getTargets()
job_count = 0
startTimer = time.time()
debugDelay = 60
debugMsgTimer = 0
for job in pool.imap_unordered(checkFor1057, target):
# timer garbage
if debugMsgTimer == 0:
debugMsgTimer = time.time()
currentTimer = time.time()
elapsedDebugTimer = currentTimer-debugMsgTimer
elapsedtimer = currentTimer-startTimer
job_count += 1
incomplete = len(target) - job_count
if elapsedDebugTimer>debugDelay:
print "[Main] {} IPs scanned. IPs remaining in pool: {} of {} [Time elapsed: {} seconds] " .format((len(target)-incomplete), incomplete, len(target), int(elapsedtimer))
if lastIncomplete>0:
print "[Main] {} IPs finished in last {} seconds".format((lastIncomplete-incomplete), int(elapsedDebugTimer))
print "[Main] Estimated time left: {} hours".format(((incomplete/(lastIncomplete-incomplete))/60))
debugMsgTimer = 0
lastIncomplete = incomplete
if incomplete<1000:
pool.terminate()
return
pool.close()
processes = 25
if __name__ == '__main__':
lostScan(processes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment