-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathhttpData.py
More file actions
65 lines (45 loc) · 1.5 KB
/
Copy pathhttpData.py
File metadata and controls
65 lines (45 loc) · 1.5 KB
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
#!/usr/bin/env python
# -*- coding: utf-8
import argparse
import socket
import json
from flask import Flask, render_template, request
from src import osint
def validate_address_port(address, port):
"""
Validate IP address and port
"""
try:
socket.inet_aton(address)
except socket.error:
raise argparse.ArgumentTypeError(
"%s is not a valid IP address" % address)
if (port < 0) or (port > 65535):
raise argparse.ArgumentTypeError(
"%s is not a valid port number" % port)
return address, port
app = Flask(__name__)
@app.route('/')
def initial_page():
"""
Show the initial page
"""
return render_template('index.html')
@app.route('/dataCollect', methods=['POST'])
def data_collect():
"""
Show the results of the OSINT proccess
"""
datas = osint.osint_process(request.form['email'])
jsondata = json.loads(datas)
return render_template('dataGraph.html', jsondata=json.dumps(jsondata))
if __name__ == '__main__':
parser_args = argparse.ArgumentParser()
parser_args.add_argument('-i', '--ip', dest='ip', default='127.0.0.1',
help='IP address the server will listen on')
parser_args.add_argument('-p', '--port',
help="Port the server will listen on", type=int,
default='5500')
args = parser_args.parse_args()
address, port = validate_address_port(args.ip, args.port)
app.run(host=address, port=port)