fixed format

This commit is contained in:
2026-01-14 13:26:49 +01:00
parent ee95f4df4f
commit fcaa6b3543
8 changed files with 16 additions and 85 deletions

View File

@@ -40,8 +40,8 @@ def scramble_qr_code(payloadList, decoyList, seed):
return new_qr_code
def generate_scrambled_qrcode(seed, output_dir, decoy, name):
with open("res/secret_message.txt", "r") as secret:
def generate_scrambled_qrcode(seed, output_dir, res_dir, decoy, name):
with open(res_dir / "secret_message.txt", "r") as secret:
message = secret.read()
qr_code = generate_qrcode(message + seed)
@@ -49,7 +49,7 @@ def generate_scrambled_qrcode(seed, output_dir, decoy, name):
qr_pieces = cut_pieces(qr_code)
decoy_pieces = None
if decoy:
with open("res/decoy.txt", "r") as decoy_msg:
with open(res_dir / "decoy.txt", "r") as decoy_msg:
decoy = decoy_msg.read()
decoy_qr_code = generate_qrcode(decoy)
@@ -65,6 +65,7 @@ def main():
parser = argparse.ArgumentParser(description="Generates a scrambled QR code with optional decoy pieces.")
parser.add_argument("seed", type=str, help="The password to scramble the QR code.")
parser.add_argument("output_dir", type=Path, help="Directory where the output will be stored")
parser.add_argument("res_dir", type=Path, help="Directory where needed resources are stored")
parser.add_argument("--without-decoy", action="store_false", help="Exclude decoy pieces in the scrambled QR code.")
parser.add_argument("-o", "--output", type=str, default="secret_message.png", help="The name of the output image file.")
@@ -73,6 +74,7 @@ def main():
generate_scrambled_qrcode(
seed=args.seed,
output_dir=args.output_dir,
res_dir=args.res_dir,
decoy=args.without_decoy,
name=args.output
)