diff options
| author | jvoisin | 2011-06-18 02:13:37 +0200 |
|---|---|---|
| committer | jvoisin | 2011-06-18 02:13:37 +0200 |
| commit | b1dab4c844e2fae4909eca47c2b42698d12c55fc (patch) | |
| tree | 939c9060927e9ea88dfdf93ea832167b21602300 /cli.py | |
| parent | b1b4df83b071adb63d9aa3c981094d9d6edb345c (diff) | |
Hachoir is so ugly : I am able to display meta, but not to remove them (because I didn't manage to find an elegant/efficient way to find the "path" to a field). So I remove a whole "Rootfield" (exif, author, comment, ...). It's efficient, but not very elegant.
Diffstat (limited to 'cli.py')
| -rwxr-xr-x | cli.py | 12 |
1 files changed, 0 insertions, 12 deletions
| @@ -16,8 +16,6 @@ def parse(): | |||
| 16 | help='List all the meta of a file without removing them') | 16 | help='List all the meta of a file without removing them') |
| 17 | common.add_option('--check', '-c', action='store_true', default=False, | 17 | common.add_option('--check', '-c', action='store_true', default=False, |
| 18 | help='Check if a file is free of harmfull metadatas') | 18 | help='Check if a file is free of harmfull metadatas') |
| 19 | common.add_option('--harmful', action='store_true', default=False, | ||
| 20 | help='List all the harmful meta of a file without removing them') | ||
| 21 | common.add_option('--version', action='callback', callback=displayVersion, | 19 | common.add_option('--version', action='callback', callback=displayVersion, |
| 22 | help='Display version and exit') | 20 | help='Display version and exit') |
| 23 | 21 | ||
| @@ -42,14 +40,6 @@ def list_meta(class_file, filename): | |||
| 42 | for key, item in class_file.get_meta().iteritems(): | 40 | for key, item in class_file.get_meta().iteritems(): |
| 43 | print('\t%s : %s' % (key, item) ) | 41 | print('\t%s : %s' % (key, item) ) |
| 44 | 42 | ||
| 45 | def list_harmful_meta(class_file, filename): | ||
| 46 | ''' | ||
| 47 | Print all the harmful meta of 'filename' on stdout | ||
| 48 | ''' | ||
| 49 | print('[+] File %s :' % filename) | ||
| 50 | for key, item in class_file.get_harmful().iteritems(): | ||
| 51 | print('\t%s : %s' % (key, item) ) | ||
| 52 | |||
| 53 | def is_clean(class_file, filename): | 43 | def is_clean(class_file, filename): |
| 54 | ''' | 44 | ''' |
| 55 | Say if 'filename' is clean or not | 45 | Say if 'filename' is clean or not |
| @@ -78,8 +68,6 @@ def main(): | |||
| 78 | func = list_meta | 68 | func = list_meta |
| 79 | elif args.check is True: #only check if the file is clean | 69 | elif args.check is True: #only check if the file is clean |
| 80 | func = is_clean | 70 | func = is_clean |
| 81 | elif args.harmful is True: #only print harmful metadatas | ||
| 82 | func = list_harmful_meta | ||
| 83 | else: #clean the file | 71 | else: #clean the file |
| 84 | func = clean_meta | 72 | func = clean_meta |
| 85 | 73 | ||
