2018-03-06 23:20:18 +01:00
|
|
|
import sys
|
|
|
|
from shutil import copyfile
|
|
|
|
import argparse
|
|
|
|
|
2018-03-19 23:43:49 +01:00
|
|
|
from src import parser_factory
|
2018-03-06 23:20:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
def create_arg_parser():
|
|
|
|
parser = argparse.ArgumentParser(description='Metadata anonymisation toolkit 2')
|
|
|
|
parser.add_argument('files', nargs='*')
|
|
|
|
|
|
|
|
info = parser.add_argument_group('Information')
|
|
|
|
info.add_argument('-c', '--check', action='store_true',
|
|
|
|
help='check if a file is free of harmful metadatas')
|
|
|
|
info.add_argument('-l', '--list', action='store_true',
|
|
|
|
help='list all supported fileformats')
|
|
|
|
info.add_argument('-s', '--show', action='store_true',
|
|
|
|
help='list all the harmful metadata of a file without removing them')
|
|
|
|
return parser
|
|
|
|
|
|
|
|
def show_meta(file_name:str):
|
2018-03-20 01:20:11 +01:00
|
|
|
p = parser_factory.get_parser(file_name)
|
2018-03-06 23:20:18 +01:00
|
|
|
for k,v in p.get_meta().items():
|
|
|
|
print("%s: %s" % (k, v))
|
|
|
|
|
|
|
|
def main():
|
|
|
|
argparser = create_arg_parser()
|
|
|
|
args = argparser.parse_args()
|
|
|
|
|
|
|
|
if args.show:
|
|
|
|
for f in args.files:
|
|
|
|
show_meta(f)
|
|
|
|
return 0
|
2018-03-20 01:20:11 +01:00
|
|
|
|
|
|
|
for f in args.files:
|
|
|
|
p = parser_factory.get_parser(sys.argv[1])
|
|
|
|
p.remove_all()
|
2018-03-06 23:20:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
|
|
main()
|