From c990a6699de6e2001b411461618ff8d76effab2f Mon Sep 17 00:00:00 2001 From: Dobin Date: Thu, 7 Mar 2024 20:33:17 +0000 Subject: [PATCH] feature: web: show log files in project --- app/templates/files.html | 26 ++---- app/templates/project.html | 169 +++++++++++++++++++------------------ app/views.py | 36 ++++---- 3 files changed, 114 insertions(+), 117 deletions(-) diff --git a/app/templates/files.html b/app/templates/files.html index 658f5c7..4acf4e1 100644 --- a/app/templates/files.html +++ b/app/templates/files.html @@ -1,45 +1,36 @@ - - - - {% include 'header.html' %} - - - -{% include 'navigation.html' %}
-
- +
{% for log_file in log_files %}
-
{{log_file['content']|safe}} -
+
{{log_file['content']|safe}} +
{% endfor %}
@@ -47,6 +38,3 @@
- - - \ No newline at end of file diff --git a/app/templates/project.html b/app/templates/project.html index 3eda8dd..9ec505f 100644 --- a/app/templates/project.html +++ b/app/templates/project.html @@ -7,94 +7,97 @@ {% include 'navigation.html' %}
- -

Project {{project_name}}

- -
+

Project {{project_name}}

+
- - - -
- - - -
- - + - - - - - - - - - - - - - + + + +
+
- + + + + +
+
+ + + + + + +
- + -
- - -
+
+
+ -
-
-
-
- +
+ + +
+
+
+ + +
+
+ {% include 'files.html' %} +
+
+ + \ No newline at end of file diff --git a/app/views.py b/app/views.py index 195ad7e..e692353 100644 --- a/app/views.py +++ b/app/views.py @@ -33,6 +33,7 @@ def index(): @views.route("/project/") def project(name): project = storage.get_project(name) + log_files = get_logfiles() exes = [] for file in os.listdir("app/upload/exe"): @@ -59,6 +60,8 @@ def project(name): decoderstyles=decoderstyles, execstyles=execstyles, injectstyles=injectstyles, + + log_files=log_files, ) @@ -167,8 +170,14 @@ def build(): @views.route("/files") def files(): - log_files = [] + log_files = get_logfiles() + return render_template('files.html', + log_files=log_files + ) + +def get_logfiles(): + log_files = [] id = 0 asm_a = "" # for diff asm_b = "" @@ -181,7 +190,7 @@ def files(): if file.endswith(".bin"): continue data = f.read() - + print("FILE: {}".format(file)) if 'main_c' in file: data = highlight(data, CLexer(), HtmlFormatter(full=False)) elif '_asm_' in file: @@ -191,17 +200,18 @@ def files(): if '_updated' in file: asm_b = data data = highlight(data, NasmLexer(), HtmlFormatter(full=False)) - elif '_shc' in file: - if '.txt' in file: + elif '.ascii' in file: + data = conv.convert(data, full=False) + elif '.txt' in file: # skip it continue - if '.ascii' in file: - data = conv.convert(data, full=False) - if '.hex' in file: - data = escape(data) - #data = highlight(data, HexdumpLexer(), HtmlFormatter(full=False)) + elif '.hex' in file: + print("-> hex") + continue + #data = escape(data) + #data = highlight(data, HexdumpLexer(), HtmlFormatter(full=False)) elif '.log' in file: - data = escape(data) + data = conv.convert(data, full=False) else: data = escape(data) @@ -230,8 +240,4 @@ def files(): id += 1 #asm_a = "" asm_b = "" - - - return render_template('project.html', - log_files=log_files - ) + return log_files \ No newline at end of file