Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
kazet committed Jul 18, 2024
1 parent 1d6108e commit 5d53681
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions artemis/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ def export_delete_form(request: Request, id: int, csrf_protect: CsrfProtect = De
def view_export(request: Request, id: int) -> Response:
task = db.get_report_generation_task(id)

if not task:
raise HTTPException(status_code=404, detail="Report generation task not found")

vulnerabilities = []

num_high_severity = 0
Expand All @@ -234,8 +237,7 @@ def view_export(request: Request, id: int) -> Response:
messages_path = os.path.join(task.output_location, "messages")
for item in os.listdir(messages_path):
with open(os.path.join(messages_path, item)) as f:
domain_messages[item.removesuffix(".html")] = f.read()

domain_messages[item.removesuffix(".html")] = f.read()

with open(os.path.join(task.output_location, "advanced", "output.json")) as f:
data = json.load(f)
Expand All @@ -250,7 +252,7 @@ def view_export(request: Request, id: int) -> Response:
elif report["severity"] == "low":
num_low_severity += 1
else:
assert(False)
assert False

else:
domain_messages = {}
Expand Down
2 changes: 1 addition & 1 deletion templates/view_export.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<td>{{ vulnerability.target }}</td>
<td>
{{ vulnerability.html|safe }}
<p>
Found: {{ vulnerability.timestamp }}
</p>
Expand Down

0 comments on commit 5d53681

Please sign in to comment.