-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
957 additions
and
869 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,108 @@ | ||
# 默认参数相关 | ||
GB_BASE_DIR = "GB_BASE_DIR" | ||
GB_RUN_TIME = "GB_RUN_TIME" | ||
GB_VERSION = "GB_VERSION" | ||
GB_DEBUG_FLAG = "GB_DEBUG_FLAG" | ||
|
||
# 日志路径相关 | ||
GB_LOG_INFO_FILE = "GB_LOG_INFO_FILE" | ||
GB_LOG_DEBUG_FILE = "GB_LOG_DEBUG_FILE" | ||
GB_LOG_ERROR_FILE = "GB_LOG_ERROR_FILE" | ||
|
||
GB_ACCESS_OK_FILE = "GB_ACCESS_OK_FILE" | ||
GB_ACCESS_NO_FILE = "GB_ACCESS_NO_FILE" | ||
|
||
GB_HISTORY_FORMAT = "GB_HISTORY_FORMAT" | ||
GB_HISTORY_EXCLUDE = "GB_HISTORY_EXCLUDE" | ||
|
||
GB_RESULT_DIR = "GB_RESULT_DIR" | ||
|
||
# 输入参数相关 | ||
GB_TARGET = "GB_TARGET" | ||
|
||
GB_MAX_URL_NUM = "GB_MAX_URL_NUM" | ||
GB_MAX_ERROR_NUM = "GB_MAX_ERROR_NUM" | ||
|
||
# HTTP请求相关 | ||
|
||
GB_DEFAULT_PROTO = "GB_DEFAULT_PROTO" | ||
|
||
GB_PROXIES = "GB_PROXIES" | ||
GB_THREADS_COUNT = "GB_THREADS_COUNT" | ||
GB_TASK_CHUNK_SIZE = "GB_TASK_CHUNK_SIZE" | ||
|
||
GB_REQ_METHOD = "GB_REQ_METHOD" | ||
GB_REQ_BODY = "GB_REQ_BODY" | ||
|
||
|
||
GB_REQ_HEADERS = "GB_REQ_HEADERS" | ||
GB_RANDOM_REQ_UA = "GB_RANDOM_REQ_UA" | ||
GB_RANDOM_REQ_XFF = "GB_RANDOM_REQ_XFF" | ||
GB_DYNA_REQ_HOST = "GB_DYNA_REQ_HOST" | ||
GB_DYNA_REQ_REFER = "GB_DYNA_REQ_REFER" | ||
|
||
GB_STREAM_MODE = "GB_STREAM_MODE" | ||
GB_URL_ACCESS_TEST = "GB_URL_ACCESS_TEST" | ||
|
||
GB_SPLIT_TARGET_PATH = "GB_SPLIT_TARGET_PATH" | ||
GB_EXCLUDE_STATUS = "GB_EXCLUDE_STATUS" | ||
GB_EXCLUDE_REGEXP = "GB_EXCLUDE_REGEXP" | ||
|
||
GB_THREAD_SLEEP = "GB_THREAD_SLEEP" | ||
GB_SSL_VERIFY = "GB_SSL_VERIFY" | ||
GB_ALLOW_REDIRECTS = "GB_ALLOW_REDIRECTS" | ||
|
||
# 扫描字典相关 | ||
GB_DICT_RULE_SCAN = "GB_DICT_RULE_SCAN" | ||
GB_DICT_RULE_PATH = "GB_DICT_RULE_PATH" | ||
GB_FREQUENCY_MIN = "GB_FREQUENCY_MIN" | ||
GB_FREQUENCY_SYMBOL = "GB_FREQUENCY_SYMBOL" | ||
|
||
GB_DICT_SUFFIX = "GB_DICT_SUFFIX" | ||
GB_ONLY_SCAN_SPECIFY_EXT = "GB_ONLY_SCAN_SPECIFY_EXT" | ||
GB_NO_SCAN_SPECIFY_EXT = "GB_NO_SCAN_SPECIFY_EXT" | ||
GB_CUSTOM_URL_PREFIX = "GB_CUSTOM_URL_PREFIX" | ||
GB_REMOVE_END_SYMBOLS = "GB_REMOVE_END_SYMBOLS" | ||
|
||
GB_TIMEOUT = "GB_TIMEOUT" | ||
GB_RETRY_TIMES = "GB_RETRY_TIMES" | ||
|
||
# 其他常量 | ||
STR_BASE_PATH = "base_path" | ||
STR_BASE_ROOT = "base_root" | ||
|
||
|
||
|
||
# 未整理常量 | ||
GB_BASE_VAR_DIR = "GB_BASE_VAR_DIR" | ||
GB_BASE_REPLACE_DICT = "GB_BASE_REPLACE_DICT" | ||
GB_DEPENDENT_REPLACE_DICT = "GB_DEPENDENT_REPLACE_DICT" | ||
|
||
GB_ANNOTATION_SYMBOL = "GB_ANNOTATION_SYMBOL" | ||
|
||
GB_BASE_PATH_STR = "GB_BASE_PATH_STR" | ||
GB_BASE_ROOT_STR = "GB_BASE_ROOT_STR" | ||
GB_SCAN_BASE_PATH = "GB_SCAN_BASE_PATH" | ||
GB_SCAN_BASE_ROOT = "GB_SCAN_BASE_ROOT" | ||
GB_ANNOTATION_SYMBOL = "GB_ANNOTATION_SYMBOL" | ||
|
||
GB_SYMBOL_REPLACE_DICT = "GB_SYMBOL_REPLACE_DICT" | ||
GB_NOT_ALLOW_SYMBOL = "GB_NOT_ALLOW_SYMBOL" | ||
GB_IGNORE_IP_FORMAT = "GB_IGNORE_IP_FORMAT" | ||
|
||
|
||
GB_REMOVE_MULTI_SLASHES = "GB_REMOVE_MULTI_SLASHES" | ||
|
||
GB_URL_PATH_LOWERCASE = "GB_URL_PATH_LOWERCASE" | ||
GB_CHINESE_ENCODE = "GB_CHINESE_ENCODE" | ||
GB_ONLY_ENCODE_CHINESE = "GB_ONLY_ENCODE_CHINESE" | ||
|
||
|
||
# 命中结果保存 | ||
GB_SAVE_HIT_RESULT = "GB_SAVE_HIT_RESULT" | ||
GB_HIT_OVER_CALC = "GB_HIT_OVER_CALC" | ||
GB_HIT_FILE_DIR = "GB_HIT_FILE_DIR" | ||
GB_HIT_EXT_FILE = "GB_HIT_EXT_FILE" | ||
GB_HIT_PATH_FILE = "GB_HIT_PATH_FILE" | ||
GB_HIT_DIR_FILE = "GB_HIT_DIR_FILE" | ||
GB_HIT_FILE_FILE = "GB_HIT_FILE_FILE" |
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,80 @@ | ||
#!/usr/bin/env python | ||
|
||
""" | ||
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/) | ||
See the file 'LICENSE' for copying permission | ||
""" | ||
|
||
import copy | ||
import types | ||
|
||
|
||
class AttribDict(dict): | ||
""" | ||
This class defines the sqlmap object, inheriting from Python data | ||
type dictionary. | ||
>>> foo = AttribDict() | ||
>>> foo.bar = 1 | ||
>>> foo.bar | ||
1 | ||
""" | ||
|
||
def __init__(self, indict=None, attribute=None): | ||
# 初始化方法,可以传入一个字典对象 indict 和一个可选的属性 attribute。 | ||
if indict is None: | ||
indict = {} | ||
|
||
# 在初始化之前设置任何属性 这些仍然是普通属性 | ||
self.attribute = attribute | ||
dict.__init__(self, indict) | ||
self.__initialised = True | ||
# 初始化后,设置属性 与 设置项相同 | ||
|
||
def __getattr__(self, item): | ||
# 将值映射到属性 只有当不存在带有此名称的属性时才调用 | ||
# 当访问不存在的属性时被调用,将其映射到字典中对应的值。 | ||
|
||
try: | ||
return self.__getitem__(item) | ||
except KeyError: | ||
raise AttributeError("unable to access item '%s'" % item) | ||
|
||
def __setattr__(self, item, value): | ||
# 将属性映射到值 只有当我们被初始化时 | ||
# 当设置属性时被调用,将其映射到字典中对应的键值对。 | ||
|
||
# 这个测试允许在__init__方法中设置属性 | ||
if "_AttribDict__initialised" not in self.__dict__: | ||
return dict.__setattr__(self, item, value) | ||
|
||
# 任何正常属性都被正常处理 | ||
elif item in self.__dict__: | ||
dict.__setattr__(self, item, value) | ||
|
||
else: | ||
self.__setitem__(item, value) | ||
|
||
def __getstate__(self): | ||
# 用于序列化对象的状态 | ||
return self.__dict__ | ||
|
||
def __setstate__(self, dict): | ||
# 用于反序列化对象的状态 | ||
self.__dict__ = dict | ||
|
||
def __deepcopy__(self, memo): | ||
# 深度复制对象 | ||
retVal = self.__class__() | ||
memo[id(self)] = retVal | ||
|
||
for attr in dir(self): | ||
if not attr.startswith('_'): | ||
value = getattr(self, attr) | ||
if not isinstance(value, (types.BuiltinFunctionType, types.FunctionType, types.MethodType)): | ||
setattr(retVal, attr, copy.deepcopy(value, memo)) | ||
|
||
for key, value in self.items(): | ||
retVal.__setitem__(key, copy.deepcopy(value, memo)) | ||
|
||
return retVal |
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,9 @@ | ||
#!/usr/bin/env python | ||
|
||
from libs.lib_attribdict.attribdict import AttribDict | ||
|
||
# module config | ||
CONFIG = AttribDict() | ||
|
||
if __name__ == '__main__': | ||
print(CONFIG.items()) |
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
Oops, something went wrong.