From 795227f60e7e0d26f3f7a7339010d01416838ae3 Mon Sep 17 00:00:00 2001 From: Dobin Date: Tue, 20 Feb 2024 18:02:24 +0000 Subject: [PATCH] feature: write files with raw bytes --- app/views.py | 2 ++ observer.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/app/views.py b/app/views.py index f95b8f5..164ae48 100644 --- a/app/views.py +++ b/app/views.py @@ -35,6 +35,8 @@ def project(): print("Handle: ", file) with open(os.path.join("logs", file), "r") as f: + if file.endswith(".bin"): + continue data = f.read() if 'main_c' in file: diff --git a/observer.py b/observer.py index 37ce946..9df7125 100644 --- a/observer.py +++ b/observer.py @@ -22,6 +22,7 @@ class Observer(): self.write_to_file(name + ".disas.txt", ret['text']) self.write_to_file(name + ".disas.ascii", ret['color']) self.write_to_file(name + ".hex", ret['hexdump']) + self.write_to_file_bin(name + ".bin", data) self.idx += 1 def add_json(self, name, data): @@ -33,6 +34,11 @@ class Observer(): return with open("logs/{}-{}".format(self.idx, filename), "w") as f: f.write(data) + def write_to_file_bin(self, filename, data): + if not self.active: + return + with open("logs/{}-{}".format(self.idx, filename), "wb") as f: + f.write(data) def clean_files(self): delete_all_files_in_directory("logs/")