Skip to content

Commit

Permalink
Added newtasks tab and removed some functions from autocomplete (PoC)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu authored and benpturner committed Apr 14, 2024
1 parent 41bac16 commit 2dc6e04
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 8 deletions.
3 changes: 1 addition & 2 deletions resources/html-templates/autoruns.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
class="table-secondary"
{% else %}
class="table-success"
{% endif %}
onclick="showImplantBox('{{autorun.id}}','{{autorun.id}}')">
{% endif %}>
<td>{{autorun.id}}</td>
<td>{{autorun.task}}</td>
<td style="text-align:center"><a href="/autorunsview/del/{{autorun.id}}" class="badge badge-danger rounded-pill d-inline">DEL</a></td>
Expand Down
6 changes: 3 additions & 3 deletions resources/html-templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
$('#actionmenu').children().each(
(index, element) => {
if(index>0){ // check if the any implants is active
z= $('#implant_command_'+element['value']).val();
if(z!== undefined){
if(z.length<1){
cmd_input= $('#implant_command_'+element['value']).val();
if(cmd_input!== undefined){
if(cmd_input.length<1 && $("#implant_command_"+element['value']).is(":focus")!=true){
fetch('/taskviewwithnew/implant/'+element['value'])
.then(response => response.text())
.then(data => {
Expand Down
9 changes: 9 additions & 0 deletions resources/html-templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@
</svg>
<br/>Files</a>
</li>

<li>
<a href="/newtasksview" data-toggle="tooltip" title="Projects - manage your projects!" data-placement="right">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-stack" viewBox="0 0 16 16">
<path d="m14.12 10.163 1.715.858c.22.11.22.424 0 .534L8.267 15.34a.598.598 0 0 1-.534 0L.165 11.555a.299.299 0 0 1 0-.534l1.716-.858 5.317 2.659c.505.252 1.1.252 1.604 0l5.317-2.66zM7.733.063a.598.598 0 0 1 .534 0l7.568 3.784a.3.3 0 0 1 0 .535L8.267 8.165a.598.598 0 0 1-.534 0L.165 4.382a.299.299 0 0 1 0-.535L7.733.063z"/>
<path d="m14.12 6.576 1.715.858c.22.11.22.424 0 .534l-7.568 3.784a.598.598 0 0 1-.534 0L.165 7.968a.299.299 0 0 1 0-.534l1.716-.858 5.317 2.659c.505.252 1.1.252 1.604 0l5.317-2.659z"/>
</svg>
<br/>Tasks in queue</a>
</li>
</ul>
</div>
</div>
Expand Down
47 changes: 47 additions & 0 deletions resources/html-templates/newtasksview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{% include "header.html" %}
<div class="col-11" id="content" style="border-left:1px solid #b1b1b1;">
<div class="row">
<div class="col-12">
<br/>
<button type="button" class="btn btn-success">Tasks in queue</button>
<div class="row">
<div id="newtasks" class="implants col-10">
<table class="table table-sm align-middle mb-0 bg-dark table-hover">
<thead class="bg-lighdt" style="background-color:#009620;">
<tr>
<th>#</th>
<th>Implant ID</th>
<th>Command</th>
<th>User</th>
<th style="text-align:center">ACTION</th>
</tr>
</thead>
{% for task in new_tasks %}
<tr
{% if loop.index0 % 2 == 0 %}
class="table-secondary"
{% else %}
class="table-success"
{% endif %}
>
<td>{{task.id}}</td>
<td>{{task.implant_id}}</td>
<td>{{task.command}}</td>
<td>{{task.user}}</td>
<td style="text-align:center"><a href="/newtasksview/del/{{task.id}}" class="badge badge-danger rounded-pill d-inline">DEL</a></td>
</tr>
{% endfor %}
</table>
</div>
<!-- newtasks -->

</div>
<!-- /row -->
</div>
<!--/ title -->
</div>
<!-- /row -->
<br/>
</div>
<!-- /content -->
{% include "footer.html" %}
30 changes: 27 additions & 3 deletions start_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,21 @@ def display_tasks_with_new(number_of_rows=None, implant_id=None):

return render_template('tasks.html', tasks=tasks, new_tasks=new_tasks, implant_id=implant_id)

@app.route('/newtasksview')
@app.route('/newtasksview/<number_of_rows>')
@app.route('/newtasksview/del/<task_id>')
@auth.login_required
def display_newtasks(number_of_rows=None, task_id=None):
if task_id:
delete_object(NewTask, {NewTask.id: task_id})

if number_of_rows:
new_tasks = subset_data_to_json(NewTask, number_of_rows)
else:
new_tasks = data_to_json(NewTask)

return render_template('newtasksview.html', new_tasks=new_tasks)


@app.route('/implantview')
@app.route('/implantview/<number_of_rows>')
Expand Down Expand Up @@ -453,7 +468,11 @@ def autocompletecmd(implant_id=None,commandRemote=None):
block_help.update(common_block_help)
mergedList = list(commands.keys())
mergedList = mergedList + examples

mergedList.append('beacon')
mergedList.append('beacon 10m')
mergedList.append('beacon 2h')
mergedList.append('beacon 60s')
mergedList.append('dir')
finalList =[]
if commandRemote:
for i in mergedList:
Expand All @@ -465,8 +484,13 @@ def autocompletecmd(implant_id=None,commandRemote=None):
for i in finalList:
if i not in x:
x.append(i)
x.sort()
return render_template('autocomplete.html', commands=x)
cmd_with_removed_common=x
for i in common_implant_commands:
if i in cmd_with_removed_common:
cmd_with_removed_common.remove(i)
cmd_with_removed_common.sort()

return render_template('autocomplete.html', commands=cmd_with_removed_common)


if __name__ == '__main__':
Expand Down

0 comments on commit 2dc6e04

Please sign in to comment.