Skip to content

Commit ee6d727

Browse files
authored
Bug fixes, addded changelog.md, readme.md updated
1 parent e5cb9b4 commit ee6d727

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
3+
### 1.0 (2023.05.07)
4+
- Initial release.
5+
6+
### 1.1 (2024.09.04)
7+
- Added `shlex.quote()` in the `obfuscate_php()` function when constructing the command to ensure that paths with spaces or special characters are handled properly.
8+
- Updated the YAKPRO command in `config.py` to use `os.path.expanduser` to make it dynamic and compatible with user home directories

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ pip install -r requirements.txt
157157

158158
## Usage
159159

160+
:warning: **Important:** The paths specified in `config.py` (especially YAKPRO) are correct and point to the YakPro-Po obfuscator on your system.
161+
160162
1. Ensure you are in the project directory.
161163
2. Run the script
162164

config.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
import os
2+
13
# Configure colors for printing messages
24
YELLOW = '\033[93m'
35
BLUE = '\033[94m'
46
GREEN = '\033[92m'
57
RED = '\033[91m'
68
RESET = '\033[0m'
79

8-
# Configure YakPro packages path
9-
YAKPRO = ["/home/YOUR_USERNAME/PROJECT_DIR/yakpro-po/yakpro-po.php", "-o"]
10+
# Configure YakPro packages path (use full path and ensure it's correct)
11+
YAKPRO = [os.path.expanduser("/home/YOUR_USERNAME/PROJECT_DIR/yakpro-po/yakpro-po.php"), "-o"]
1012

1113
# Log filename
12-
log_filename = 'app.log'
14+
log_filename = 'app.log'

main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
import shutil
55
from concurrent.futures import ThreadPoolExecutor
66
from tqdm import tqdm
7-
from config import log_filename, YELLOW, BLUE, GREEN, RED, RESET, YAKPRO
7+
from config import (log_filename, YELLOW, BLUE, GREEN, RED, RESET, YAKPRO)
88
from subprocess import call
9+
import shlex
910

1011
# Configure logging
1112
logging.basicConfig(filename=log_filename, level=logging.DEBUG, format='%(asctime)s %(levelname)s:%(message)s', datefmt='%Y-%m-%d %H:%M:%S')
@@ -42,7 +43,8 @@ def obfuscate_php(input_file, obfuscation_options, create_backup, output_directo
4243
output_file = os.path.join(output_directory, f"obfuscated_{os.path.basename(input_file)}")
4344
logging.info(f"Obfuscating {input_file}")
4445

45-
command = [YAKPRO] + obfuscation_options + [output_file, input_file]
46+
# Use shlex.quote to handle paths with spaces or special characters
47+
command = YAKPRO + obfuscation_options + [shlex.quote(output_file), shlex.quote(input_file)]
4648
call(command)
4749

4850
print(f"{GREEN}Obfuscated file saved as {output_file}{RESET}")

0 commit comments

Comments
 (0)