From 93df790700b7f2de122d39e3b87e4d4b245ea0b3 Mon Sep 17 00:00:00 2001 From: tema Date: Fri, 30 Jun 2023 14:55:55 +0000 Subject: [PATCH] Initial Commit Init --- SpyNote_parser.py | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 SpyNote_parser.py diff --git a/SpyNote_parser.py b/SpyNote_parser.py new file mode 100644 index 0000000..9dfb7ef --- /dev/null +++ b/SpyNote_parser.py @@ -0,0 +1,59 @@ +import re +from argparse import ArgumentParser, BooleanOptionalAction + + +def split_text(text): + pattern = r'10250-110251|-110251' + return re.split(pattern, text) + + +def parse_splittet(text): + if VERBOSE: + print(text) + pattern = r'10250-110251|10251' + out = re.split(pattern, text) + return {"text": out[0], "app": out[1], "time": out[2]} + + +def write_file(f, out, ignore=False): + if PRINT_CMD: + print(FORMAT_PATTERN.format(**out)) + if not ignore: + f.write(FORMAT_PATTERN.format(**out)+"\n") + else: + f.write(out+"\n") + +def setup_settings(args): + global VERBOSE + global PRINT_CMD + global FORMAT_PATTERN + VERBOSE = args.v + PRINT_CMD = args.p + FORMAT_PATTERN = args.f + +def setup_cmd_args(): + parser = ArgumentParser(description="SpyNote 6.4 keylogger log parser") + parser.add_argument('file', type=str, help='Keylogger file on SpyNote') + parser.add_argument('output', type=str, help='Parsed and formated file output') + parser.add_argument('-p', type=bool, action=BooleanOptionalAction, help="Print text on command line") + parser.add_argument('-f', type=str, help="Set format pattern", default="{app} - {time} --- {text}") + parser.add_argument('-v', type=bool, action=BooleanOptionalAction, help="Verbose") + return parser.parse_args() + +def worker(input_file: str, output_file: str) -> None: + f = open(output_file, "w") + text = open(input_file, 'r').read() + + for i in split_text(text): + if i == "": + continue + write_file(f, parse_splittet(i), ignore=False) + f.close() + +def main(): + args = setup_cmd_args() + setup_settings(args) + worker(args.file, args.output) + +if __name__ == "__main__": + main()