Skip to content

Commit ec282ca

Browse files
committed
update
1 parent f71223f commit ec282ca

File tree

21 files changed

+1128
-0
lines changed

21 files changed

+1128
-0
lines changed

.gitignore

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib64/
18+
parts/
19+
sdist/
20+
var/
21+
wheels/
22+
pip-wheel-metadata/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
53+
# Translations
54+
*.mo
55+
*.pot
56+
57+
# Django stuff:
58+
*.log
59+
local_settings.py
60+
db.sqlite3
61+
db.sqlite3-journal
62+
63+
# Flask stuff:
64+
instance/
65+
.webassets-cache
66+
67+
# Scrapy stuff:
68+
.scrapy
69+
70+
# Sphinx documentation
71+
docs/_build/
72+
73+
# PyBuilder
74+
target/
75+
76+
# Jupyter Notebook
77+
.ipynb_checkpoints
78+
79+
# IPython
80+
profile_default/
81+
ipython_config.py
82+
83+
# pyenv
84+
.python-version
85+
86+
# pipenv
87+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
88+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
89+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
90+
# install all needed dependencies.
91+
#Pipfile.lock
92+
93+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
94+
__pypackages__/
95+
96+
# Celery stuff
97+
celerybeat-schedule
98+
celerybeat.pid
99+
100+
# SageMath parsed files
101+
*.sage.py
102+
103+
# Environments
104+
.env
105+
.venv
106+
env/
107+
venv/
108+
ENV/
109+
env.bak/
110+
venv.bak/
111+
112+
# Spyder project settings
113+
.spyderproject
114+
.spyproject
115+
116+
# Rope project settings
117+
.ropeproject
118+
119+
# mkdocs documentation
120+
/site
121+
122+
# mypy
123+
.mypy_cache/
124+
.dmypy.json
125+
dmypy.json
126+
127+
# Pyre type checker
128+
.pyre/
129+
log/
130+
/venv
131+
132+
*.db
133+
output

1.txt

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
1+
<!--
2+
* @Date: 2022-01-11 18:08:25
3+
* @LastEditors: recar
4+
* @LastEditTime: 2022-01-12 11:04:18
5+
-->
16
# mullet
27
被动代理扫描器 梭鱼
8+
9+
10+
代理模块
11+
url去重模块
12+
任务分发模块 多生产者多消费者模块 多队列形式
13+
指纹识别模块
14+
poc通用模块
15+
通用检测模块
16+
漏洞报告模块
17+
日志模块 日志要酷炫
18+
参数控制模块
19+
20+
一个流程:
21+
指纹识别->分析出是啥指纹后增加poc任务
22+
敏感目录备份文件等扫描
23+
上面一个url就可以添加出来任务了
24+
25+
然后代理访问开始后或者后续流量有url的就交给url识别

config/config.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[options]
2+
model=debug

config/report.template

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<html>
2+
<h1>test</h1>
3+
{0}
4+
</html>

lib/cmd_parse.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/python
2+
# coding=utf-8
3+
'''
4+
Date: 2022-01-12 16:28:33
5+
LastEditors: recar
6+
LastEditTime: 2022-01-12 16:28:33
7+
'''

lib/controller.py

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
#!/usr/bin/python
2+
# coding=utf-8
3+
'''
4+
Date: 2022-01-12 11:05:17
5+
LastEditors: recar
6+
LastEditTime: 2022-01-12 18:52:06
7+
'''
8+
from lib.work import Worker
9+
from plugins.report import Report
10+
from plugins.fingerprint.fingerprint import Fingerprint
11+
from plugins.sensitive_info.dis_sen_info import DisSenInfo
12+
from lib.log import logger
13+
from lib.utils import Utils
14+
from queue import Queue
15+
import importlib
16+
import os
17+
18+
class Controller(object):
19+
def __init__(self,):
20+
self.domains = set()
21+
self.urls = set()
22+
self.result_queue = Queue()
23+
self.logger = logger
24+
base_path = os.path.dirname(os.path.abspath(__file__))
25+
plugins_dir = os.path.join(base_path, "../", 'plugins')
26+
fingerprint_dir = os.path.join(plugins_dir, 'fingerprint')
27+
sensitive_info_dir = os.path.join(plugins_dir, 'sensitive_info')
28+
general_dir = os.path.join(plugins_dir, 'general')
29+
poc_dir = os.path.join(plugins_dir, 'poc')
30+
# 注册
31+
fingerprint_list = list()
32+
sensitive_info_list = list()
33+
general_list = list()
34+
poc_list = list()
35+
36+
# 启动报告模块
37+
report = Report(self.result_queue)
38+
report.run()
39+
# init modul
40+
self._run_fingerprint()
41+
# self._run_sensitive_info()
42+
# self._run_general()
43+
# self._run_poc()
44+
45+
46+
# 指纹
47+
def _run_fingerprint(self):
48+
fingerprint_handler = Fingerprint(self.result_queue)
49+
def consumer(data):
50+
data = data[1].get("data")
51+
url_info = data.get("url_info")
52+
req = data.get("req")
53+
rsp = data.get("rsp")
54+
fingerprint_handler.run(url_info, req, rsp)
55+
self.fingerprint_work = Worker(consumer, consumer_count=1, logger=logger)
56+
57+
# 敏感信息
58+
# def _run_sensitive_info(self):
59+
# disSenInfo_handler = DisSenInfo(self.result_queue)
60+
# def consumer(data):
61+
# data = data[1].get("data")
62+
# url_info = data.get("url_info")
63+
# req = data.get("req")
64+
# rsp = data.get("rsp")
65+
# disSenInfo_handler.run(url_info, req, rsp)
66+
# self.disSenInfo_work = Worker(consumer, consumer_count=1)
67+
68+
# # 通用插件
69+
# def _run_general(self):
70+
# def consumer(data):
71+
# data = data[1].get("data")
72+
# plugins_name = data.get("plugins")
73+
# req = data.get("req")
74+
# rsp = data.get("rsp")
75+
# url_info = data.get("url_info")
76+
# # 动态实例插件名称并传递req和rsp来执行
77+
# metaclass = importlib.import_module(plugins_name)
78+
# metaclass.Scan().run(url_info, req, rsp)
79+
# self.general_work = Worker(consumer, consumer_count=10)
80+
81+
# # poc插件
82+
# # 先直接poc全发一下
83+
# def _run_poc(self):
84+
# def consumer(data):
85+
# data = data[1].get("data")
86+
# plugins_name = data.get("plugins")
87+
# req = data.get("req")
88+
# rsp = data.get("rsp")
89+
# url_info = data.get("url_info")
90+
# # 动态实例插件名称并传递req和rsp来执行
91+
# metaclass = importlib.import_module(plugins_name)
92+
# metaclass.Scan().run(url_info, req, rsp)
93+
# self.poc_work = Worker(consumer, consumer_count=10)
94+
95+
96+
# 入口分发任务
97+
def run(self, url_info, req, rsp):
98+
domain = url_info.get('host')
99+
gener_url = url_info.get("gener_url")
100+
if len(self.domains)<1:
101+
self.domains.add(domain)
102+
self.logger.info(f"gen task fingerprint: {domain}")
103+
# 推指纹
104+
self.fingerprint_work.put({"data":{
105+
"url_info": url_info,
106+
"req": req,
107+
"rsp": rsp
108+
}})
109+
# 推敏感信息扫描
110+
# self.logger.info("gen task disSenInfo")
111+
# self.disSenInfo_work.put({
112+
# "url_info": url_info,
113+
# "req": req,
114+
# "rsp": rsp
115+
# })
116+
# # 推poc
117+
# self.logger.info("gen task poc")
118+
# self.poc_work.put({
119+
# "url_info": url_info,
120+
# "req": req,
121+
# "rsp": rsp
122+
# })
123+
# self.domains.add(domain)
124+
# if gener_url not in self.urls:
125+
# # 推通用插件
126+
# self.logger.info("gen task general")
127+
# self.general_work.put({
128+
# "url_info": url_info,
129+
# "req": req,
130+
# "rsp": rsp
131+
# })
132+
# self.urls.add(gener_url)

lib/core.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/python
2+
# coding=utf-8
3+
'''
4+
Date: 2022-01-12 10:03:45
5+
LastEditors: recar
6+
LastEditTime: 2022-01-12 10:03:45
7+
'''

lib/filter.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/python
2+
# coding=utf-8
3+
'''
4+
Date: 2021-03-23 15:51:56
5+
LastEditors: recar
6+
LastEditTime: 2022-01-12 16:34:55
7+
'''
8+
from lib.utils import Utils
9+
from lib.controller import Controller
10+
from lib.log import logger
11+
import sys
12+
sys.path.append('../')
13+
controller = Controller()
14+
15+
class Filter(object):
16+
@staticmethod
17+
def parser_request(flow):
18+
del flow.request.headers['Accept-Encoding']
19+
20+
@staticmethod
21+
def parser_response(flow):
22+
url_info = Utils.parser_url(flow)
23+
req = Utils.parser_req(flow)
24+
rsp = Utils.parser_rsp(flow)
25+
# check
26+
if not url_info:
27+
return
28+
logger.debug("url: {0} type: {1}".format(url_info["url"], url_info['type']))
29+
# insert url
30+
controller.run(url_info, req, rsp)
31+
32+
33+

0 commit comments

Comments
 (0)