forked from ring04h/wydomain
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new version publish
- Loading branch information
ring04h
committed
Nov 1, 2016
1 parent
0de2f7e
commit f2cdf2c
Showing
242 changed files
with
7,628 additions
and
104,826 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# encoding: utf-8 | ||
|
||
import json | ||
import requests | ||
|
||
class Captcha(object): | ||
"""docstring for Captcha""" | ||
def __init__(self): | ||
super(Captcha, self).__init__() | ||
self.url = 'http://api.ysdm.net/create.json' | ||
self.username = 'a61323636' | ||
self.password = '123456' | ||
self.timeout = 90 | ||
self.softid = 1 | ||
self.softkey = 'b40ffbee5c1cf4e38028c197eb2fc751' | ||
self.typeid = 3000 | ||
|
||
def verification(self, filename): | ||
(cnt,retry) = (0, 3) | ||
while True: | ||
try: | ||
if cnt >= retry: | ||
break # over max_retry_cnt | ||
payload = { | ||
'username': self.username, | ||
'password': self.password, | ||
'timeout': self.timeout, | ||
'softid': self.softid, | ||
'softkey': self.softkey, | ||
'typeid': self.typeid, | ||
} | ||
multiple_files = [('image', ('captcha.gif', open(filename, 'rb'), 'image/gif')),] | ||
r = requests.post(self.url, data=payload, files=multiple_files) | ||
return json.loads(r.text) | ||
except Exception, e: | ||
cnt += 1 | ||
print('{0} [INFO] {1}'.format( | ||
time.strftime('%Y-%m-%d %H:%M:%S'), str(e))) | ||
else: | ||
cnt = 0 | ||
|
||
# captcha = Captcha() | ||
# imgurl = 'http://ce.wooyun.org/captcha.php' | ||
# print captcha.verification(imgurl) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# encoding: utf-8 | ||
|
||
import re | ||
from config import * | ||
|
||
import json | ||
import subprocess | ||
|
||
import logging | ||
|
||
import requests as requests | ||
import requests as __requests__ | ||
from tldextract import extract, TLDExtract | ||
from utils.fileutils import FileUtils | ||
|
||
import requests.packages.urllib3 | ||
requests.packages.urllib3.disable_warnings() | ||
|
||
if allow_http_session: | ||
requests = requests.Session() | ||
|
||
def is_domain(domain): | ||
domain_regex = re.compile( | ||
r'(?:[A-Z0-9_](?:[A-Z0-9-_]{0,247}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,}(?<!-))\Z', | ||
re.IGNORECASE) | ||
return True if domain_regex.match(domain) else False | ||
|
||
def http_request_get(url, body_content_workflow=False, allow_redirects=allow_redirects, custom_cookie=""): | ||
try: | ||
if custom_cookie: | ||
headers['Cookie']=custom_cookie | ||
result = requests.get(url, | ||
stream=body_content_workflow, | ||
headers=headers, | ||
timeout=timeout, | ||
proxies=proxies, | ||
allow_redirects=allow_redirects, | ||
verify=allow_ssl_verify) | ||
return result | ||
except Exception, e: | ||
# return empty requests object | ||
return __requests__.models.Response() | ||
|
||
def http_request_post(url, payload, body_content_workflow=False, allow_redirects=allow_redirects, custom_cookie=""): | ||
""" payload = {'key1': 'value1', 'key2': 'value2'} """ | ||
try: | ||
if custom_cookie: | ||
headers['Cookie']=custom_cookie | ||
result = requests.post(url, | ||
data=payload, | ||
headers=headers, | ||
stream=body_content_workflow, | ||
timeout=timeout, | ||
proxies=proxies, | ||
allow_redirects=allow_redirects, | ||
verify=allow_ssl_verify) | ||
return result | ||
except Exception, e: | ||
# return empty requests object | ||
return __requests__.models.Response() | ||
|
||
def curl_get_content(url): | ||
try: | ||
cmdline = 'curl "{url}"'.format(url=url) | ||
logging.info("subprocess call curl: {}".format(url)) | ||
run_proc = subprocess.Popen( | ||
cmdline, | ||
shell=True, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE) | ||
(stdoutput,erroutput) = run_proc.communicate() | ||
response = { | ||
'resp': stdoutput.rstrip(), | ||
'err': erroutput.rstrip(), | ||
} | ||
return response | ||
except Exception as e: | ||
pass | ||
|
||
def save_result(filename, args): | ||
if FileUtils.exists(filename): | ||
try: | ||
fd = open(filename, 'w') | ||
json.dump(args, fd, indent=4) | ||
finally: | ||
fd.close() | ||
|
||
def read_json(filename): | ||
if FileUtils.exists(filename): | ||
try: | ||
fd = open(filename, 'r') | ||
args = json.load(fd) | ||
return args | ||
finally: | ||
fd.close() | ||
else: | ||
return [] | ||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.