summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorrusinthread <rusinthread@cock.li>2017-01-07 23:57:44 +0300
committerrusinthread <rusinthread@cock.li>2017-01-07 23:57:44 +0300
commit5bf61081d39bf47e756b5c9775e8614036f8fab8 (patch)
treed9e987ccfd79a7567987c7447c53f19fd2e1fcf9 /main.py
parentb08c2582ec94c34672902ab1579ec584d04d5727 (diff)
improve decoding of type1 ciphertexts
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py12
1 files changed, 5 insertions, 7 deletions
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: