-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflask-getip.py
83 lines (63 loc) · 1.79 KB
/
flask-getip.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from flask import Flask,request,send_file
import sys,time,sqlite3
conn = sqlite3.connect('./flask-getip/ip.db', check_same_thread=False)
cur = conn.cursor()
jumptext='跳转失败,您可能开启了代理或者出现了未知错误'
app = Flask(__name__)
@app.route('/getquick/')
def adminget2():
cur.execute("SELECT ip,unixtime FROM IP where id='quickjump'")
return str(cur.fetchall())
@app.route('/get/')
def adminget():
passwd = request.args.get('pwd')
if (passwd == '5buW6ZuF6aao'):
return send_file(r'./flask-getip/ip.db')
return '密码错误'
@app.route('/admin/')
def admin():
passwd = request.args.get('pwd')
cur.execute('SELECT id FROM pwds WHERE pwd = "'+passwd+'"')
okid=cur.fetchall()
if (len(okid) >= 1):
cur.execute("SELECT unixtime,ip FROM IP where id='"+okid[0][0]+"'")
return str(cur.fetchall())
else:
return '不可用的密码'
@app.route('/execute/')
def adminshow():
passwd = request.args.get('pwd')
if (passwd == '5buW6ZuF6aao'):
cur.execute(request.args.get('cmd'))
return str(cur.fetchall())
return '密码错误'
@app.route('/clear/')
def clear():
passwd = request.args.get('pwd')
if (passwd == '5buW6ZuF6aao'):
cur.execute('DELETE FROM IP;')
conn.commit()
return 'delete!'
return '密码错误'
@app.route('/changetext/')
def changetext():
global jumptext
passwd = request.args.get('pwd')
if (passwd == '5buW6ZuF6aao'):
jumptext=request.args.get('text')
return '修改成功!'
return '密码错误!'
@app.route('/jump/')
def jumpa():
id = request.args.get('jumpid')
ip = request.remote_addr
x = """
INSERT INTO ip ('unixtime','id','ip')
VALUES(?,?,?)
"""
y = [(int(time.time()*1000),id,ip)]
cur.executemany(x,y)
conn.commit()
return jumptext
if __name__ == '__main__':
app.run(host='0.0.0.0',debug=True,port=int(sys.argv[1]))