Score:-2

Understanding this program

pl flag

Where in the program below do I state the file paths for the dump file and key file please?

#!/usr/bin/python3

import binascii, os, argparse

def writeToFile(key, key_file):
    with open(key_file, "a") as f:
 UIOP       f.write(key + "\n")

def getKeys(dump, key_file):
    dump = dump.decode('utf-8')

    zone = 0
    pos  = 0

    while zone <= 128 * 15:
        for l in range(0 + zone, 128 + zone):
            pos += 1

            if pos == 97:
                print("Key A: " + "".join(dump[l:l + 12]))
                writeToFile("".join(dump[l:l + 12]), key_file)
            elif pos == 117:
                print("Key B: " + "".join(dump[l:l + 12]))
                writeToFile("".join(dump[l:l + 12]), key_file)

        pos  = 0
        zone = zone + 128

def parse_args():
    arg_parser = argparse.ArgumentParser(description="""
A simple tool to extract keys from Mifare Classic 1K dump files.
""",formatter_class=argparse.RawDescriptionHelpFormatter)
    arg_parser.add_argument('-i', '--input', help='Mifare 1K dump input file')
    arg_parser.add_argument('-o', '--output', help='Key output file')
    args = arg_parser.parse_args()

    return args

def run(args):
    if os.path.isfile(args.input):
        with open(args.input, "rb") as f:
            getKeys(binascii.hexlify(f.read()), args.output)

def main():
    run(parse_args())

if __name__ == "__main__":
    main()
Score:1
cn flag

The way this script is written, key_file IS the dump file.

Your command syntax is $ command -i /path/to/infile -o /path/to/dumpfile

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.