You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
import argparse
|
|
from decode import print_messages_by_user, print_messages_by_chat, get_decryption_key, dump_message_count_table
|
|
from os.path import expanduser
|
|
|
|
parser = argparse.ArgumentParser()
|
|
subparsers = parser.add_subparsers()
|
|
table = subparsers.add_parser('table')
|
|
table.set_defaults(func=dump_message_count_table)
|
|
table.add_argument('--filter_file', '-f')
|
|
table.add_argument('--output', '-o', default='table.csv')
|
|
table.add_argument('--password', '-p')
|
|
|
|
user = subparsers.add_parser('user')
|
|
user.add_argument('regex')
|
|
user.set_defaults(func=print_messages_by_user)
|
|
|
|
chat = subparsers.add_parser('chat')
|
|
chat.add_argument('regex')
|
|
chat.set_defaults(func=print_messages_by_chat)
|
|
|
|
parser.add_argument('--db',
|
|
default=expanduser('~/.config/Signal/sql/db.sqlite'))
|
|
parser.add_argument('--config',
|
|
default=expanduser('~/.config/Signal/config.json'))
|
|
|
|
if __name__ == "__main__":
|
|
args = parser.parse_args()
|
|
args = vars(args)
|
|
password = args.pop('password')
|
|
key = get_decryption_key(args['config'], password)
|
|
args.pop('config')
|
|
func = args.pop('func')
|
|
func(**args, key=key)
|