summaryrefslogtreecommitdiff
path: root/cli.py
diff options
context:
space:
mode:
authorjvoisin2011-06-15 17:50:07 +0200
committerjvoisin2011-06-15 17:50:07 +0200
commit55bf18b52edb2496380378f6f952d4de82df2733 (patch)
tree2fd9112054b40154c7cf8ef78a65346bf85ced5a /cli.py
parente9795577892e7a5d27d2faeb844045cc28990ee7 (diff)
Implement list_harmful_meta() in CLI
Diffstat (limited to 'cli.py')
-rwxr-xr-xcli.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/cli.py b/cli.py
index bd87409..b5bea20 100755
--- a/cli.py
+++ b/cli.py
@@ -16,6 +16,8 @@ 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')
19 common.add_option('--version', action='callback', callback=displayVersion, 21 common.add_option('--version', action='callback', callback=displayVersion,
20 help='Display version and exit') 22 help='Display version and exit')
21 23
@@ -40,6 +42,14 @@ def list_meta(class_file, filename):
40 for key, item in class_file.get_meta().iteritems(): 42 for key, item in class_file.get_meta().iteritems():
41 print('\t%s : %s' % (key, item) ) 43 print('\t%s : %s' % (key, item) )
42 44
45def 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
43def is_clean(class_file, filename): 53def is_clean(class_file, filename):
44 ''' 54 '''
45 Say if 'filename' is clean or not 55 Say if 'filename' is clean or not
@@ -68,6 +78,8 @@ def main():
68 func = list_meta 78 func = list_meta
69 elif args.check is True: #only check if the file is clean 79 elif args.check is True: #only check if the file is clean
70 func = is_clean 80 func = is_clean
81 elif args.harmful is True: #only print harmful metadatas
82 func = list_harmful_meta
71 else: #clean the file 83 else: #clean the file
72 func = clean_meta 84 func = clean_meta
73 85