Skip to content

Commit

Permalink
Update launcher.py
Browse files Browse the repository at this point in the history
  • Loading branch information
timwhitez authored Dec 31, 2019
1 parent 9babc6e commit 14dbc66
Showing 1 changed file with 35 additions and 21 deletions.
56 changes: 35 additions & 21 deletions launcher.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#!/usr/bin/python3
# coding: utf-8

import queue
import simplejson
import threading
import subprocess
import requests
import warnings
warnings.filterwarnings(action='ignore')

urls_queue = queue.Queue()
tclose=0

def opt2File(paths):
try:
f = open('crawl_result.txt','a')
Expand All @@ -22,24 +27,31 @@ def opt2File2(subdomains):
f.close()


def request0(req):
proxies = {
'http': 'http://127.0.0.1:7777',
'https': 'http://127.0.0.1:7777',
}
urls0 =req['url']
headers0 =req['headers']
method0=req['method']
data0=req['data']
try:
if(method0=='GET'):
a = requests.get(urls0, headers=headers0, proxies=proxies,timeout=30,verify=False)
opt2File(urls0)
elif(method0=='POST'):
a = requests.post(urls0, headers=headers0,data=data0, proxies=proxies,timeout=30,verify=False)
opt2File(urls0)
except:
return

def request0():
while tclose==0 or urls_queue.empty() == False:
if(urls_queue.qsize()==0):
continue
print(urls_queue.qsize())
req =urls_queue.get()
proxies = {
'http': 'http://127.0.0.1:7777',
'https': 'http://127.0.0.1:7777',
}
urls0 =req['url']
headers0 =req['headers']
method0=req['method']
data0=req['data']
try:
if(method0=='GET'):
a = requests.get(urls0, headers=headers0, proxies=proxies,timeout=30,verify=False)
opt2File(urls0)
elif(method0=='POST'):
a = requests.post(urls0, headers=headers0,data=data0, proxies=proxies,timeout=30,verify=False)
opt2File(urls0)
except:
return
return

def main(data1):
target = data1
Expand All @@ -54,14 +66,16 @@ def main(data1):
for subd in sub_domain:
opt2File2(subd)
for req in req_list:
request0(req)
#opt2File(req['url'])
print("[request ok]")
urls_queue.put(req)
print("[scanning]")



if __name__ == '__main__':
file = open("targets.txt")
t = threading.Thread(target=request0)
t.start()
for text in file.readlines():
data1 = text.strip('\n')
main(data1)
tclose=1

0 comments on commit 14dbc66

Please sign in to comment.