-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
41 lines (36 loc) · 1.36 KB
/
Copy pathmain.py
File metadata and controls
41 lines (36 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import argparse
import os
import sys
import shutil
from pipeline import process_directory
def main():
parser = argparse.ArgumentParser(description="Python Obfuscator")
parser.add_argument("src", help="Source file or directory to obfuscate")
parser.add_argument("dst", help="Destination file or directory for obfuscated code")
parser.add_argument(
"--level",
choices=["none", "light", "medium", "heavy"],
default="light",
help="Obfuscation level",
)
parser.add_argument("--verbose", action="store_true", help="Enable verbose output")
args = parser.parse_args()
src_path = os.path.abspath(args.src)
dst_path = os.path.abspath(args.dst)
if os.path.isdir(src_path):
shutil.copytree(src_path, dst_path, dirs_exist_ok=True)
if args.verbose:
print(f"Copied source directory from {src_path} to {dst_path}")
else:
# Source is a file; ensure destination directory exists.
dst_dir = os.path.dirname(dst_path)
os.makedirs(dst_dir, exist_ok=True)
shutil.copy(src_path, dst_path)
if args.verbose:
print(f"Copied source file from {src_path} to {dst_path}")
# Process the directory or file.
process_directory(dst_path, args.level, args.verbose)
if args.verbose:
print("Obfuscation complete.")
if __name__ == "__main__":
main()