Skip to content

Commit

Permalink
Update: worker task mode config
Browse files Browse the repository at this point in the history
  • Loading branch information
hanc00l committed Jan 3, 2024
1 parent 5ee8be5 commit 10364e7
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 31 deletions.
4 changes: 2 additions & 2 deletions web/static/js/server/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ $(function () {
function get_count_data() {
//异步获取任务统计信息
$.post("/dashboard", function (data) {
$("#task_active").html(data['task_active']);
$("#vulnerability_count").html(data['vulnerability_count']);
$("#domain_count").html(data['domain_count']);
$("#ip_count").html(data['ip_count']);
$('#worker_count').html(data['worker_count']);
$("#task_active").html("TASK: " + data['task_active']);
$('#worker_count').html("WORKER: " + data['worker_count']);
});
}

Expand Down
31 changes: 29 additions & 2 deletions web/static/js/server/worker-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,29 @@ $(function () {
$("#worker_table").DataTable().draw(true);
});
$("#buttonUpdate").click(function () {
let worker_run_task_mode = "";
if ($('#checkbox_task_mode_0').is(":checked")) {
worker_run_task_mode = "0"
} else {
let sep = "";
for (let i = 1; i <= 5; i++) {
if ($('#checkbox_task_mode_' + i).is(":checked")) {
worker_run_task_mode += sep;
worker_run_task_mode += i;
sep = ","
}
}
}
if (worker_run_task_mode === "") {
alert("必须指定Worker的任务模式!")
return
}
$.post("/worker-update",
{
"worker_name": $('#input_worker_name').val(),
"concurrency": $('#select_concurrency').val(),
"worker_performance": $('#select_worker_performance').val(),
"worker_run_task_mode": $('#select_worker_run_task_mode').val(),
"worker_run_task_mode": worker_run_task_mode,
"task_workspace_guid": $('#input_task_workspace_guid').val(),
"default_config_file": $('#input_default_config_file').val(),
"no_proxy": $('#checkbox_no_proxy').is(":checked"),
Expand Down Expand Up @@ -226,7 +243,17 @@ function edit_option(worker_name, daemon_process) {
if (e === "success") {
$('#select_concurrency').val(data['concurrency']);
$('#select_worker_performance').val(data['worker_performance']);
$('#select_worker_run_task_mode').val(data['worker_run_task_mode']);
for (let i = 0; i <= 5; i++) {
$('#checkbox_task_mode_' + i).prop("checked", false);
}
data['worker_run_task_mode'].split(",").forEach(function (item) {
if (item === "0") {
$('#checkbox_task_mode_0').prop("checked", true);
return
} else {
$('#checkbox_task_mode_' + item).prop("checked", true);
}
});
$('#input_task_workspace_guid').val(data['task_workspace_guid']);
$('#input_default_config_file').val(data['default_config_file']);
$('#checkbox_no_proxy').prop("checked", data['no_proxy']);
Expand Down
17 changes: 3 additions & 14 deletions web/views/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h4>Domain资产</h4>
</div>
</div>
</div>
<div class="col-md-6 col-lg-2">
<div class="col-md-6 col-lg-3">
<div class="widget-small danger coloured-icon">
<a href="vulnerability-list" style="text-decoration:none;">
<i class="icon fa fa-bolt fa-3x"></i>
Expand All @@ -42,25 +42,14 @@ <h4>漏洞</h4>
</div>
</div>
</div>
<div class="col-md-6 col-lg-2">
<div class="col-md-6 col-lg-3">
<div class="widget-small warning coloured-icon">
<a href="worker-list" style="text-decoration:none;">
<i class="icon fa fa-futbol-o fa-3x"></i>
</a>
<div class="info">
<h4><b>Worker</b></h4>
<p><b><span id="worker_count">0</span></b></p>
</div>
</div>
</div>
<div class="col-md-6 col-lg-2">
<div class="widget-small warning coloured-icon">
<a href="task-list" style="text-decoration:none;">
<i class="icon fa fa-hourglass-1 fa-3x"></i>
</a>
<div class="info">
<h4><b>Task</b></h4>
<p><b><span id="task_active">0</span></b></p>
<p><b><span id="worker_count">0</span></b></p>
</div>
</div>
</div>
Expand Down
69 changes: 56 additions & 13 deletions web/views/worker-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,77 @@ <h4 class="modal-title">
<div class="modal-body ">
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="select_concurrency">任务并发数</label>
<label for="select_concurrency"><strong>任务并发数</strong></label>
<select class="form-control" id="select_concurrency">
<option value="1">1</option>
<option value="2">2</option>
<option value="3" selected>3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<label for="select_worker_run_task_mode">任务模式</label>
<select class="form-control" id="select_worker_run_task_mode">
<option value="0" selected>全部任务</option>
<option value="1">主动扫描</option>
<option value="2">指纹识别</option>
<option value="3">被动信息</option>
<option value="4">漏洞验证</option>
<option value="5">自定义任务</option>
</select>
<label for="select_worker_performance">工作性能</label>
<label><strong>任务模式</strong></label>
<br/>
<div class="form-check form-check-inline">
<label class="form-check-label"
for="checkbox_task_mode_0">
<input class="form-check-input"
id="checkbox_task_mode_0" type="checkbox"
>全部任务
</label>
</div>
<br/>
<div class="form-check form-check-inline">
<label class="form-check-label"
for="checkbox_task_mode_1">
<input class="form-check-input"
id="checkbox_task_mode_1" type="checkbox"
>主动扫描
</label>
</div>
<div class="form-check form-check-inline">
<label class="form-check-label"
for="checkbox_task_mode_2">
<input class="form-check-input"
id="checkbox_task_mode_2" type="checkbox"
>指纹识别
</label>
</div>
<div class="form-check form-check-inline">
<label class="form-check-label"
for="checkbox_task_mode_3">
<input class="form-check-input"
id="checkbox_task_mode_3" type="checkbox"
>被动搜集
</label>
</div>
<div class="form-check form-check-inline">
<label class="form-check-label"
for="checkbox_task_mode_4">
<input class="form-check-input"
id="checkbox_task_mode_4" type="checkbox"
>漏洞验证
</label>
</div>
<div class="form-check form-check-inline">
<label class="form-check-label"
for="checkbox_task_mode_5">
<input class="form-check-input"
id="checkbox_task_mode_5" type="checkbox"
>自定义任务
</label>
</div>
<br/>
<label for="select_worker_performance"><strong>工作性能</strong></label>
<select class="form-control" id="select_worker_performance">
<option value="0" selected>自动选择</option>
<option value="1">高性能</option>
<option value="2">普通性能</option>
</select>
<label for="input_default_config_file">配置文件
<label for="input_default_config_file"><strong>配置文件</strong>
</label>
<input class="form-control" id="input_default_config_file" type="text"
placeholder="conf/worker.yml" value="">
<label for="input_task_workspace_guid">自定义任务的工作空间GUID
<label for="input_task_workspace_guid"><strong>自定义任务的工作空间GUID</strong>
</label>
<input class="form-control" id="input_task_workspace_guid" type="text"
placeholder="工作空间GUID,多个以,分割" value="">
Expand Down

0 comments on commit 10364e7

Please sign in to comment.