Skip to content

Commit

Permalink
remove missing symbols flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Davide Arcuri committed Feb 13, 2024
1 parent c68b7a4 commit 277417e
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 13 deletions.
6 changes: 3 additions & 3 deletions orochi/templates/website/partial_indices.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% if dumps %}
<ul class="nav flex-column" id="index-list">
{% for folder, index, name, color, os, author, missing_symbols, status, description in dumps %}
{% for folder, index, name, color, os, author, status, description in dumps %}
{% ifchanged folder %}
{% if not forloop.first %}
</ul>
Expand All @@ -21,7 +21,7 @@
{% endif %}
{{name}}

{% if status != 4 and not missing_symbols %}
{% if status != 4 and status != 5 %}
<input type="checkbox" />
<span class="checkmark"></span>
{% else %}
Expand All @@ -47,7 +47,7 @@
data-toggle="tooltip" data-placement="top" title="Edit Dump">
<i class="fas fa-edit"></i>
</button>
{% if missing_symbols %}
{% if status == 5 %}
<!-- MISSING SYMBOLS -->
<div class="dropdown">
<a class="btn btn-outline-secondary dropdown-toggle symbols-index btn-sm" href="#" role="button"
Expand Down
4 changes: 2 additions & 2 deletions orochi/utils/volatility_dask_elk.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
from orochi.website.models import (
DUMP_STATUS_COMPLETED,
DUMP_STATUS_ERROR,
DUMP_STATUS_MISSING_SYMBOLS,
RESULT_STATUS_DISABLED,
RESULT_STATUS_EMPTY,
RESULT_STATUS_ERROR,
Expand Down Expand Up @@ -892,8 +893,7 @@ def unzip_then_run(dump_pk, user_pk, password, restart):
# This takes time so we do this one time only
if dump.banner:
dump.suggested_symbols_path = get_path_from_banner(dump.banner)
dump.missing_symbols = True
dump.status = DUMP_STATUS_COMPLETED
dump.status = DUMP_STATUS_MISSING_SYMBOLS
dump.save()
logging.error(
f"[dump {dump_pk}] symbols non available. Disabling all plugins"
Expand Down
2 changes: 0 additions & 2 deletions orochi/website/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ class DumpSerializer(serializers.ModelSerializer):
author = ShortUserSerializer(many=False, read_only=True)
index = serializers.ReadOnlyField()
banner = serializers.ReadOnlyField()
missing_symbols = serializers.ReadOnlyField()
upload = serializers.FileField(allow_empty_file=False, write_only=True)
results = serializers.SerializerMethodField("results_url")

Expand All @@ -137,7 +136,6 @@ class Meta:
fields = [
"operating_system",
"banner",
"missing_symbols",
"name",
"index",
"author",
Expand Down
10 changes: 9 additions & 1 deletion orochi/website/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@ def __init__(self, *args, **kwargs):

class Meta:
model = Dump
fields = ("name", "folder", "color", "comment", "index", "authorized_users")
fields = (
"name",
"folder",
"color",
"status",
"comment",
"index",
"authorized_users",
)
widgets = {"index": forms.HiddenInput()}


Expand Down
27 changes: 27 additions & 0 deletions orochi/website/migrations/0051_remove_missing_symbols.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 5.0.1 on 2024-02-02 15:01

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("website", "0050_folder_dump_folder"),
]
operations = [
migrations.RemoveField(model_name="dump", name="missing_symbols"),
migrations.AlterField(
model_name="dump",
name="status",
field=models.PositiveSmallIntegerField(
choices=[
(1, "Created"),
(2, "Completed"),
(3, "Deleted"),
(4, "Error"),
(5, "Missing Symbols"),
],
default=1,
),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def generate_superuser(app, schema_editor):

class Migration(migrations.Migration):
dependencies = [
("website", "0050_folder_dump_folder"),
("website", "0051_remove_missing_symbols"),
("ya", "0005_auto_20210618_0947"),
]

Expand Down
3 changes: 2 additions & 1 deletion orochi/website/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
DUMP_STATUS_COMPLETED = 2
DUMP_STATUS_DELETED = 3
DUMP_STATUS_ERROR = 4
DUMP_STATUS_MISSING_SYMBOLS = 5
STATUS = (
(DUMP_STATUS_CREATED, "Created"),
(DUMP_STATUS_COMPLETED, "Completed"),
(DUMP_STATUS_DELETED, "Deleted"),
(DUMP_STATUS_ERROR, "Error"),
(DUMP_STATUS_MISSING_SYMBOLS, "Missing Symbols"),
)

RESULT_STATUS_NOT_STARTED = 0
Expand Down Expand Up @@ -231,7 +233,6 @@ class Dump(models.Model):
color = ColorField(default="#FF0000")
status = models.PositiveSmallIntegerField(choices=STATUS, default=1)
plugins = models.ManyToManyField(Plugin, through="Result")
missing_symbols = models.BooleanField(default=False)
md5 = models.CharField(max_length=32, blank=True, null=True)
sha256 = models.CharField(max_length=64, blank=True, null=True)
size = models.BigIntegerField(null=True)
Expand Down
6 changes: 3 additions & 3 deletions orochi/website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
SymbolUploadForm,
)
from orochi.website.models import (
DUMP_STATUS_COMPLETED,
RESULT_STATUS_DISABLED,
RESULT_STATUS_EMPTY,
RESULT_STATUS_NOT_STARTED,
Expand Down Expand Up @@ -112,7 +113,6 @@
"color",
"operating_system",
"author",
"missing_symbols",
"status",
"description",
]
Expand Down Expand Up @@ -1298,7 +1298,7 @@ def banner_symbols(request):
form.delete_temporary_files()

if check_runnable(dump.pk, dump.operating_system, dump.banner):
dump.missing_symbols = False
dump.status = DUMP_STATUS_COMPLETED
dump.save()

data["form_is_valid"] = True
Expand Down Expand Up @@ -1450,7 +1450,7 @@ def reload_symbols(request):
change = False
if check_runnable(dump.pk, dump.operating_system, dump.banner):
change = True
dump.missing_symbols = False
dump.status = DUMP_STATUS_COMPLETED
dump.save()
return JsonResponse({"ok": True, "change": change})

Expand Down

0 comments on commit 277417e

Please sign in to comment.