-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathmain.py
125 lines (110 loc) · 4.22 KB
/
main.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/usr/bin/python
#-*- coding:utf-8 -*-
import sys,os
import mysql.connector
from flask import Flask,render_template,request,flash
from optparse import OptionParser
print (''' __ __ _
\ \/ /___ __ _| | __
\ // __|/ _` | |/ /
/ \\\\__ \ (_| | <
/_/\_\___/\__, |_|\_\\
|___/ www.hackxc.cc
''')
mysqllist = []
with open('./config.ini','r') as f:
for x in f.readlines():
mysqllist.append(x)
mydb = mysql.connector.connect(
host = '%s'%mysqllist[2].split(':')[1].strip(),
user = '%s'%mysqllist[3].split(':')[1].strip(),
password = '%s'%mysqllist[4].split(':')[1].strip(),
database = '%s'%mysqllist[5].split(':')[1].strip()
)
global a
def qq(x):
mycurros = mydb.cursor()
qq = ("select * from qq where user='%s'"%x)
#模糊查询:select * from lesson where user like '%123456%' or password like '%123456%'
mycurros.execute(qq)
a = mycurros.fetchall()
for x in range(0, len(a)):
flash(u'QQ:{:>50} 密码:{:>50}'.format(a[x][1], a[x][2]))
def name(x):
mycurros = mydb.cursor()
name = ("select * from info where name='%s'"%x)
mycurros.execute(name)
a = mycurros.fetchall()
for x in range(0, len(a)):
flash(u"姓名:{:>50} 身份证:{:>50} 地址:{:>50} 手机号:{:>50} 邮箱:{:>50}".format(a[x][1], a[x][2],a[x][3],a[x][4],a[x][5]))
def address(x):
mycurros = mydb.cursor()
address = ("select * from info where address='%s'"%x)
mycurros.execute(address)
a = mycurros.fetchall()
for x in range(0, len(a)):
flash(u"姓名:{:>50} 身份证:{:>50} 地址:{:>50} 手机号:{:>50} 邮箱:{:>50}".format(a[x][1], a[x][2],a[x][3],a[x][4],a[x][5]))
def iphone(x):
mycurros = mydb.cursor()
iphone = ("select * from info where iphone='%s'"%x)
mycurros.execute(iphone)
a = mycurros.fetchall()
for x in range(0, len(a)):
flash(u"姓名:{:>50} 身份证:{:>50} 地址:{:>50} 手机号:{:>50} 邮箱:{:>50}".format(a[x][1], a[x][2],a[x][3],a[x][4],a[x][5]))
def sfz(x):
mycurros = mydb.cursor()
sfz = ("select * from info where sfz='%s'"%x)
mycurros.execute(sfz)
a = mycurros.fetchall()
for x in range(0, len(a)):
flash(u"姓名:{:>50} 身份证:{:>50} 地址:{:>50} 手机号:{:>50} 邮箱:{:>50}".format(a[x][1], a[x][2],a[x][3],a[x][4],a[x][5]))
def email(x):
mycurros = mydb.cursor()
email = ("select * from info where email='%s'"%x)
mycurros.execute(email)
a = mycurros.fetchall()
for x in range(0, len(a)):
flash(u"姓名:{:>50} 身份证:{:>50} 地址:{:>50} 手机号:{:>50} 邮箱:{:>50}".format(a[x][1], a[x][2],a[x][3],a[x][4],a[x][5]))
def email2(x):
mycurros = mydb.cursor()
email2 = ("select * from email where email='%s'"%x)
mycurros.execute(email2)
a = mycurros.fetchall()
for x in range(0, len(a)):
flash(u"邮箱:{:>50} 密码:{:>50}".format(a[x][1], a[x][2]))
app = Flask(__name__)
app.secret_key = ('www.hackxc.cc')
@app.route('/',methods=['GET','POST'])
def index():
if request.method=='POST':
key = request.form.get('key')
select = request.values.get("select")
if not all([key]):
flash (u"请输入你要查询的内容")
elif key:
if select == (u"QQ"):
qq(key)
elif select == (u"姓名"):
name(key)
elif select == (u"地址"):
address(key)
elif select == (u"邮箱"):
email(key)
email2(key)
elif select == (u"手机号"):
iphone(key)
elif select == (u"身份证"):
sfz(key)
else:
pass
return render_template('index.html')
if __name__ == '__main__':
usage = ("usage: %prog -p 8080")
parser = OptionParser(usage=usage)
parser.add_option("-p", "--port", dest="port", help="Port Setting")
options, args = parser.parse_args()
port = options.port
if port==None:
print ("Usage : %s -p 8080"%os.path.basename(sys.argv[0]))
sys.exit(0)
app.run(port="%s"%port)