From 55bf18b52edb2496380378f6f952d4de82df2733 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 15 Jun 2011 17:50:07 +0200 Subject: Implement list_harmful_meta() in CLI --- cli.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cli.py') diff --git a/cli.py b/cli.py index bd87409..b5bea20 100755 --- a/cli.py +++ b/cli.py @@ -16,6 +16,8 @@ def parse(): help='List all the meta of a file without removing them') common.add_option('--check', '-c', action='store_true', default=False, help='Check if a file is free of harmfull metadatas') + common.add_option('--harmful', action='store_true', default=False, + help='List all the harmful meta of a file without removing them') common.add_option('--version', action='callback', callback=displayVersion, help='Display version and exit') @@ -40,6 +42,14 @@ def list_meta(class_file, filename): for key, item in class_file.get_meta().iteritems(): print('\t%s : %s' % (key, item) ) +def list_harmful_meta(class_file, filename): + ''' + Print all the harmful meta of 'filename' on stdout + ''' + print('[+] File %s :' % filename) + for key, item in class_file.get_harmful().iteritems(): + print('\t%s : %s' % (key, item) ) + def is_clean(class_file, filename): ''' Say if 'filename' is clean or not @@ -68,6 +78,8 @@ def main(): func = list_meta elif args.check is True: #only check if the file is clean func = is_clean + elif args.harmful is True: #only print harmful metadatas + func = list_harmful_meta else: #clean the file func = clean_meta -- cgit v1.3