Skip to content
This repository was archived by the owner on Jul 13, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pydelta/PyDelta.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Annotation string references are currently broken

import argparse
import locale

from dataclasses import dataclass

Expand Down Expand Up @@ -78,13 +79,17 @@ def obfuscate_cli():
parser.add_argument('--no-refactor-names', action='store_false', help='Disables refactoring variable, function and args names.')
parser.add_argument('--no-encrypt-str', action='store_false', help='Disables encrypting strings.')
parser.add_argument('--no-compress-encrypt', action='store_false', help='Disables compression and encryption of the code.')
parser.add_argument('--utf-8', action='store_false', help='Use encoding=utf-8 to read input file.')
parser.add_argument('--str-encryption-amount', type=int, default=3, help='Amount of times to encrypt strings.')
parser.add_argument('--compress-encrypt-amount', type=int, default=30, help='Amount of times to compress and encrypt the code.')

args = parser.parse_args()

try:
with open(args.input_file, 'r') as infile:
my_encoding = locale.getpreferredencoding()
if args.utf_8:
my_encoding = 'utf-8'
with open(args.input_file, 'r', encoding=my_encoding) as infile:
source_code = infile.read()
except Exception as e:
raise Exception(f"Could not read input file: {str(e)}")
Expand All @@ -105,4 +110,4 @@ def obfuscate_cli():
with open(args.output_file, 'w') as outfile:
outfile.write(obfuscated_code)
except Exception as e:
raise Exception(f"Could not write to file: {str(e)}")
raise Exception(f"Could not write to file: {str(e)}")