1
0
mirror of synced 2024-11-22 17:24:23 +01:00

Improve a bit the main.py file

This commit is contained in:
jvoisin 2018-04-01 17:13:34 +02:00
parent 7992cd0d51
commit 6c29e0eae2

13
main.py
View File

@ -1,4 +1,5 @@
import sys import sys
import mimetypes
from shutil import copyfile from shutil import copyfile
import argparse import argparse
@ -18,10 +19,11 @@ def create_arg_parser():
help='list all the harmful metadata of a file without removing them') help='list all the harmful metadata of a file without removing them')
return parser return parser
def show_meta(file_name:str): def show_meta(filename:str):
p = parser_factory.get_parser(file_name) p = parser_factory.get_parser(filename)
if p is None: if p is None:
print("[-] %s's format (%s) is not supported" % (file_name, p)) mtype, _ = mimetypes.guess_type(filename)
print("[-] %s's format (%s) is not supported" % (filename, mtype))
return return
for k,v in p.get_meta().items(): for k,v in p.get_meta().items():
print("%s: %s" % (k, v)) print("%s: %s" % (k, v))
@ -36,7 +38,10 @@ def main():
return 0 return 0
for f in args.files: for f in args.files:
p = parser_factory.get_parser(sys.argv[1]) p = parser_factory.get_parser(f)
if p is None:
print("[-] %s's format (%s) is not supported" % (f, "meh"))
continue
p.remove_all() p.remove_all()