Skip to content

Commit

Permalink
修改错误和完善插件框架
Browse files Browse the repository at this point in the history
  • Loading branch information
Cl0udG0d committed Mar 27, 2022
1 parent 15ec4e3 commit 6702441
Show file tree
Hide file tree
Showing 24 changed files with 955 additions and 244 deletions.
4 changes: 4 additions & 0 deletions app/model/exts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from flask_sqlalchemy import SQLAlchemy
#专门存放db,防止循环引用问题的出现

db=SQLAlchemy()
8 changes: 8 additions & 0 deletions app/scan/scanIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
from pocsuite3.api import get_results
import os
import json
from app.utils.beforeScan import getPluginDepends



def saveVul(result,tid,poc):
with app.app_context():
Expand Down Expand Up @@ -116,6 +119,11 @@ def scanConsole(url,poclist,tid,pluginlist):
db.session.add(basemsgdb)
db.session.commit()

# 预处理
getPluginDepends()

time.sleep(5)

# 前置扫描
scanPocs(target,poclist,tid)
scanPlugins(target,pluginlist,tid)
Expand Down
58 changes: 58 additions & 0 deletions app/utils/beforeScan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2022/3/26 23:27
# @Author : Cl0udG0d
# @File : beforeScan.py
# @Github: https://github.com/Cl0udG0d
import importlib
import os
import re
import logging
from pip._internal import main
import sys

def getPluginDepends():
pattern = re.compile("^import (.*?)$")
moduleKeys=list(sys.modules.keys())
currdir = os.path.join(os.path.dirname(os.path.dirname(__file__)), "../plugins/")
for files in os.listdir(currdir):
if os.path.splitext(files)[1] == '.py' and not files.startswith("_"):
filename = os.path.splitext(files)[0]
filepath=currdir+"/"+filename+".py"
logging.info("{} is Checking".format(filepath))
with open(filepath, 'r') as f:
for line in f.readlines():
result=pattern.findall(line.strip())
if result:
name=result[0]
if name and checkLib(name,moduleKeys):
logging.info("{} Lib is Loading".format(name))
install(name)
else:
print("{} Lib is Loaded".format(name))
return


def install(package,source="https://pypi.tuna.tsinghua.edu.cn/simple"):
main(['install', package,'-i',source])


def checkLib(libName,moduleKeys):
try:
if libName in moduleKeys:
return False
importlib.import_module(libName)
return False
except Exception as e:
logging.warning(e)
return True


def test():
name="import re dd"
pattern=re.compile("^import (.*?)$")
print(pattern.findall(name))


if __name__ == '__main__':
getDepends("../plugins")
12 changes: 12 additions & 0 deletions assets/static/css/animate.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/static/css/login.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions assets/static/css/style.min.css

Large diffs are not rendered by default.

Binary file added assets/static/images/login_background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/static/js/jquery.min.js

Large diffs are not rendered by default.

20 changes: 0 additions & 20 deletions docs/.vuepress/config.js

This file was deleted.

Binary file removed docs/.vuepress/public/Cl0udG0d.jpg
Binary file not shown.
Binary file removed docs/.vuepress/public/dn.jpg
Binary file not shown.
Binary file removed docs/.vuepress/public/home.jpg
Binary file not shown.
Binary file removed docs/.vuepress/public/logo.jpg
Binary file not shown.
Binary file removed docs/.vuepress/public/wsr.jpg
Binary file not shown.
17 changes: 0 additions & 17 deletions docs/README.md

This file was deleted.

28 changes: 0 additions & 28 deletions docs/guide/README.md

This file was deleted.

8 changes: 5 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

在这些情况下原有的大型扫描器可能不太适用,所以我重构了原来的碎遮扫描器

扫描器砍掉了非必要和耗时比较长的信息收集部分,用户可以自定义POC和插件来进行扫描,POC和插件都可以从本地进行上传,相应的编写文档为:xxx。
扫描器砍掉了非必要和耗时比较长的信息收集部分,用户可以自定义POC和插件来进行扫描,POC和插件支持本地上传,相关文档如下:

+ [Pocsuite3 开发文档及 PoC 编写规范及要求说明](./other/CODING.md)
+ [python实现插件框架]()
+ [插件编写]()


项目使用了以下技术:
Expand All @@ -35,8 +39,6 @@ docker-compose up -d

选择需要的POC和插件,添加任务进行扫描即可

## 进阶使用


## 开发团队

Expand Down
Loading

0 comments on commit 6702441

Please sign in to comment.