Skip to content

Commit

Permalink
dialog xl, banner check improve
Browse files Browse the repository at this point in the history
  • Loading branch information
Davide Arcuri committed Feb 13, 2024
1 parent 1f84901 commit c68b7a4
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 26 deletions.
22 changes: 8 additions & 14 deletions orochi/templates/website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -626,24 +626,18 @@ <h5 class="offcanvas-title" id="leftNoteLabel">History Log</h5>
$.ajax({
url: "{% url 'website:index_info'%}",
data: { 'index': btn.data('index') },
dataType: 'json',
beforeSend: function () {
$("#modal-update").modal("show");
$("#modal-update").addClass("modal-xl");
},
success: function (data) {
bootbox.alert({
message: `
<h4>${data.name}</h4>
<dl class="row small-dlg">
<dt class="col-sm-3">md5</dt><dd class="col-sm-9">${data.md5}</dd>
<dt class="col-sm-3">sha256</dt><dd class="col-sm-9">${data.sha256}</dd>
<dt class="col-sm-3">size</dt><dd class="col-sm-9">${data.size}</dd>
<dt class="col-sm-3">index</dt><dd class="col-sm-9">${data.index}</dd>
<dt class="col-sm-3">filepath</dt><dd class="col-sm-9">${data.upload}</dd>
<dt class="col-sm-3">comment</dt><dd class="col-sm-9">${data.comment}</dd>
</dl>`,
size: 'large'
});
$("#modal-update .modal-content").html(data);
}
});
});
$(document).on("hidden.bs.modal", ".modal-xl", function (e) {
$(this).removeClass("modal-xl");
});

// EDIT INDEX FORM
$(document).on("click", ".edit-index", function (e) {
Expand Down
26 changes: 26 additions & 0 deletions orochi/templates/website/partial_info.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<div class="modal-header">
<h4>{{dump.name}}</h4>
</div>
<div class="modal-body">
<dl class="row small-dlg">
<dt class="col-sm-3">md5</dt>
<dd class="col-sm-9">{{dump.md5}}</dd>
<dt class="col-sm-3">sha256</dt>
<dd class="col-sm-9">{{dump.sha256}}</dd>
<dt class="col-sm-3">Size</dt>
<dd class="col-sm-9">{{dump.size}}</dd>
<dt class="col-sm-3">Index</dt>
<dd class="col-sm-9">{{dump.index}}</dd>
<dt class="col-sm-3">Filepath</dt>
<dd class="col-sm-9">{{dump.upload}}</dd>
{% if dump.comment %}<dt class="col-sm-3">Comment</dt>
<dd class="col-sm-9">{{dump.comment}}</dd>{% endif %}
{% if dump.banner %}<dt class="col-sm-3">Banner</dt>
<dd class="col-sm-9">{{dump.banner}}</dd>{% endif %}
{% if dump.suggested_symbols_path %}<dt class="col-sm-3">Suggested Symbol Path</dt>
<dd class="col-sm-9">{{dump.suggested_symbols_path.0}}</dd>{% endif %}
</dl>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
1 change: 1 addition & 0 deletions orochi/utils/volatility_dask_elk.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ def run_plugin(dump_obj, plugin_obj, params=None, user_pk=None):
.isoformat(),
},
),
refresh=True,
)

# set max_windows_size on new created index
Expand Down
23 changes: 11 additions & 12 deletions orochi/website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from orochi.utils.plugin_install import plugin_install
from orochi.utils.volatility_dask_elk import (
check_runnable,
get_banner,
get_parameters,
refresh_symbols,
run_plugin,
Expand Down Expand Up @@ -1047,18 +1048,7 @@ def info(request):
dump = get_object_or_404(Dump, index=request.GET.get("index"))
if dump not in get_objects_for_user(request.user, "website.can_see"):
Http404("404")
return JsonResponse(
{
"index": dump.index,
"name": dump.name,
"md5": dump.md5,
"sha256": dump.sha256,
"size": dump.size,
"upload": dump.upload.path,
"comment": dump.comment,
},
safe=False,
)
return TemplateResponse(request, "website/partial_info.html", {"dump": dump})


@login_required
Expand Down Expand Up @@ -1448,6 +1438,15 @@ def delete_symbol(request):
def reload_symbols(request):
"""reload symbols"""
dump = get_object_or_404(Dump, index=request.GET.get("index"))

# Try to reload banner from elastic if first time was not successful
if not dump.banner:
banner = dump.result_set.get(plugin__name="banners.Banners")
banner_result = get_banner(banner)
if banner_result:
dump.banner = banner_result.strip("\"'")
dump.save()

change = False
if check_runnable(dump.pk, dump.operating_system, dump.banner):
change = True
Expand Down

0 comments on commit c68b7a4

Please sign in to comment.