-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
4a4ed0c
16dfc2e
e88286f
913c046
ebd1281
8ec141c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from flask import Flask | ||
from flask import render_template | ||
from flask import request,redirect,session | ||
from flask.helpers import url_for | ||
import subprocess | ||
|
||
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': | ||
name = 'Rosalia' | ||
return render_template('index.html', title='Welcome', username=name) | ||
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') | ||
temp_return= run_command('sudo python3 ./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') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to change this part too.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i want to make docker file from web interface after fix changes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resolved |
||
|
||
def run_command(command): | ||
return subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).stdout.read() | ||
|
||
|
||
app.run(host='0.0.0.0', port=5000) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
scapy | ||
pyvis | ||
scapy | ||
pyvis | ||
flask |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> | ||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to be able to run the app when we do not have internet access. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can remove bootstrap library There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But it is still not possible to work offline. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resoved |
||
|
||
<title>{{ title }}</title> | ||
|
||
|
||
|
||
<script> | ||
document.getElementById('button').onclick = function() { | ||
alert("button was clicked"); | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here the button should be disabled until the end of the operation or always. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you right There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resolved |
||
</script> | ||
|
||
|
||
|
||
</head> | ||
<body style="text-align: -webkit-center;" > | ||
<h1>TraceVis</h1> | ||
<br> | ||
|
||
|
||
<div style="align-self: center;" > | ||
|
||
<div class="form-group"> | ||
<form action="/process" method="POST" style="margin-left: 10%; margin-right: 10%;" > | ||
|
||
<div class="input-group mb-3"> | ||
<div class="input-group-prepend"> | ||
<span class="input-group-text" id="basic-addon1">URL</span> | ||
</div> | ||
<input type="text" class="form-control" placeholder="https://github.com" aria-label="Username" aria-describedby="basic-addon1" name="url"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We also need to change this line. e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its ok There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resolved |
||
</div> | ||
</div> | ||
|
||
<button id="button" type="submit" class="btn btn-warning">START</button> | ||
</form> | ||
</div> | ||
<div id="loader"> | ||
<div id="shadow"></div> | ||
<div id="box"></div> | ||
</div> | ||
<br> | ||
<h4>This process may take more than 5 minutes - be patient</h4> | ||
|
||
|
||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<html> | ||
<head><title> proccess </title></head> | ||
|
||
|
||
<body> | ||
|
||
<div id="loader"> | ||
<div id="shadow"></div> | ||
<div id="box"></div> | ||
</div> | ||
<h4>Please Wait - Prossessing</h4> | ||
|
||
|
||
<style> | ||
#loader { | ||
/* Uncomment this to make it run! */ | ||
/* | ||
animation: loader 5s linear infinite; | ||
*/ | ||
|
||
position: absolute; | ||
top: calc(50% - 20px); | ||
left: calc(50% - 20px); | ||
} | ||
@keyframes loader { | ||
0% { left: -100px } | ||
100% { left: 110%; } | ||
} | ||
#box { | ||
width: 50px; | ||
height: 50px; | ||
background: #fff; | ||
animation: animate .5s linear infinite; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
border-radius: 3px; | ||
} | ||
@keyframes animate { | ||
17% { border-bottom-right-radius: 3px; } | ||
25% { transform: translateY(9px) rotate(22.5deg); } | ||
50% { | ||
transform: translateY(18px) scale(1,.9) rotate(45deg) ; | ||
border-bottom-right-radius: 40px; | ||
} | ||
75% { transform: translateY(9px) rotate(67.5deg); } | ||
100% { transform: translateY(0) rotate(90deg); } | ||
} | ||
#shadow { | ||
width: 50px; | ||
height: 5px; | ||
background: #000; | ||
opacity: 0.1; | ||
position: absolute; | ||
top: 59px; | ||
left: 0; | ||
border-radius: 50%; | ||
animation: shadow .5s linear infinite; | ||
} | ||
@keyframes shadow { | ||
50% { | ||
transform: scale(1.2,1); | ||
} | ||
} | ||
|
||
|
||
body { | ||
background: #6997DB; | ||
overflow: hidden; | ||
} | ||
h4 { | ||
position: absolute; | ||
bottom: 20px; | ||
left: 20px; | ||
margin: 0; | ||
font-weight: 200; | ||
opacity: .5; | ||
font-family: sans-serif; | ||
color: #fff; | ||
} | ||
</style> | ||
|
||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to change this part. Both naming and UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i try to fix your correct suggests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved