diff options
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 13 |
1 files changed, 9 insertions, 4 deletions
| @@ -1,4 +1,5 @@ | |||
| 1 | import sys | 1 | import sys |
| 2 | import mimetypes | ||
| 2 | from shutil import copyfile | 3 | from shutil import copyfile |
| 3 | import argparse | 4 | import argparse |
| 4 | 5 | ||
| @@ -18,10 +19,11 @@ def create_arg_parser(): | |||
| 18 | help='list all the harmful metadata of a file without removing them') | 19 | help='list all the harmful metadata of a file without removing them') |
| 19 | return parser | 20 | return parser |
| 20 | 21 | ||
| 21 | def show_meta(file_name:str): | 22 | def show_meta(filename:str): |
| 22 | p = parser_factory.get_parser(file_name) | 23 | p = parser_factory.get_parser(filename) |
| 23 | if p is None: | 24 | if p is None: |
| 24 | print("[-] %s's format (%s) is not supported" % (file_name, p)) | 25 | mtype, _ = mimetypes.guess_type(filename) |
| 26 | print("[-] %s's format (%s) is not supported" % (filename, mtype)) | ||
| 25 | return | 27 | return |
| 26 | for k,v in p.get_meta().items(): | 28 | for k,v in p.get_meta().items(): |
| 27 | print("%s: %s" % (k, v)) | 29 | print("%s: %s" % (k, v)) |
| @@ -36,7 +38,10 @@ def main(): | |||
| 36 | return 0 | 38 | return 0 |
| 37 | 39 | ||
| 38 | for f in args.files: | 40 | for f in args.files: |
| 39 | p = parser_factory.get_parser(sys.argv[1]) | 41 | p = parser_factory.get_parser(f) |
| 42 | if p is None: | ||
| 43 | print("[-] %s's format (%s) is not supported" % (f, "meh")) | ||
| 44 | continue | ||
| 40 | p.remove_all() | 45 | p.remove_all() |
| 41 | 46 | ||
| 42 | 47 | ||
