Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web-interface added by flask #19

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from flask import Flask
from flask import render_template
from flask import request,redirect,session
from flask.helpers import url_for
import subprocess
import platform

import os

TIMEOUT = 1
MAX_TTL = 50
DEFAULT_OUTPUT_DIR = "./tracevis_data/"

app = Flask(__name__)
app.secret_key = 'the random string'
@app.route('/',methods = ['GET', 'POST'])
def index():

if request.method == 'GET':

return render_template('index.html', title='Welcome', )
if request.method == 'POST':

url= request.form.get('url')


return redirect(url_for('process'))

@app.route('/process',methods = ['GET', 'POST'])
def process():
if request.method=="POST":
url= request.form.get('url')
if (platform.system()=='Linux'):

temp_return= run_command('sudo python3 ./tracevis.py --dns --domain1 %s --domain2 %s'% (url, url))
elif (platform.system()=='Windows'):
temp_return= run_command('python .\tracevis.py --dns --domain1 %s --domain2 %s'% (url, url))
x=str(temp_return).rsplit('/', 1)[-1]
size=len(x)
z=x[:size - 3]
y= 'tracevis_data/'+z
return render_template(y)
#return render_template('proccess.html')

def run_command(command):
return subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).stdout.read()


app.run(host='0.0.0.0', port=5000)
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
scapy
pyvis
scapy
pyvis
flask
Loading