本文整理汇总了Python中classes.Registry.Registry类的典型用法代码示例。如果您正苦于以下问题:Python Registry类的具体用法?Python Registry怎么用?Python Registry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Registry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_backups
def check_backups(self):
""" Simple check backups """
Http = Registry().get('http')
check = []
result = []
dirs = file_to_list(Registry().get('wr_path') + "/bases/pre-backups-dirs.txt")
dirs.append(self.options['host'].value)
files = file_to_list(Registry().get('wr_path') + "/bases/pre-backups-files.txt")
dirs_exts = file_to_list(Registry().get('wr_path') + "/bases/bf-dirs.txt")
files_exts = file_to_list(Registry().get('wr_path') + "/bases/bf-files.txt")
for _dir in dirs:
for dir_ext in dirs_exts:
check.append(dir_ext.replace('|name|', _dir))
for _file in files:
for file_ext in files_exts:
check.append(file_ext.replace('|name|', _file))
for url in check:
r = Http.get(self.root_url + url)
if not self._response_404(r):
result.append({'url': self.root_url + url, 'code': r.status_code})
return result
示例2: __init__
def __init__(self, queue, domain, protocol, method, not_found_re, not_found_codes,
not_found_size, delay, counter, result):
super(BackupsFinderThread, self).__init__()
self.queue = queue
self.domain = domain
self.result = result
self.counter = counter
self.protocol = protocol
self.not_found_re = False if not len(not_found_re) else re.compile(not_found_re)
self.not_found_size = int(not_found_size)
self.method = method.lower()
self.method = method if \
not ((len(not_found_re) or self.not_found_size != -1) and method.lower() == 'head') else \
'get'
not_found_codes = not_found_codes.split(',')
not_found_codes.append('404')
self.not_found_codes = list(set(not_found_codes))
self.delay = int(delay)
self.done = False
self.http = Registry().get('http')
self.logger = Registry().get('logger')
示例3: __init__
def __init__(self):
self.tags = {}
tags = Registry().get('config')['spider']['tags']
tags = tags.split(",")
for tag in tags:
tag = tag.split("|")
self.tags[tag[0]] = tag[1]
示例4: get_denied_schemas
def get_denied_schemas():
""" Get list of denied schemas """
if SpiderCommon.denied_schemas is None:
denied_schemas = Registry().get('config')['spider']['denied_schemes'].split(',')
for dschema in denied_schemas:
index = denied_schemas.index(dschema)
denied_schemas[index] = dschema.encode('utf8')
SpiderCommon.denied_schemas = list(map(str.strip, denied_schemas))
return SpiderCommon.denied_schemas
示例5: prepare_first_pages
def prepare_first_pages(host):
""" Prepare link on first page in MongoDB. Add root url if urls for this host not exists. """
pid = Registry().get('pData')['id']
coll = Registry().get('mongo').spider_urls
coll.drop()
Urls = UrlsModel()
urls = Urls.list_by_host_name_for_spider(pid, host)
if not len(urls):
Registry().get('logger').log("Spider: Root URL was added automaticaly")
Urls.add(
pid, HostsModel().get_id_by_name(pid, host), '/', who_add='spider'
)
urls = Urls.list_by_host_name_for_spider(pid, host)
for url in urls:
url = urlparse(url['url'])
data = {
'hash': md5(str(url.path + url.query)),
'path': url.path,
'query': url.query,
'time': 0,
'code':0,
'checked': 0,
'getted' : 0,
'referer': '',
'size': 0,
'founder': 'spider'
}
coll.insert(data)
coll.create_index([('hash', 1)], unique=True, dropDups=True)
coll.create_index([('checked', 1)])
示例6: check_dafs
def check_dafs(self, _type):
""" Simple dafs search """
Http = Registry().get('http')
result = []
_dict = open(Registry().get('wr_path') + '/bases/pre-dafs-{0}.txt'.format(_type), 'r').read().split("\n")
for obj in _dict:
r = Http.get(self.root_url + obj)
if r is not None and not self._response_404(r):
result.append({'url': "/" + obj, 'code': r.status_code, 'time': 0})
return result
示例7: _get_codes_stat
def _get_codes_stat(self):
""" Build dict with http-codes and their counts """
coll = Registry().get('mongo').spider_urls
result = {}
codes = coll.group({'code': True}, '', {}, 'function () {}')
for code in codes:
links = []
code = code['code']
data = coll.find({'code': code}, {'path': 1, 'query': 1})
for link in mongo_result_to_list(data):
links.append(link['path'] + '?' + link['query'] if link['query'] else link['path'])
result[int(code)] = links
return result
示例8: __init__
def __init__(
self, queue, protocol, host, template, mask_symbol,
false_phrase, retest_codes, delay, ignore_words_re, counter, result):
threading.Thread.__init__(self)
self.retested_words = {}
self.queue = queue
self.protocol = protocol.lower()
self.host = host
self.template = template
self.mask_symbol = mask_symbol
self.counter = counter
self.result = result
self.done = False
self.false_phrase = false_phrase
self.retest_codes = list(set(retest_codes.split(','))) if len(retest_codes) else []
self.delay = int(delay)
self.retest_delay = int(Registry().get('config')['hosts_brute']['retest_delay'])
self.http = copy.deepcopy(Registry().get('http'))
self.logger = Registry().get('logger')
self.method = 'get'
self.ignore_words_re = False if not len(ignore_words_re) else re.compile(ignore_words_re)
self.retest_limit = int(Registry().get('config')['hosts_brute']['retest_limit'])
示例9: __init__
def __init__(
self, queue, protocol, host, template, method, mask_symbol, not_found_re,
not_found_size, not_found_codes, retest_codes, delay, ignore_words_re,
counter, result):
threading.Thread.__init__(self)
self.retested_words = {}
self.queue = queue
self.protocol = protocol.lower()
self.host = host
self.template = template
self.mask_symbol = mask_symbol
self.counter = counter
self.result = result
self.done = False
self.ignore_words_re = False if not len(ignore_words_re) else re.compile(ignore_words_re)
self.not_found_re = False if not len(not_found_re) else re.compile(not_found_re)
self.not_found_size = int(not_found_size)
self.method = method
if method == 'head' and (len(not_found_re) or self.not_found_size != -1):
self.method = 'get'
not_found_codes = not_found_codes.split(',')
not_found_codes.append('404')
self.not_found_codes = list(set(not_found_codes))
self.retest_codes = list(set(retest_codes.split(','))) if len(retest_codes) else []
self.delay = int(delay)
self.retest_delay = int(Registry().get('config')['dafs']['retest_delay'])
self.http = copy.deepcopy(Registry().get('http'))
self.logger = Registry().get('logger')
self.retest_limit = int(Registry().get('config')['dafs']['retest_limit'])
示例10: __init__
def __init__(
self, queue, protocol, host, url, max_params_length, value, method, mask_symbol, not_found_re,
not_found_size, not_found_codes, retest_codes, delay, ignore_words_re,
counter, result):
super(ParamsBruterThread, self).__init__()
self.retested_words = {}
self.queue = queue
self.protocol = protocol.lower()
self.host = host
self.url = url
self.mask_symbol = mask_symbol
self.counter = counter
self.result = result
self.value = value
self.done = False
self.max_params_length = int(max_params_length)
self.ignore_words_re = False if not len(ignore_words_re) else re.compile(ignore_words_re)
self.not_found_re = False if not len(not_found_re) else re.compile(not_found_re)
self.not_found_size = int(not_found_size)
self.method = method.lower()
not_found_codes = not_found_codes.split(',')
not_found_codes.append('404')
self.not_found_codes = list(set(not_found_codes))
self.retest_codes = list(set(retest_codes.split(','))) if len(retest_codes) else []
self.delay = int(delay)
self.retest_delay = int(Registry().get('config')['params_bruter']['retest_delay'])
self.http = copy.deepcopy(Registry().get('http'))
self.logger = Registry().get('logger')
self.retest_limit = int(Registry().get('config')['dafs']['retest_limit'])
示例11: __init__
def __init__(
self, queue, protocol, host, url, false_phrase, true_phrase, retest_codes, delay,
confstr, first_stop, login, pass_min_len, pass_max_len, pass_found, counter, result
):
threading.Thread.__init__(self)
self.retested_words = {}
self.queue = queue
self.protocol = protocol.lower()
self.host = host
self.url = url
self.false_phrase = false_phrase
self.true_phrase = true_phrase
self.delay = int(delay)
self.confstr = confstr
self.first_stop = first_stop
self.login = login
self.counter = counter
self.result = result
self.retest_codes = list(set(retest_codes.split(','))) if len(retest_codes) else []
self.pass_found = pass_found
self.done = False
self.logger = Registry().get('logger')
self.http = copy.deepcopy(Registry().get('http'))
self.http.every_request_new_session = True
self.pass_min_len = int(pass_min_len)
self.pass_max_len = int(pass_max_len)
self.retest_delay = int(Registry().get('config')['form_bruter']['retest_delay'])
self.retest_limit = int(Registry().get('config')['form_bruter']['retest_limit'])
示例12: __init__
def __init__(
self, queue, protocol, host, url, method, mask_symbol, not_found_re,
not_found_codes, retest_codes, delay, counter, result):
threading.Thread.__init__(self)
self.retested_words = {}
self.queue = queue
self.protocol = protocol.lower()
self.host = host
self.method = method if not (len(not_found_re) and method.lower() == 'head') else 'get'
self.url = url
self.mask_symbol = mask_symbol
self.counter = counter
self.result = result
self.done = False
self.not_found_re = False if not len(not_found_re) else re.compile(not_found_re)
not_found_codes = not_found_codes.split(',')
not_found_codes.append('404')
self.not_found_codes = list(set(not_found_codes))
self.retest_codes = list(set(retest_codes.split(','))) if len(retest_codes) else []
self.delay = int(delay)
self.http = copy.deepcopy(Registry().get('http'))
self.logger = Registry().get('logger')
示例13: __init__
def __init__(
self, queue, protocol, host, template, method, mask_symbol, not_found_re,
delay, ddos_phrase, ddos_human, recreate_re, ignore_words_re, counter, result
):
super(SDafsThread, self).__init__()
self.queue = queue
self.protocol = protocol.lower()
self.host = host
self.method = method if not (len(not_found_re) and method.lower() == 'head') else 'get'
self.template = template
self.mask_symbol = mask_symbol
self.counter = counter
self.result = result
self.done = False
self.not_found_re = False if not len(not_found_re) else re.compile(not_found_re)
self.recreate_re = False if not len(recreate_re) else re.compile(recreate_re)
self.http = Registry().get('http')
self.delay = int(delay)
self.ddos_phrase = ddos_phrase
self.ddos_human = ddos_human
self.ignore_words_re = False if not len(ignore_words_re) else re.compile(ignore_words_re)
Registry().set('url_for_proxy_check', "{0}://{1}".format(protocol, host))
self.browser_create()
self.logger = Registry().get('logger')
示例14: __init__
def __init__(
self, queue, protocol, host, url, false_phrase, true_phrase, delay, ddos_phrase, ddos_human, recreate_phrase,
conffile, first_stop, login, #reload_form_page,
pass_found, counter, result
):
super(SFormBruterThread, self).__init__()
self.retested_words = {}
self.queue = queue
self.protocol = protocol.lower()
self.host = host
self.url = url
self.delay = int(delay)
self.ddos_phrase = ddos_phrase
self.ddos_human = ddos_human
self.recreate_phrase = recreate_phrase
self.conffile = conffile
self.false_phrase = false_phrase
self.true_phrase = true_phrase
self.first_stop = first_stop
self.login = login
self.pass_found = pass_found
self.logger = Registry().get('logger')
#self.reload_form_page = int(reload_form_page)
self.browser_create()
self.counter = counter
self.result = result
self.done = False
Registry().set('url_for_proxy_check', "{0}://{1}".format(protocol, host))
示例15: __init__
def __init__(self, queue, domain, url, protocol, method, not_found_re, not_found_codes, delay, counter, result):
threading.Thread.__init__(self)
self.queue = queue
self.method = method if not (len(not_found_re) and method.lower() == 'head') else 'get'
self.domain = domain
self.url = url
self.result = result
self.counter = counter
self.protocol = protocol
self.not_found_re = False if not len(not_found_re) else re.compile(not_found_re)
not_found_codes = not_found_codes.split(',')
not_found_codes.append('404')
self.not_found_codes = list(set(not_found_codes))
self.delay = int(delay)
self.done = False
self.http = Registry().get('http')
self.logger = Registry().get('logger')