summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Magnin2018-10-11 08:28:02 -0700
committerjvoisin2018-10-11 08:28:02 -0700
commit35dca4bf1cb4d47ea39b844db599eccfe40288bb (patch)
tree853299651c24e98e6789156d075b144670fd0141
parent4ed30b5e00f4937773a66a9f2a9f5e1c69cd520d (diff)
add recursivity for archive style files
-rwxr-xr-xmat220
1 files changed, 14 insertions, 6 deletions
diff --git a/mat2 b/mat2
index 987e439..cc193e9 100755
--- a/mat2
+++ b/mat2
@@ -65,18 +65,26 @@ def show_meta(filename: str):
65 if p is None: 65 if p is None:
66 print("[-] %s's format (%s) is not supported" % (filename, mtype)) 66 print("[-] %s's format (%s) is not supported" % (filename, mtype))
67 return 67 return
68
69 print("[+] Metadata for %s:" % filename) 68 print("[+] Metadata for %s:" % filename)
70 metadata = p.get_meta().items() 69 metadata = p.get_meta().items() # type: dict
70 __print_meta(metadata)
71
72
73def __print_meta(metadata: dict):
71 if not metadata: 74 if not metadata:
72 print(" No metadata found") 75 print(" No metadata found")
73 return 76 return
74 77
75 for k, v in metadata: 78 for k, v in metadata:
76 try: # FIXME this is ugly. 79 if isinstance(v, dict):
77 print(" %s: %s" % (k, v)) 80 __print_meta(v)
78 except UnicodeEncodeError: 81 else:
79 print(" %s: harmful content" % k) 82 try: # FIXME this is ugly.
83 print(" %s: %s" % (k, v))
84 except UnicodeEncodeError:
85 print(" %s: harmful content" % k)
86 return
87
80 88
81def clean_meta(filename: str, is_lightweight: bool, policy: UnknownMemberPolicy) -> bool: 89def clean_meta(filename: str, is_lightweight: bool, policy: UnknownMemberPolicy) -> bool:
82 if not __check_file(filename, os.R_OK|os.W_OK): 90 if not __check_file(filename, os.R_OK|os.W_OK):