加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
mars.py 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
tidesec 提交于 2020-05-08 21:09 . Update
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : TideSec
# @Time : 18-5-9
# @File : mars.py
# @Desc : ""
import threading
from flask import Flask
from mars.app import app
from gevent.pywsgi import WSGIServer
from mars.views.modules.scanner.poc_scanner import PoCScannerLoop
from mars.views.modules.auth_tester.auth_scanner import AuthTesterLoop
from mars.views.modules.discovery.asset_discovery import DiscoveryLoop
from instance import config
ProductionConfig = config.ProductionConfig
flask_app = Flask(__name__)
flask_app.config.from_object(ProductionConfig)
host = flask_app.config.get('WEB_HOST')
port = flask_app.config.get('WEB_PORT')
thread_pool = []
def web_server():
http_server = WSGIServer((host, port), app)
http_server.serve_forever()
def scanner_loop():
PoCScannerLoop().task_schedule()
if __name__ == '__main__':
print("* Running on http://" + host + ":" + str(port))
thread_pool.append(threading.Thread(target=web_server, args=()))
thread_pool.append(threading.Thread(target=scanner_loop, args=()))
try:
for t in thread_pool:
t.start()
for t in thread_pool:
t.join()
except Exception as e:
print(e)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化