From 5bf61081d39bf47e756b5c9775e8614036f8fab8 Mon Sep 17 00:00:00 2001 From: rusinthread Date: Sat, 7 Jan 2017 23:57:44 +0300 Subject: improve decoding of type1 ciphertexts --- main.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index 34c0b33..d6e064a 100755 --- a/main.py +++ b/main.py @@ -3,6 +3,7 @@ import argparse import sys import os +from pprint import pprint try: from termcolor import cprint @@ -10,7 +11,7 @@ try: except ImportError: colors_supported = False -from data_lib import load_data, decode_auto +from data_lib import load_data, decode_auto, clean_string def print_colored(s, color, fallback_prefix=''): @@ -32,8 +33,8 @@ def main(): parser.add_argument('--reverse-decoded', action='store_true') args = parser.parse_args() - data = load_data() - + data = load_data('date', sort_reverse=True) + if args.decode: # filter by type if args.type == 2: @@ -41,9 +42,6 @@ def main(): else: data = list(filter(lambda i: 'type' not in i, data)) - # sort by text length - data = sorted(data, key=lambda i: len(i['text'])) - for obj in data: text = obj['text'] text_decoded = decode_auto(text, @@ -53,7 +51,7 @@ def main(): # print all information print(obj['text']) - print_colored(text, 'green', fallback_prefix='[CLEANED] ') + print_colored(clean_string(text, remove_junk=(not args.with_junk)), 'green', fallback_prefix='[CLEANED] ') print_colored(text_decoded, 'cyan', fallback_prefix='[DECODED] ') if 'pic' in obj: -- cgit v1.2.3