|
10 | 10 | import whois |
11 | 11 | import skg |
12 | 12 |
|
| 13 | +import MySQLdb |
| 14 | +import sys |
13 | 15 | reload(sys) |
14 | 16 | sys.setdefaultencoding('utf-8') |
15 | 17 |
|
16 | | -app = Flask(__name__) |
17 | 18 |
|
18 | 19 |
|
| 20 | +app = Flask(__name__) |
| 21 | +#连接数据库操作 |
| 22 | +db = MySQLdb.connect("127.0.0.1","root","","pyhack",charset='utf8' ) |
| 23 | +cursor = db.cursor() |
| 24 | + |
19 | 25 | @app.route('/',methods=["get","post"]) |
20 | 26 | def index(): |
21 | 27 | return render_template('ip.html') |
@@ -94,5 +100,33 @@ def findpass(): |
94 | 100 | else: |
95 | 101 | return render_template('skg.html',title="社工库查询") |
96 | 102 |
|
| 103 | +#集成wooyun漏洞平台 |
| 104 | +@app.route('/wooyun',methods=["get","post"]) |
| 105 | +def wooyun(): |
| 106 | + searchword = request.args.get('key', '').strip() |
| 107 | + log_id = request.args.get('id', '').strip() |
| 108 | + data = {} |
| 109 | + table = list() |
| 110 | + if log_id: |
| 111 | + # 使用execute方法执行SQL语句 |
| 112 | + cursor.execute(MySQLdb.escape_string("SELECT * from emlog_blog where gid=%s"%log_id)) |
| 113 | + # 使用 fetchone() 方法获取一条数据库。 |
| 114 | + results = cursor.fetchone() |
| 115 | + data["id"] = results[0] |
| 116 | + data["text"] = results[2] |
| 117 | + data["title"] = results[1] |
| 118 | + if searchword: |
| 119 | + sql = 'SELECT gid,title from emlog_blog where title like "%%%s%%"'%searchword |
| 120 | + cursor.execute(sql) |
| 121 | + #cursor.execute('SELECT * from emlog_blog limit 10') |
| 122 | + results = cursor.fetchall() |
| 123 | + |
| 124 | + for rows in results: |
| 125 | + tdata = {} |
| 126 | + tdata["id"] = rows[0] |
| 127 | + tdata["title"] = rows[1] |
| 128 | + table.append(tdata) |
| 129 | + return render_template("wooyun.html",title="乌云漏洞查询",data=data,table=table) |
| 130 | + |
97 | 131 | if __name__ == '__main__': |
98 | 132 | app.run(debug=True) |
0 commit comments