mnestorov / php-obfuscator Goto Github PK
View Code? Open in Web Editor NEWPHP Obfuscator is a command-line tool build with Python to obfuscate PHP source code files.
License: MIT License
PHP Obfuscator is a command-line tool build with Python to obfuscate PHP source code files.
License: MIT License
How to use it in Termux
i make test.php with this code:
<?php
class Database {
private $pdo;
public function __construct($dbname) {
$this->pdo = new PDO("sqlite:$dbname");
$this->createTable();
}
private function createTable() {
$this->pdo->exec("CREATE TABLE IF NOT EXISTS books (
id INTEGER PRIMARY KEY,
title TEXT,
author TEXT,
year INTEGER
)");
}
public function insertBook($title, $author, $year) {
$stmt = $this->pdo->prepare("INSERT INTO books (title, author, year) VALUES (?, ?, ?)");
$stmt->execute([$title, $author, $year]);
}
public function getBooks() {
$stmt = $this->pdo->query("SELECT * FROM books");
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
}
function writeToFile($filename, $content) {
file_put_contents($filename, $content);
}
function readFromFile($filename) {
return file_get_contents($filename);
}
function formatBook($book) {
return "Title: " . $book['title'] . ", Author: " . $book['author'] . ", Year: " . $book['year'];
}
$books = [
['title' => '1984', 'author' => 'George Orwell', 'year' => 1949],
['title' => 'To Kill a Mockingbird', 'author' => 'Harper Lee', 'year' => 1960]
];
$db = new Database('books.db');
foreach ($books as $book) {
$db->insertBook($book['title'], $book['author'], $book['year']);
}
$allBooks = $db->getBooks();
$content = "";
foreach ($allBooks as $book) {
$content .= formatBook($book) . "<br>";
}
writeToFile('books.txt', $content);
echo readFromFile('books.txt')."<br>";
if (!extension_loaded('bolt')) {
die('<b>Error:</b> The bolt extension is not loaded!');
}
define('4deeec90209f3805f67be0ec', '15290e997112a8a063dddb61');
mrg@mrg-HP:/mnt/My/Home/www/Test/obfuscator/php-obfuscator$ ./start.sh
Welcome to the PHP Obfuscator!
Follow the prompts to obfuscate your PHP files.
Choose the mode for obfuscating your PHP files:
1: Single file
2: Multiple files
3: Entire project directory
Enter the mode number (1/2/3): 1
Enter the output directory path: /home/mrg/www/Test/encode/0/out
Enter file or directory paths to exclude (separated by a space) (you can skip this step):
Create backups of original PHP files? (y/n): y
Choose the obfuscation options:
Obfuscate variables? (y/n): y
Obfuscate functions? (y/n): y
Obfuscate classes? (y/n): y
Enter the PHP file path: /home/mrg/www/Test/encode/0/test.php
Error while obfuscating /home/mrg/www/Test/encode/0/test.php: expected str, bytes or os.PathLike object, not list
mrg@mrg-HP:/mnt/My/Home/www/Test/obfuscator/php-obfuscator$ ./start.sh
Welcome to the PHP Obfuscator!
Follow the prompts to obfuscate your PHP files.
Choose the mode for obfuscating your PHP files:
1: Single file
2: Multiple files
3: Entire project directory
Enter the mode number (1/2/3): 3
Enter the output directory path: /home/mrg/www/Test/encode/0/out
Enter file or directory paths to exclude (separated by a space) (you can skip this step):
Create backups of original PHP files? (y/n): y
Choose the obfuscation options:
Obfuscate variables? (y/n): y
Obfuscate functions? (y/n): y
Obfuscate classes? (y/n): y
Enter the project directory path: /home/mrg/www/Test/encode/0
Obfuscating: 0%| | 0/1 [00:00<?, ?file/s]
Error while obfuscating /home/mrg/www/Test/encode/0/test.php: expected str, bytes or os.PathLike object, not list | 0/1 [00:00<?, ?file/s]
Obfuscating: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 875.27file/s]
for my usage it would be great to have the option to obfuscate Classes properties, methods and constants of my project.
f.i. : class method XYZ->doIT is called in script abc and in that script the string-expression of the property should be the same like in the obfuscated class
now i get "file/function/method/property notfound" or i only can use "goto" and string obfuscation
if methodname is changed from XYZ->doIt to XYZ->dontDoThat the script must call $class = XYZ->dontDoThat instead of $class= XYZ->doIt
the behavior with constants and properties should be the same in the projects namespace
Classes/Functions/Constants outside projects namespace should not be changed
Is this possible?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.