From 5798786ac51eb7f16f0b7b262297eec4cab123bf Mon Sep 17 00:00:00 2001 From: qux-bbb <1147635419@qq.com> Date: Thu, 9 Feb 2023 22:53:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3ZipFile=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xanalyzer/file.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xanalyzer/file.py b/xanalyzer/file.py index bf77dbd..f5af668 100644 --- a/xanalyzer/file.py +++ b/xanalyzer/file.py @@ -1,3 +1,4 @@ +import io import os import re import json @@ -34,7 +35,8 @@ def guess_type_and_ext(self, the_content): the_file_type = magic.from_buffer(the_content) the_ext = [] if the_file_type.startswith("Zip archive data"): - the_zip = ZipFile(self.file_path) + the_file = io.BytesIO(the_content) + the_zip = ZipFile(the_file) zip_namelist = the_zip.namelist() the_zip.close() if "AndroidManifest.xml" in zip_namelist: