summaryrefslogtreecommitdiff
path: root/mat-cli
diff options
context:
space:
mode:
authorjvoisin2011-12-24 01:21:31 +0100
committerjvoisin2011-12-24 01:21:31 +0100
commitafbfe94cf082d71f492b98e442441cc01f6271c2 (patch)
tree45702b5acb7584a3ff179ed47939e8d240ec28a7 /mat-cli
parent72980c74513f20b7b5f3e42a5bf1c8c50dda17d9 (diff)
Rename "ugly" to ""strict"0.2.1
Diffstat (limited to 'mat-cli')
-rwxr-xr-xmat-cli21
1 files changed, 11 insertions, 10 deletions
diff --git a/mat-cli b/mat-cli
index 41ce335..2ee0637 100755
--- a/mat-cli
+++ b/mat-cli
@@ -25,7 +25,7 @@ The default behaviour is to clean files given in argument')
25 help='Keep a backup copy') 25 help='Keep a backup copy')
26 options.add_option('--force', '-f', action='store_true', default=False, 26 options.add_option('--force', '-f', action='store_true', default=False,
27 help='Don\'t check if files are clean before cleaning') 27 help='Don\'t check if files are clean before cleaning')
28 options.add_option('--ugly', '-u', action='store_true', default=False, 28 options.add_option('--strict', '-u', action='store_true', default=False,
29 help='Strict cleaning mode : loss can occur') 29 help='Strict cleaning mode : loss can occur')
30 30
31 info = optparse.OptionGroup(parser, 'Informations') 31 info = optparse.OptionGroup(parser, 'Informations')
@@ -42,6 +42,8 @@ The default behaviour is to clean files given in argument')
42 42
43 values, arguments = parser.parse_args() 43 values, arguments = parser.parse_args()
44 if not arguments and values.list is False: 44 if not arguments and values.list is False:
45 # if no argument and no files are passed,
46 # print help and exit
45 parser.print_help() 47 parser.print_help()
46 sys.exit(0) 48 sys.exit(0)
47 return values, arguments 49 return values, arguments
@@ -65,11 +67,10 @@ def list_meta(class_file, filename, force):
65 print('No harmful metadata found') 67 print('No harmful metadata found')
66 else: 68 else:
67 meta = class_file.get_meta() 69 meta = class_file.get_meta()
68 if meta is None: 70 print ('Harmful metadata found:')
69 print('No harmful metadata found') 71 if meta is not None:
70 else:
71 for key, value in class_file.get_meta().iteritems(): 72 for key, value in class_file.get_meta().iteritems():
72 print(key + ' : ' + str(value)) 73 print('\t' + key + ' : ' + str(value))
73 74
74 75
75def is_clean(class_file, filename, force): 76def is_clean(class_file, filename, force):
@@ -95,15 +96,15 @@ def clean_meta(class_file, filename, force):
95 else: 96 else:
96 print('Unable to clean %s', filename) 97 print('Unable to clean %s', filename)
97 98
98def clean_meta_ugly(class_file, filename, force): 99def clean_meta_strict(class_file, filename, force):
99 ''' 100 '''
100 Clean the file 'filename', ugly way 101 Clean the file 'filename', strict way
101 ''' 102 '''
102 print('[+] Cleaning %s' % filename) 103 print('[+] Cleaning %s' % filename)
103 if force is False and class_file.is_clean(): 104 if force is False and class_file.is_clean():
104 print('%s is already clean' % filename) 105 print('%s is already clean' % filename)
105 else: 106 else:
106 class_file.remove_all_ugly() 107 class_file.remove_all_strict()
107 print('%s cleaned' % filename) 108 print('%s cleaned' % filename)
108 109
109 110
@@ -139,8 +140,8 @@ def main():
139 func = list_meta 140 func = list_meta
140 elif args.check is True: # only check if the file is clean 141 elif args.check is True: # only check if the file is clean
141 func = is_clean 142 func = is_clean
142 elif args.ugly is True: # destructive anonymisation method 143 elif args.strict is True: # destructive anonymisation method
143 func = clean_meta_ugly 144 func = clean_meta_strict
144 elif args.list is True: # print the list of all supported format 145 elif args.list is True: # print the list of all supported format
145 list_supported() 146 list_supported()
146 else: # clean the file 147 else: # clean the file