Skip to content

Commit f047501

Browse files
committed
did same for usernames and passwords
1 parent 6e28c73 commit f047501

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

nettacker/api/engine.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import time
88
from threading import Thread
99
from types import SimpleNamespace
10+
from pathlib import Path
1011

1112
from flask import Flask, jsonify
1213
from flask import request as flask_request
@@ -249,6 +250,15 @@ def new_scan():
249250
form_values = dict(flask_request.form)
250251
raw_report_path_filename = form_values.get("report_path_filename")
251252

253+
if form_values.get("usernames") and Path(form_values.get("usernames")).is_file():
254+
raw_username_filename = form_values.get("usernames")
255+
form_values["usernames_list"] = str(raw_username_filename)
256+
del form_values["usernames"]
257+
if form_values.get("passwords") and Path(form_values.get("passwords")).is_file():
258+
raw_password_filename = form_values.get("passwords")
259+
form_values["passwords_list"] = str(raw_password_filename)
260+
del form_values["passwords"]
261+
252262
# Sanitizing this doesn't make sense because this will not
253263
# always start from nettacker's root directory.
254264
enum_path = form_values.get("custom_enum_file")

nettacker/web/static/index.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,22 @@ <h3>Socks Proxy</h3>
295295
<div class="form-group col-md-6">
296296
<h3>Usernames</h3>
297297
<textarea class="input-mini form-control" rows="8" cols="50" id="usernames"
298-
data-role="tagsinput" placeholder="separate with commas or new line">
299-
</textarea>
298+
placeholder="separate with commas or new line"></textarea>
299+
<br>
300+
<div class="input-group col-xs-5">
301+
<span class="input-group-addon">username file</span>
302+
<input id="username_file" type="text" class="form-control" placeholder="Enter username file path">
303+
</div>
300304
</div>
301305
<div class="form-group col-md-6">
302306
<h3>Passwords</h3>
303307
<textarea class="form-control" rows="8" cols="50" id="passwords"
304308
placeholder="separate with commas or new line"></textarea>
309+
<br>
310+
<div class="input-group col-xs-5">
311+
<span class="input-group-addon">password file</span>
312+
<input id="password_file" type="text" class="form-control" placeholder="Enter password file path">
313+
</div>
305314
</div>
306315
<br>
307316
</div>

nettacker/web/static/js/main.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,15 @@ $(document).ready(function () {
376376
graph_name = this.id;
377377
});
378378

379+
// If the user enters a filepath, use that, else the normal texts
380+
var username_text = $("#usernames").val().trim();
381+
var username_filepath = $("#username_file").val().trim();
382+
var usernames_data = username_filepath !== "" ? username_filepath : username_text;
383+
384+
var password_text = $("#passwords").val().trim();
385+
var password_filepath = $("#password_file").val().trim();
386+
var passwords_data = password_filepath !== "" ? password_filepath : password_text;
387+
379388
// build post data
380389
var tmp_data = {
381390
targets: $("#targets").val(),
@@ -395,8 +404,8 @@ $(document).ready(function () {
395404
verbose_mode: $("#verbose_mode").val(),
396405
ports: $("#ports").val(),
397406
socks_proxy: $("#socks_proxy").val(),
398-
usernames: $("#usernames").val(),
399-
passwords: $("#passwords").val(),
407+
usernames: usernames_data,
408+
passwords: passwords_data,
400409
custom_enum_file: $("#enum_file").val(),
401410
};
402411

0 commit comments

Comments
 (0)