代码拉取完成,页面将自动刷新
import sqlite3
from lib import config, sql_connect
from flask import Flask, request
from flask_paginate import Pagination, get_page_parameter
from flask import render_template
app = Flask(__name__)
DATABASE = config.result_sql_path
@app.route('/')
def index():
# 获取子域数据
result_list = []
conn = sqlite3.connect(DATABASE)
cur = conn.cursor()
sql = "SELECT * FROM SUBDOMAIN"
cur.execute(sql)
subdomains = cur.fetchall()
task_sql = "SELECT * FROM TASK"
cur.execute(task_sql)
tasks = cur.fetchall()
vul_sql = "SELECT * FROM VULN"
cur.execute(vul_sql)
vuls = cur.fetchall()
plugin_list = []
s = set()
result_list = []
for vuln in vuls:
plugin_list.append(vuln[2])
for plugins in plugin_list:
if plugins not in s:
s.add(plugins)
result = {
'name': plugins,
'value': plugin_list.count(plugins)
}
result_list.append(result)
# 分页
PER_PAGE = config.PER_PAGE #每页展示条数
total = len(subdomains)
page = int(request.args.get('page', 1))
start = (page - 1) * PER_PAGE
end = start + PER_PAGE
paginate = Pagination(bs_version=4 ,page=page ,total=total, per_page = PER_PAGE)
task_total = len(tasks)
task_paginate = Pagination(bs_version=4 ,page=page ,total=task_total, per_page = PER_PAGE)
tasks = tasks[start:end]
subdomain = subdomains[start:end]
vuls_total = len(vuls)
vuls_paginate = Pagination(bs_version=4 ,page=page ,total=vuls_total, per_page = PER_PAGE)
vuls = vuls[start:end]
return render_template('index.html', paginate=paginate, subdomain=subdomain, tasks=tasks, task_paginate=task_paginate,vuls=vuls, vuls_paginate=vuls_paginate, vuls_total=vuls_total, result_list=result_list)
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。