1
0
mirror of synced 2024-11-22 09:14:23 +01:00

add recursivity for archive style files

This commit is contained in:
Simon Magnin 2018-10-11 08:28:02 -07:00 committed by jvoisin
parent 4ed30b5e00
commit 35dca4bf1c

20
mat2
View File

@ -65,18 +65,26 @@ def show_meta(filename: str):
if p is None: if p is None:
print("[-] %s's format (%s) is not supported" % (filename, mtype)) print("[-] %s's format (%s) is not supported" % (filename, mtype))
return return
print("[+] Metadata for %s:" % filename) print("[+] Metadata for %s:" % filename)
metadata = p.get_meta().items() metadata = p.get_meta().items() # type: dict
__print_meta(metadata)
def __print_meta(metadata: dict):
if not metadata: if not metadata:
print(" No metadata found") print(" No metadata found")
return return
for k, v in metadata: for k, v in metadata:
try: # FIXME this is ugly. if isinstance(v, dict):
print(" %s: %s" % (k, v)) __print_meta(v)
except UnicodeEncodeError: else:
print(" %s: harmful content" % k) try: # FIXME this is ugly.
print(" %s: %s" % (k, v))
except UnicodeEncodeError:
print(" %s: harmful content" % k)
return
def clean_meta(filename: str, is_lightweight: bool, policy: UnknownMemberPolicy) -> bool: def clean_meta(filename: str, is_lightweight: bool, policy: UnknownMemberPolicy) -> bool:
if not __check_file(filename, os.R_OK|os.W_OK): if not __check_file(filename, os.R_OK|os.W_OK):