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

Conversation

ramtinsafadoust
Copy link

it can be start of WI development

@xhdix xhdix requested review from moh53n and xhdix December 21, 2021 09:51
@xhdix
Copy link
Contributor

xhdix commented Dec 21, 2021

Thanks for your work @ramtinsafadoust, but it seems to need a lot of improvements and changes to reach the stage of merge to main.
Only one thing, I do not understand the change in tracevis.py. If you did not make any specific changes, can you remove it from the commit?

@xhdix xhdix marked this pull request as draft December 21, 2021 10:34
@ramtinsafadoust
Copy link
Author

that was for change HTMLs output directory


TIMEOUT = 1
MAX_TTL = 50
DEFAULT_OUTPUT_DIR = "./templates/tracevis_data/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why output data is in the templates directory?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its default folder for flask templates

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should the output of the core app be changed to a new address?
(The core app must be able to work in the same way and independently of WI.)

app.py Outdated
Comment on lines 14 to 27
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'))

Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again @ramtinsafadoust ! ❤️ 🌺

@moh53n, let me know if you would like to work on this and/or continue in a new branch.

i try to fix your correct suggests

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

app.py Outdated
Comment on lines 29 to 38
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')
Copy link
Contributor

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 too.

  1. naming
  2. UI
  3. command. 1) The app should be able to run on Windows too. Therefore we should check for OS name first. 2) The way of using the tracevis command is almost incorrect.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i want to make docker file from web interface after fix changes

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 3 to 4
<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>
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove bootstrap library

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it is still not possible to work offline.
I will add a patch to this at the end.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resoved

Comment on lines 11 to 13
document.getElementById('button').onclick = function() {
alert("button was clicked");
};
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you right

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

<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">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to change this line. e.g. placeholder, aria-label, name

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its ok

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

TIMEOUT = 1
MAX_TTL = 50
DEFAULT_OUTPUT_DIR = "./tracevis_data/"
DEFAULT_REQUEST_IPS = ["1.1.1.1", "8.8.8.8", "9.9.9.9"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the new changes we do not have this line! 🤷‍♂️
I think it's best to best thing to do is apply the changes without change in the encoding of the file. so we can track the changes correctly! (please)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! we have, in line 107. But I think it's better to have all default values in ~one place.

@xhdix xhdix added the enhancement New feature or request label Dec 21, 2021
@@ -1,144 +1,134 @@
#!/usr/bin/env python3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

278 changes: 134 additions & 144 deletions
Something is not right!

@xhdix
Copy link
Contributor

xhdix commented Dec 21, 2021

Thanks again @ramtinsafadoust ! ❤️ 🌺

@moh53n, let me know if you would like to work on this and/or continue in a new branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority/low
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants