Skip to content
Snippets Groups Projects
Commit ebfa0fca authored by Simon Magnin-Feysot's avatar Simon Magnin-Feysot
Browse files

add recursivity for archive style files

parent 4ed30b5e
No related branches found
No related tags found
No related merge requests found
Pipeline #19529 passed
......@@ -58,6 +58,7 @@ def create_arg_parser() -> argparse.ArgumentParser:
def show_meta(filename: str):
recursive_mtype = ["application/zip"]
if not __check_file(filename):
return
......@@ -73,10 +74,23 @@ def show_meta(filename: str):
return
for k, v in metadata:
zipmeta = v
zipmeta_name = v
try: # FIXME this is ugly.
print(" %s: %s" % (k, v))
if not isinstance(zipmeta, dict):
print(" %s: %s" % (k, v))
except UnicodeEncodeError:
print(" %s: harmful content" % k)
if mtype in recursive_mtype:
print("[+] Metadata for files inside the archive :")
if isinstance(zipmeta, dict):
for name, metas in zipmeta.items():
try: # FIXME this is ugly.
print(" %s" % name)
for meta_name, meta in metas.items():
print(" %s: %s" % (meta_name, meta))
except UnicodeEncodeError:
print(" %s: harmful content" % zipmeta_name)
def clean_meta(filename: str, is_lightweight: bool, policy: UnknownMemberPolicy) -> bool:
if not __check_file(filename, os.R_OK|os.W_OK):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment