oneforall-kjl 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. OneForAll/__init__.py +15 -0
  2. OneForAll/brute.py +503 -0
  3. OneForAll/common/check.py +41 -0
  4. OneForAll/common/crawl.py +10 -0
  5. OneForAll/common/database.py +277 -0
  6. OneForAll/common/domain.py +63 -0
  7. OneForAll/common/ipasn.py +42 -0
  8. OneForAll/common/ipreg.py +139 -0
  9. OneForAll/common/lookup.py +28 -0
  10. OneForAll/common/module.py +369 -0
  11. OneForAll/common/query.py +9 -0
  12. OneForAll/common/records.py +363 -0
  13. OneForAll/common/request.py +264 -0
  14. OneForAll/common/resolve.py +173 -0
  15. OneForAll/common/search.py +78 -0
  16. OneForAll/common/similarity.py +138 -0
  17. OneForAll/common/tablib/__init__.py +0 -0
  18. OneForAll/common/tablib/format.py +89 -0
  19. OneForAll/common/tablib/tablib.py +360 -0
  20. OneForAll/common/tldextract.py +240 -0
  21. OneForAll/common/utils.py +789 -0
  22. OneForAll/config/__init__.py +17 -0
  23. OneForAll/config/api.py +94 -0
  24. OneForAll/config/default.py +255 -0
  25. OneForAll/config/log.py +38 -0
  26. OneForAll/config/setting.py +108 -0
  27. OneForAll/export.py +72 -0
  28. OneForAll/modules/altdns.py +216 -0
  29. OneForAll/modules/autotake/github.py +105 -0
  30. OneForAll/modules/certificates/censys_api.py +73 -0
  31. OneForAll/modules/certificates/certspotter.py +48 -0
  32. OneForAll/modules/certificates/crtsh.py +84 -0
  33. OneForAll/modules/certificates/google.py +48 -0
  34. OneForAll/modules/certificates/myssl.py +46 -0
  35. OneForAll/modules/certificates/racent.py +49 -0
  36. OneForAll/modules/check/axfr.py +97 -0
  37. OneForAll/modules/check/cdx.py +44 -0
  38. OneForAll/modules/check/cert.py +58 -0
  39. OneForAll/modules/check/csp.py +94 -0
  40. OneForAll/modules/check/nsec.py +58 -0
  41. OneForAll/modules/check/robots.py +44 -0
  42. OneForAll/modules/check/sitemap.py +44 -0
  43. OneForAll/modules/collect.py +70 -0
  44. OneForAll/modules/crawl/archivecrawl.py +59 -0
  45. OneForAll/modules/crawl/commoncrawl.py +59 -0
  46. OneForAll/modules/datasets/anubis.py +45 -0
  47. OneForAll/modules/datasets/bevigil.py +50 -0
  48. OneForAll/modules/datasets/binaryedge_api.py +50 -0
  49. OneForAll/modules/datasets/cebaidu.py +45 -0
  50. OneForAll/modules/datasets/chinaz.py +45 -0
  51. OneForAll/modules/datasets/chinaz_api.py +49 -0
  52. OneForAll/modules/datasets/circl_api.py +49 -0
  53. OneForAll/modules/datasets/cloudflare_api.py +130 -0
  54. OneForAll/modules/datasets/dnsdb_api.py +51 -0
  55. OneForAll/modules/datasets/dnsdumpster.py +52 -0
  56. OneForAll/modules/datasets/dnsgrep.py +44 -0
  57. OneForAll/modules/datasets/fullhunt.py +48 -0
  58. OneForAll/modules/datasets/hackertarget.py +45 -0
  59. OneForAll/modules/datasets/ip138.py +45 -0
  60. OneForAll/modules/datasets/ipv4info_api.py +73 -0
  61. OneForAll/modules/datasets/netcraft.py +66 -0
  62. OneForAll/modules/datasets/passivedns_api.py +51 -0
  63. OneForAll/modules/datasets/qianxun.py +61 -0
  64. OneForAll/modules/datasets/rapiddns.py +45 -0
  65. OneForAll/modules/datasets/riddler.py +45 -0
  66. OneForAll/modules/datasets/robtex.py +58 -0
  67. OneForAll/modules/datasets/securitytrails_api.py +56 -0
  68. OneForAll/modules/datasets/sitedossier.py +57 -0
  69. OneForAll/modules/datasets/spyse_api.py +62 -0
  70. OneForAll/modules/datasets/sublist3r.py +45 -0
  71. OneForAll/modules/datasets/urlscan.py +45 -0
  72. OneForAll/modules/datasets/windvane.py +92 -0
  73. OneForAll/modules/dnsquery/mx.py +35 -0
  74. OneForAll/modules/dnsquery/ns.py +35 -0
  75. OneForAll/modules/dnsquery/soa.py +35 -0
  76. OneForAll/modules/dnsquery/spf.py +35 -0
  77. OneForAll/modules/dnsquery/txt.py +35 -0
  78. OneForAll/modules/enrich.py +72 -0
  79. OneForAll/modules/finder.py +206 -0
  80. OneForAll/modules/intelligence/alienvault.py +50 -0
  81. OneForAll/modules/intelligence/riskiq_api.py +58 -0
  82. OneForAll/modules/intelligence/threatbook_api.py +50 -0
  83. OneForAll/modules/intelligence/threatminer.py +45 -0
  84. OneForAll/modules/intelligence/virustotal.py +60 -0
  85. OneForAll/modules/intelligence/virustotal_api.py +59 -0
  86. OneForAll/modules/iscdn.py +86 -0
  87. OneForAll/modules/search/ask.py +69 -0
  88. OneForAll/modules/search/baidu.py +96 -0
  89. OneForAll/modules/search/bing.py +79 -0
  90. OneForAll/modules/search/bing_api.py +78 -0
  91. OneForAll/modules/search/fofa_api.py +74 -0
  92. OneForAll/modules/search/gitee.py +71 -0
  93. OneForAll/modules/search/github_api.py +86 -0
  94. OneForAll/modules/search/google.py +83 -0
  95. OneForAll/modules/search/google_api.py +77 -0
  96. OneForAll/modules/search/hunter_api.py +72 -0
  97. OneForAll/modules/search/quake_api.py +72 -0
  98. OneForAll/modules/search/shodan_api.py +53 -0
  99. OneForAll/modules/search/so.py +75 -0
  100. OneForAll/modules/search/sogou.py +72 -0
  101. OneForAll/modules/search/wzsearch.py +68 -0
  102. OneForAll/modules/search/yahoo.py +81 -0
  103. OneForAll/modules/search/yandex.py +80 -0
  104. OneForAll/modules/search/zoomeye_api.py +73 -0
  105. OneForAll/modules/srv.py +75 -0
  106. OneForAll/modules/wildcard.py +319 -0
  107. OneForAll/oneforall.py +275 -0
  108. OneForAll/takeover.py +168 -0
  109. OneForAll/test.py +23 -0
  110. oneforall_kjl-0.1.1.dist-info/METADATA +18 -0
  111. oneforall_kjl-0.1.1.dist-info/RECORD +114 -0
  112. oneforall_kjl-0.1.1.dist-info/WHEEL +5 -0
  113. oneforall_kjl-0.1.1.dist-info/entry_points.txt +2 -0
  114. oneforall_kjl-0.1.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,17 @@
1
+ import importlib
2
+ from config import default
3
+
4
+
5
+ class Settings(object):
6
+ def __init__(self):
7
+ # 获取全局变量中的配置信息
8
+ for attr in dir(default):
9
+ setattr(self, attr, getattr(default, attr))
10
+ setting_modules = ['config.setting', 'config.api']
11
+ for setting_module in setting_modules:
12
+ setting = importlib.import_module(setting_module)
13
+ for attr in dir(setting):
14
+ setattr(self, attr, getattr(setting, attr))
15
+
16
+
17
+ settings = Settings()
@@ -0,0 +1,94 @@
1
+ # 模块API配置
2
+ # Censys可以免费注册获取API:https://censys.io/api
3
+ censys_api_id = ''
4
+ censys_api_secret = ''
5
+
6
+ # Binaryedge可以免费注册获取API:https://app.binaryedge.io/account/api
7
+ # 免费的API有效期只有1个月,到期之后可以再次生成,每月可以查询250次。
8
+ binaryedge_api = ''
9
+
10
+ # BeVigil API: https://bevigil.com/osint-api
11
+ bevigil_api = ''
12
+
13
+ # Chinaz可以免费注册获取API:http://api.chinaz.com/ApiDetails/Alexa
14
+ chinaz_api = ''
15
+
16
+ # Bing可以免费注册获取API:https://azure.microsoft.com/zh-cn/services/
17
+ # cognitive-services/bing-web-search-api/#web-json
18
+ bing_api_id = ''
19
+ bing_api_key = ''
20
+
21
+ # SecurityTrails可以免费注册获取API:https://securitytrails.com/corp/api
22
+ securitytrails_api = ''
23
+
24
+ # https://fofa.so/api
25
+ fofa_api_email = '' # fofa用户邮箱
26
+ fofa_api_key = '' # fofa用户key
27
+
28
+ # Google可以免费注册获取API:
29
+ # 免费的API只能查询前100条结果
30
+ # https://developers.google.com/custom-search/v1/overview#search_engine_id
31
+ # 创建自定义搜索引擎后需要在响应的控制面板上启用Search the entire web
32
+ google_api_id = '' # Google API自定义搜索引擎id
33
+ # https://developers.google.com/custom-search/v1/overview#api_key
34
+ google_api_key = '' # Google API自定义搜索key
35
+
36
+ # https://api.passivetotal.org/api/docs/
37
+ riskiq_api_username = ''
38
+ riskiq_api_key = ''
39
+
40
+ # Shodan可以免费注册获取API: https://account.shodan.io/register
41
+ # 免费的API限速1秒查询1次
42
+ shodan_api_key = ''
43
+ # ThreatBook API 查询子域名需要收费 https://x.threatbook.cn/nodev4/vb4/myAPI
44
+ threatbook_api_key = ''
45
+
46
+ # VirusTotal可以免费注册获取API: https://developers.virustotal.com/reference
47
+ virustotal_api_key = ''
48
+
49
+ # https://www.zoomeye.org/doc?channel=api
50
+ zoomeye_api_key = ''
51
+
52
+ # Spyse可以免费注册获取API: https://spyse.com/
53
+ spyse_api_token = ''
54
+
55
+ # https://www.circl.lu/services/passive-dns/
56
+ circl_api_username = ''
57
+ circl_api_password = ''
58
+
59
+ # https://www.dnsdb.info/
60
+ dnsdb_api_key = ''
61
+
62
+ # ipv4info可以免费注册获取API: http://ipv4info.com/tools/api/
63
+ # 免费的API有效期只有2天,到期之后可以再次生成,每天可以查询50次。
64
+ ipv4info_api_key = ''
65
+
66
+ # https://github.com/360netlab/flint
67
+ # passivedns_api_addr默认空使用http://api.passivedns.cn
68
+ # passivedns_api_token可为空
69
+ passivedns_api_addr = ''
70
+ passivedns_api_token = ''
71
+
72
+ # Github Token可以访问https://github.com/settings/tokens生成,user为Github用户名
73
+ # 用于子域接管和子域收集
74
+ github_api_user = ''
75
+ github_api_token = ''
76
+
77
+ # obtain Cloudflare API key from https://dash.cloudflare.com/profile/api-tokens
78
+ cloudflare_api_token = ''
79
+
80
+ # https://hunter.qianxin.com/home/userInfo
81
+ hunter_api_key = ''
82
+
83
+ # https://api-docs.fullhunt.io/
84
+ fullhunt_api_key = ''
85
+
86
+
87
+ # 登录quake之后可在个人中心获取key https://quake.360.net/quake/#/personal?tab=message
88
+ quake_api_key = ''
89
+
90
+ #https://www.racent.com/ctlog F2>Network抓包获取Token
91
+ racent_api_token = ''
92
+
93
+ # https://windvane.lichoin.com/
94
+ windvane_api_token = ''
@@ -0,0 +1,255 @@
1
+ # coding=utf-8
2
+ """
3
+ OneForAll默认配置
4
+ """
5
+
6
+ import pathlib
7
+ import warnings
8
+
9
+ # 禁用所有警告信息
10
+ warnings.filterwarnings("ignore")
11
+
12
+ # 路径设置
13
+ relative_directory = pathlib.Path(__file__).parent.parent # OneForAll代码相对路径
14
+ module_dir = relative_directory.joinpath('modules') # OneForAll模块目录
15
+ third_party_dir = relative_directory.joinpath('thirdparty') # 三方工具目录
16
+ data_storage_dir = relative_directory.joinpath('data') # 数据存放目录
17
+ result_save_dir = relative_directory.joinpath('results') # 结果保存目录
18
+ temp_save_dir = result_save_dir.joinpath('temp')
19
+
20
+ # OneForAll入口参数设置
21
+ enable_check_network = True # 开启网络环境检查
22
+ enable_check_version = True # 开启最新版本检查
23
+ enable_brute_module = True # 使用爆破模块(默认True)
24
+ enable_dns_resolve = True # 使用DNS解析子域(默认True)
25
+ enable_http_request = True # 使用HTTP请求子域(默认True)
26
+ enable_finder_module = True # 开启finder模块,开启会从响应体和JS中再次发现子域(默认True)
27
+ enable_altdns_module = True # 开启altdns模块,开启会利用置换技术重组子域再次发现新子域(默认True)
28
+ enable_enrich_module = True # 开启enrich模块,开启会富化出信息,如ip的cdn,cidr,asn,org,addr和isp等信息
29
+ enable_banner_identify = True # 开启WEB指纹识别模块(默认True)
30
+ enable_takeover_check = False # 开启子域接管风险检查(默认False)
31
+ # 参数可选值有 'small', 'medium', 'large'
32
+ http_request_port = 'small' # HTTP请求子域(默认 'small',探测80,443端口)
33
+ # 参数可选值True,False分别表示导出存活,全部子域结果
34
+ result_export_alive = False # 只导出存活的子域结果(默认False)
35
+ # 参数可选格式有 'csv', 'json'
36
+ result_save_format = 'csv' # 子域结果保存文件格式(默认csv)
37
+ # 参数path默认None使用OneForAll结果目录自动生成路径
38
+ result_save_path = None # 子域结果保存文件路径(默认None)
39
+
40
+ # 收集模块设置
41
+ save_module_result = False # 保存各模块发现结果为json文件(默认False)
42
+ enable_all_module = True # 启用所有收集模块(默认True)
43
+ enable_partial_module = [] # 启用部分收集模块 必须禁用enable_all_module才能生效
44
+ # 只使用ask和baidu搜索引擎收集子域的示例
45
+ # enable_partial_module = ['modules.search.ask', 'modules.search.baidu']
46
+ module_thread_timeout = 90.0 # 每个收集模块线程超时时间(默认90秒)
47
+
48
+ # 爆破模块设置
49
+ enable_wildcard_check = True # 开启泛解析检测(默认True)
50
+ enable_wildcard_deal = True # 开启泛解析处理(默认True)
51
+ brute_massdns_path = None # 默认None自动选择 如需填写请填写绝对路径
52
+ brute_status_format = 'ansi' # 爆破时状态输出格式(默认asni,可选json)
53
+ brute_concurrent_num = 2000 # 并发查询数量(默认2000,最大推荐10000)
54
+ brute_socket_num = 1 # 爆破时每个进程下的socket数量
55
+ brute_resolve_num = 15 # 解析失败时尝试换名称服务器重查次数
56
+ # 爆破所使用的字典路径(默认None则使用data/subdomains.txt,自定义字典请使用绝对路径)
57
+ brute_wordlist_path = None
58
+ use_china_nameservers = True # 使用中国域名服务器 如果你所在网络不在中国则建议设置False
59
+ # 域名的权威DNS名称服务器的保存路径 当域名开启了泛解析时会使用该名称服务器来进行A记录查询
60
+ authoritative_dns_path = data_storage_dir.joinpath('authoritative_dns.txt')
61
+ enable_recursive_brute = False # 是否使用递归爆破(默认False)
62
+ brute_recursive_depth = 2 # 递归爆破深度(默认2层)
63
+ # 爆破下一层子域所使用的字典路径(默认None则使用data/subnames_next.txt,自定义字典请使用绝对路径)
64
+ recursive_nextlist_path = None
65
+ enable_check_dict = False # 是否开启字典配置检查提示(默认False)
66
+ delete_generated_dict = True # 是否删除爆破时临时生成的字典(默认True)
67
+ delete_massdns_result = True # 是否删除爆破时massdns输出的解析结果 (默认True)
68
+ only_save_valid = True # 是否在处理爆破结果时只存入解析成功的子域
69
+ check_time = 10 # 检查字典配置停留时间(默认10秒)
70
+ enable_fuzz = False # 是否使用fuzz模式枚举域名
71
+ fuzz_place = None # 指定爆破的位置 指定的位置用`@`表示 示例:www.@.example.com
72
+ fuzz_rule = None # fuzz域名使用的正则表达式 示例:'[a-z][0-9]' 表示第一位是字母 第二位是数字
73
+ fuzz_list = None # fuzz域名使用的字典路径
74
+ brute_ip_blacklist = {'0.0.0.0', '0.0.0.1'} # IP黑名单 子域解析到IP黑名单则标记为非法子域
75
+ ip_appear_maximum = 100 # 多个子域解析到同一IP次数超过100次则标记为非法(泛解析)子域
76
+
77
+ # altdns模块设置
78
+ altdns_increase_num = True
79
+ altdns_decrease_num = True
80
+ altdns_replace_word = False
81
+ altdns_insert_word = False
82
+ altdns_add_word = False
83
+
84
+
85
+ # banner识别模块设置
86
+ banner_process_number = 4 # 识别进程数量(默认4)
87
+
88
+ # 代理设置
89
+ enable_request_proxy = False # 是否使用代理(全局开关,默认False)
90
+ proxy_all_module = False # 代理所有模块
91
+ proxy_partial_module = ['GoogleQuery', 'AskSearch', 'DuckDuckGoSearch',
92
+ 'GoogleAPISearch', 'GoogleSearch', 'YahooSearch',
93
+ 'YandexSearch', 'CrossDomainXml',
94
+ 'ContentSecurityPolicy'] # 代理自定义的模块
95
+ request_proxy_pool = [{'http': 'http://127.0.0.1:1080',
96
+ 'https': 'https://127.0.0.1:1080'}] # 代理池
97
+ # request_proxy_pool = [{'http': 'socks5h://127.0.0.1:10808',
98
+ # 'https': 'socks5h://127.0.0.1:10808'}] # 代理池
99
+
100
+
101
+ # 请求设置
102
+ request_thread_count = None # 请求线程数量(默认None,则根据情况自动设置)
103
+ request_timeout_second = (13, 27) # 请求超时秒数(默认connect timout推荐略大于3秒)
104
+ request_ssl_verify = False # 请求SSL验证(默认False)
105
+ request_allow_redirect = True # 请求允许重定向(默认True)
106
+ request_redirect_limit = 10 # 请求跳转限制(默认10次)
107
+ # 默认请求头 可以在headers里添加自定义请求头
108
+ request_default_headers = {
109
+ 'Accept': 'text/html,application/xhtml+xml,'
110
+ 'application/xml;q=0.9,*/*;q=0.8',
111
+ 'Accept-Encoding': 'gzip, deflate',
112
+ 'Accept-Language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
113
+ 'Cache-Control': 'max-age=0',
114
+ 'DNT': '1',
115
+ 'Referer': 'https://www.google.com/',
116
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 '
117
+ '(KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36',
118
+ 'Upgrade-Insecure-Requests': '1',
119
+ 'X-Forwarded-For': '127.0.0.1'
120
+ }
121
+ enable_random_ua = True # 使用随机UA(默认True,开启可以覆盖request_default_headers的UA)
122
+
123
+ # 搜索模块设置
124
+ # 开启全量搜索会尽量去获取搜索引擎搜索的全部结果,不过搜索耗时可能会过长
125
+ enable_full_search = False # 启用全量搜索(默认False)
126
+ enable_recursive_search = False # 递归搜索子域(默认False)
127
+ search_recursive_times = 2 # 递归搜索层数(默认2)
128
+
129
+ # DNS解析设置
130
+ resolver_nameservers = [
131
+ '223.5.5.5', # AliDNS
132
+ '119.29.29.29', # DNSPod
133
+ '114.114.114.114', # 114DNS
134
+ '8.8.8.8', # Google DNS
135
+ '1.1.1.1' # CloudFlare DNS
136
+ ] # 指定查询的DNS域名服务器
137
+ resolver_timeout = 5.0 # 解析超时时间(默认5.0秒)
138
+ resolver_lifetime = 10.0 # 解析存活时间(默认10.0秒)
139
+
140
+ # 请求端口探测设置
141
+ # 你可以在端口列表添加自定义端口
142
+ small_ports = [80, 443] # 默认使用
143
+ medium_ports = [80, 443, 8000, 8080, 8443]
144
+ # 注意:建议大厂的域名尽量不使用大端口范围,因为大厂的子域太多,加上使用大端口范围会导致生成的
145
+ # 请求上十万,百万,千万级,可能会导致内存不足程序奔溃,另外这样级别的请求量等待时间也是漫长的。
146
+ # OneForAll不是一个端口扫描工具,如果要扫端口建议使用nmap,zmap之类的工具。
147
+ large_ports = [80, 81, 280, 300, 443, 591, 593, 832, 888, 901, 981, 1010, 1080,
148
+ 1100, 1241, 1311, 1352, 1434, 1521, 1527, 1582, 1583, 1944, 2082,
149
+ 2082, 2086, 2087, 2095, 2096, 2222, 2301, 2480, 3000, 3128, 3333,
150
+ 4000, 4001, 4002, 4100, 4125, 4243, 4443, 4444, 4567, 4711, 4712,
151
+ 4848, 4849, 4993, 5000, 5104, 5108, 5432, 5555, 5800, 5801, 5802,
152
+ 5984, 5985, 5986, 6082, 6225, 6346, 6347, 6443, 6480, 6543, 6789,
153
+ 7000, 7001, 7002, 7396, 7474, 7674, 7675, 7777, 7778, 8000, 8001,
154
+ 8002, 8003, 8004, 8005, 8006, 8008, 8009, 8010, 8014, 8042, 8069,
155
+ 8075, 8080, 8081, 8083, 8088, 8090, 8091, 8092, 8093, 8016, 8118,
156
+ 8123, 8172, 8181, 8200, 8222, 8243, 8280, 8281, 8333, 8384, 8403,
157
+ 8443, 8500, 8530, 8531, 8800, 8806, 8834, 8880, 8887, 8888, 8910,
158
+ 8983, 8989, 8990, 8991, 9000, 9043, 9060, 9080, 9090, 9091, 9200,
159
+ 9294, 9295, 9443, 9444, 9800, 9981, 9988, 9990, 9999, 10000,
160
+ 10880, 11371, 12043, 12046, 12443, 15672, 16225, 16080, 18091,
161
+ 18092, 20000, 20720, 24465, 28017, 28080, 30821, 43110, 61600]
162
+ ports = {'small': small_ports, 'medium': medium_ports, 'large': large_ports}
163
+
164
+ common_subnames = {'i', 'w', 'm', 'en', 'us', 'zh', 'w3', 'app', 'bbs',
165
+ 'web', 'www', 'job', 'docs', 'news', 'blog', 'data',
166
+ 'help', 'live', 'mall', 'blogs', 'files', 'forum',
167
+ 'store', 'mobile'}
168
+
169
+ # 模块API配置
170
+ # Censys可以免费注册获取API:https://censys.io/api
171
+ censys_api_id = ''
172
+ censys_api_secret = ''
173
+
174
+ # Binaryedge可以免费注册获取API:https://app.binaryedge.io/account/api
175
+ # 免费的API有效期只有1个月,到期之后可以再次生成,每月可以查询250次。
176
+ binaryedge_api = ''
177
+
178
+ # BeVigil API: https://bevigil.com/osint-api
179
+ bevigil_api = ''
180
+
181
+ # Chinaz可以免费注册获取API:http://api.chinaz.com/ApiDetails/Alexa
182
+ chinaz_api = ''
183
+
184
+ # Bing可以免费注册获取API:https://azure.microsoft.com/zh-cn/services/
185
+ # cognitive-services/bing-web-search-api/#web-json
186
+ bing_api_id = ''
187
+ bing_api_key = ''
188
+
189
+ # SecurityTrails可以免费注册获取API:https://securitytrails.com/corp/api
190
+ securitytrails_api = ''
191
+
192
+ # https://fofa.so/api
193
+ fofa_api_email = '' # fofa用户邮箱
194
+ fofa_api_key = '' # fofa用户key
195
+
196
+ # Google可以免费注册获取API:
197
+ # 免费的API只能查询前100条结果
198
+ # https://developers.google.com/custom-search/v1/overview#search_engine_id
199
+ # 创建自定义搜索引擎后需要在响应的控制面板上启用Search the entire web
200
+ google_api_id = '' # Google API自定义搜索引擎id
201
+ # https://developers.google.com/custom-search/v1/overview#api_key
202
+ google_api_key = '' # Google API自定义搜索key
203
+
204
+ # https://api.passivetotal.org/api/docs/
205
+ riskiq_api_username = ''
206
+ riskiq_api_key = ''
207
+
208
+ # Shodan可以免费注册获取API: https://account.shodan.io/register
209
+ # 免费的API限速1秒查询1次
210
+ shodan_api_key = ''
211
+ # ThreatBook API 查询子域名需要收费 https://x.threatbook.cn/nodev4/vb4/myAPI
212
+ threatbook_api_key = ''
213
+
214
+ # VirusTotal可以免费注册获取API: https://developers.virustotal.com/reference
215
+ virustotal_api_key = ''
216
+
217
+ # https://www.zoomeye.org/doc?channel=api
218
+ zoomeye_api_key = ''
219
+
220
+ # Spyse可以免费注册获取API: https://spyse.com/
221
+ spyse_api_token = ''
222
+
223
+ # https://www.circl.lu/services/passive-dns/
224
+ circl_api_username = ''
225
+ circl_api_password = ''
226
+
227
+ # https://www.dnsdb.info/
228
+ dnsdb_api_key = ''
229
+
230
+ # ipv4info可以免费注册获取API: http://ipv4info.com/tools/api/
231
+ # 免费的API有效期只有2天,到期之后可以再次生成,每天可以查询50次。
232
+ ipv4info_api_key = ''
233
+
234
+ # https://github.com/360netlab/flint
235
+ # passivedns_api_addr默认空使用http://api.passivedns.cn
236
+ # passivedns_api_token可为空
237
+ passivedns_api_addr = ''
238
+ passivedns_api_token = ''
239
+
240
+ # Github Token可以访问https://github.com/settings/tokens生成,user为Github用户名
241
+ # 用于子域接管和子域收集
242
+ github_api_user = ''
243
+ github_api_token = ''
244
+
245
+ # obtain Cloudflare API key from https://dash.cloudflare.com/profile/api-tokens
246
+ cloudflare_api_token = ''
247
+
248
+ # https://hunter.qianxin.com/home/userInfo
249
+ hunter_api_key = ''
250
+
251
+ # https://api-docs.fullhunt.io/
252
+ fullhunt_api_key = ''
253
+
254
+ # https://windvane.lichoin.com/
255
+ windvane_api_token = ''
@@ -0,0 +1,38 @@
1
+ import sys
2
+ import pathlib
3
+
4
+ from loguru import logger
5
+
6
+ # 路径设置
7
+ relative_directory = pathlib.Path(__file__).parent.parent # OneForAll代码相对路径
8
+ result_save_dir = relative_directory.joinpath('results') # 结果保存目录
9
+ log_path = result_save_dir.joinpath('oneforall.log') # OneForAll日志保存路径
10
+
11
+ # 日志配置
12
+ # 终端日志输出格式
13
+ stdout_fmt = '<cyan>{time:HH:mm:ss,SSS}</cyan> ' \
14
+ '[<level>{level: <5}</level>] ' \
15
+ '<blue>{module}</blue>:<cyan>{line}</cyan> - ' \
16
+ '<level>{message}</level>'
17
+ # 日志文件记录格式
18
+ logfile_fmt = '<light-green>{time:YYYY-MM-DD HH:mm:ss,SSS}</light-green> ' \
19
+ '[<level>{level: <5}</level>] ' \
20
+ '<cyan>{process.name}({process.id})</cyan>:' \
21
+ '<cyan>{thread.name: <18}({thread.id: <5})</cyan> | ' \
22
+ '<blue>{module}</blue>.<blue>{function}</blue>:' \
23
+ '<blue>{line}</blue> - <level>{message}</level>'
24
+
25
+ logger.remove()
26
+ logger.level(name='TRACE', color='<cyan><bold>')
27
+ logger.level(name='DEBUG', color='<blue><bold>')
28
+ logger.level(name='INFOR', no=20, color='<green><bold>')
29
+ logger.level(name='QUITE', no=25, color='<green><bold>')
30
+ logger.level(name='ALERT', no=30, color='<yellow><bold>')
31
+ logger.level(name='ERROR', color='<red><bold>')
32
+ logger.level(name='FATAL', no=50, color='<RED><bold>')
33
+
34
+ # 如果你想在命令终端静默运行OneForAll,可以将以下一行中的level设置为QUITE
35
+ # 命令终端日志级别默认为INFOR
36
+ logger.add(sys.stderr, level='INFOR', format=stdout_fmt, enqueue=True)
37
+ # 日志文件默认为级别为DEBUG
38
+ logger.add(log_path, level='DEBUG', format=logfile_fmt, enqueue=True, encoding='utf-8')
@@ -0,0 +1,108 @@
1
+ # coding=utf-8
2
+ """
3
+ OneForAll自定义配置
4
+ """
5
+
6
+ import pathlib
7
+
8
+ # 路径设置
9
+ relative_directory = pathlib.Path(__file__).parent.parent # OneForAll代码相对路径
10
+ data_storage_dir = relative_directory.joinpath('data') # 数据存放目录
11
+
12
+ # OneForAll入口参数设置
13
+ enable_check_network = True # 开启网络环境检查
14
+ enable_check_version = True # 开启最新版本检查
15
+ enable_brute_module = True # 使用爆破模块(默认True)
16
+ enable_dns_resolve = True # 使用DNS解析子域(默认True)
17
+ enable_http_request = True # 使用HTTP请求子域(默认True)
18
+ enable_finder_module = True # 开启finder模块,开启会从响应体和JS中再次发现子域(默认True)
19
+ enable_altdns_module = True # 开启altdns模块,开启会利用置换技术重组子域再次发现新子域(默认True)
20
+ enable_cdn_check = True # 开启cdn检查模块(默认True)
21
+ enable_banner_identify = True # 开启WEB指纹识别模块(默认True)
22
+ enable_takeover_check = False # 开启子域接管风险检查(默认False)
23
+ # HTTP请求子域的端口范围 参数可选值有 'small', 'medium', 'large'
24
+ http_request_port = 'small' # 请求端口范围(默认 'small',表示请求子域的80,443端口)
25
+ # 参数可选值True,False分别表示导出存活,全部子域结果
26
+ result_export_alive = False # 只导出存活的子域结果(默认False)
27
+ result_save_format = 'csv' # 子域结果保存文件格式(默认csv)
28
+ # 参数path默认None使用OneForAll结果目录自动生成路径
29
+ result_save_path = None # 子域结果保存文件路径(默认None)
30
+
31
+ # 收集模块设置
32
+ save_module_result = False # 保存各模块发现结果为json文件(默认False)
33
+ enable_all_module = True # 启用所有收集模块(默认True)
34
+ enable_partial_module = [] # 启用部分收集模块 必须禁用enable_all_module才能生效
35
+ # 只使用ask和baidu搜索引擎收集子域的示例
36
+ # enable_partial_module = ['modules.search.ask', 'modules.search.baidu']
37
+
38
+ # 爆破模块设置
39
+ brute_concurrent_num = 2000 # 爆破时并发查询数量(默认2000,最大推荐10000)
40
+ # 爆破所使用的字典路径(默认None则使用data/subdomains.txt,自定义字典请使用绝对路径)
41
+ brute_wordlist_path = None
42
+ use_china_nameservers = True # 使用中国域名服务器 如果你所在网络不在中国则建议设置False
43
+ enable_recursive_brute = False # 是否使用递归爆破(默认False)
44
+ brute_recursive_depth = 2 # 递归爆破深度(默认2层)
45
+ # 爆破下一层子域所使用的字典路径(默认None则使用data/subnames_next.txt,自定义字典请使用绝对路径)
46
+ recursive_nextlist_path = None
47
+ enable_check_dict = False # 是否开启字典配置检查提示(默认False)
48
+ delete_generated_dict = True # 是否删除爆破时临时生成的字典(默认True)
49
+ # 是否删除爆破时massdns输出的解析结果 (默认True)
50
+ # massdns输出的结果中包含更详细解析结果
51
+ # 注意: 当爆破的字典较大或使用递归爆破或目标域名存在泛解析时生成的文件可能会很大
52
+ delete_massdns_result = True
53
+ only_save_valid = True # 是否在处理爆破结果时只存入解析成功的子域
54
+ check_time = 10 # 检查字典配置停留时间(默认10秒)
55
+ enable_fuzz = False # 是否使用fuzz模式枚举域名
56
+ fuzz_place = None # 指定爆破的位置 指定的位置用`*`表示 示例:www.*.example.com
57
+ fuzz_rule = None # fuzz域名的正则 示例:'[a-z][0-9]' 表示第一位是字母 第二位是数字
58
+ brute_ip_blacklist = {'0.0.0.0', '0.0.0.1'} # IP黑名单 子域解析到IP黑名单则标记为非法子域
59
+ # CNAME黑名单 子域解析到CNAME黑名单则标记为非法子域
60
+ brute_cname_blacklist = {'nonexist.sdo.com', 'shop.taobao.com'}
61
+ ip_appear_maximum = 100 # 多个子域解析到同一IP次数超过100次则标记为非法(泛解析)子域
62
+ cname_appear_maximum = 50 # 多个子域解析到同一cname次数超过50次则标记为非法(泛解析)子域
63
+
64
+ # 代理设置
65
+ enable_request_proxy = False # 是否使用代理(全局开关)
66
+ proxy_all_module = False # 代理所有模块
67
+ proxy_partial_module = ['GoogleQuery', 'AskSearch', 'DuckDuckGoSearch',
68
+ 'GoogleAPISearch', 'GoogleSearch', 'YahooSearch',
69
+ 'YandexSearch', 'CrossDomainXml',
70
+ 'ContentSecurityPolicy'] # 代理自定义的模块
71
+ request_proxy_pool = [{'http': 'http://127.0.0.1:1080',
72
+ 'https': 'http://127.0.0.1:1080'}] # 代理池
73
+ # request_proxy_pool = [{'http': 'socks5h://127.0.0.1:10808',
74
+ # 'https': 'socks5h://127.0.0.1:10808'}] # 代理池
75
+
76
+
77
+ # 请求设置
78
+ request_thread_count = None # 请求线程数量(默认None,则根据情况自动设置)
79
+ request_timeout_second = (13, 27) # 请求超时秒数(默认connect timout推荐略大于3秒)
80
+ request_ssl_verify = False # 请求SSL验证(默认False)
81
+ request_allow_redirect = True # 请求允许重定向(默认True)
82
+ request_redirect_limit = 10 # 请求跳转限制(默认10次)
83
+ # 默认请求头 可以在headers里添加自定义请求头
84
+ request_default_headers = {
85
+ 'Accept': 'text/html,application/xhtml+xml,'
86
+ 'application/xml;q=0.9,*/*;q=0.8',
87
+ 'Accept-Encoding': 'gzip, deflate',
88
+ 'Accept-Language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
89
+ 'Cache-Control': 'max-age=0',
90
+ 'DNT': '1',
91
+ 'Referer': 'https://www.google.com/',
92
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 '
93
+ '(KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36',
94
+ 'Upgrade-Insecure-Requests': '1',
95
+ 'X-Forwarded-For': '127.0.0.1'
96
+ }
97
+ enable_random_ua = True # 使用随机UA(默认True,开启可以覆盖request_default_headers的UA)
98
+
99
+
100
+ # 搜索模块设置
101
+ enable_recursive_search = False # 递归搜索子域
102
+ search_recursive_times = 2 # 递归搜索层数
103
+
104
+ # 网络空间测绘引擎设置
105
+ cam_records_maximum_per_domain = 1000 # 对于单个主域名,在测绘引擎中的最多查询多少条记录,防止泛解析和CDN浪费积分,对 fofa, hunter, quake, zoomeye 生效,最低为100
106
+
107
+ # 是否从输入的数据中使用tldextract提取主域名。若设为 False,OneForAll会直接将输入的域名作为主域名,比如北京分公司的域名 beijing.10086.com 就不会被解析成母公司的域名 10086.com
108
+ use_tld_extract = True
OneForAll/export.py ADDED
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/python3
2
+ # coding=utf-8
3
+
4
+ """
5
+ OneForAll export from database module
6
+
7
+ :copyright: Copyright (c) 2019, Jing Ling. All rights reserved.
8
+ :license: GNU General Public License v3.0, see LICENSE for more details.
9
+ """
10
+
11
+ import fire
12
+
13
+ from common import utils
14
+ from common.database import Database
15
+ from config.log import logger
16
+
17
+
18
+ def export_data(target, db=None, alive=False, limit=None, path=None, fmt='csv', show=False):
19
+ """
20
+ OneForAll export from database module
21
+
22
+ Example:
23
+ python3 export.py --target name --fmt csv --dir= ./result.csv
24
+ python3 export.py --target name --tb True --show False
25
+ python3 export.py --db result.db --target name --show False
26
+
27
+ Note:
28
+ --fmt csv/json (result format)
29
+ --path Result directory (default directory is ./results)
30
+
31
+ :param str target: Table to be exported
32
+ :param str db: Database path to be exported (default ./results/result.sqlite3)
33
+ :param bool alive: Only export the results of alive subdomains (default False)
34
+ :param str limit: Export limit (default None)
35
+ :param str fmt: Result format (default csv)
36
+ :param str path: Result directory (default None)
37
+ :param bool show: Displays the exported data in terminal (default False)
38
+ """
39
+
40
+ database = Database(db)
41
+ domains = utils.get_domains(target)
42
+ datas = list()
43
+ if domains:
44
+ for domain in domains:
45
+ table_name = domain.replace('.', '_')
46
+ rows = database.export_data(table_name, alive, limit)
47
+ if rows is None:
48
+ continue
49
+ data, _, _ = do_export(fmt, path, rows, show, domain, target)
50
+ datas.extend(data)
51
+ database.close()
52
+ if len(domains) > 1:
53
+ utils.export_all(alive, fmt, path, datas)
54
+ return datas
55
+
56
+
57
+ def do_export(fmt, path, rows, show, domain, target):
58
+ fmt = utils.check_format(fmt)
59
+ path = utils.check_path(path, target, fmt)
60
+ if show:
61
+ print(rows.dataset)
62
+ data = rows.export(fmt)
63
+ if fmt == 'csv':
64
+ data = '\ufeff' + data
65
+ utils.save_to_file(path, data)
66
+ logger.log('ALERT', f'The subdomain result for {domain}: {path}')
67
+ data = rows.as_dict()
68
+ return data, fmt, path
69
+
70
+
71
+ if __name__ == '__main__':
72
+ fire.Fire(export_data)