Git Product home page Git Product logo

php-obfuscator's Issues

It doesn't work and return errors

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');

now run this :
image

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]

Option to only obfuscate Classes in Projects namespace

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.