-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.py
128 lines (88 loc) · 2.74 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
126
127
128
from flask import Flask, jsonify, request
from modules import (
m_dns, m_port, m_admin_finder, m_site,
m_cve, m_ip, m_pwned, m_password, m_ip_block_scanner,
m_mybb_plugin_scanner
)
from util import u_domain
app = Flask(__name__)
app.config['DEBUG'] = True
@app.route('/dns', methods=['POST'])
def dns_query():
data = {}
try:
domain = u_domain.domain_resolve(request.form['domain'])
data = m_dns.dns_records(domain)
except:
data = {}
return jsonify(data)
@app.route('/port', methods=['POST'])
def port_query():
domain = u_domain.domain_resolve(request.form['domain'])
port = request.form["port"]
data = m_port.check_port(domain, port)
return jsonify(data)
@app.route('/find_admin', methods=['POST'])
def admin_query():
domain = u_domain.domain_resolve(request.form['domain'])
data = m_admin_finder.find_admin(domain)
return jsonify(data)
@app.route('/site_info', methods=['POST'])
def site_info():
domain = u_domain.domain_resolve(request.form['domain'])
data = m_site.info(domain)
return jsonify(data)
@app.route('/cve', methods=['POST'])
def cve_query():
keyword = request.form["keyword"]
data = m_cve.cve_result(keyword)
return jsonify(data)
@app.route('/ip', methods=['POST'])
def ip_query():
data = m_ip.get_ip(request)
return jsonify(data)
@app.route('/pwned', methods=['POST'])
def pwned_query():
try:
query_type = request.form["type"]
except:
query_type = "have_i_been_pwned"
keyword = request.form["keyword"]
data = m_pwned.pwned(query_type, keyword)
return jsonify(data)
@app.route('/password', methods=['POST'])
def password_generate():
data = {}
try:
length = int(request.form["length"])
except:
length = 16
posts = {
"lower": request.form["lower"],
"upper": request.form["upper"],
"numeric": request.form["numeric"],
"other": request.form["other"],
"all": request.form["all"]
}
data["password"] = m_password.generate(posts, length)
return jsonify(data)
@app.route('/ip_block', methods=['POST'])
def ip_block():
ip = request.form["ip"]
minimum = request.form["min"]
maximum = request.form["max"]
data = {}
if int(minimum) < 0 or int(maximum) > 32:
data = {
"error": "IP Network Format. Range format must be in 0/32"
}
else:
data = m_ip_block_scanner.scan(ip, minimum, maximum)
return jsonify(data)
@app.route('/mybb_plugin_scanner', methods=['POST'])
def mybb_plugin_scanner():
domain = u_domain.domain_resolve(request.form['domain'])
data = m_mybb_plugin_scanner.plugin_scanner(domain)
return jsonify(data)
if __name__ == '__main__':
app.run()