This package implement a python code Obfuscator.
Project description
PyObfuscator
Description
This package implement a python code Obfuscator.
Requirements
This package require :
- python3.9 or greater
- python3.9 or greater Standard Library
Installation
pip install PyObfuscator
Usages
Command line:
PyObfuscator -h # help message
PyObfuscator code.py # easiest command
PyObfuscator -o "obfu.py" -l 6 -n "name1:obfu_name1" "name2:obfu_name2" -n "name3:obfu_name3" -d -w "mypassword" -e "utf-8" -s 8 -p -g 50 -f "logs.log" code.py
Python script
from PyObfuscator import Obfuscator, Name
Obfuscator('code.py').default_obfuscation() # write your obfuscate code in code_obfu.py
Obfuscator(
"code.py",
"obfu.py",
6,
{
"name1": Name("name1", "obfu_name1", False, None),
"name2": Name("name2", "obfu_name2", False, None),
"name3": Name("name3", "obfu_name3", False, None),
},
True,
"mypassword",
"utf-8",
8,
).default_obfuscation()
Python executable:
python3 PyObfuscator.pyz -o "obfu.py" -l 6 -n "name1:obfu_name1" "name2:obfu_name2" -n "name3:obfu_name3" -d -w "mypassword" -e "utf-8" -s 8 -p -g 50 -f "logs.log" code.py
# OR
chmod u+x PyObfuscator.pyz # add execute rights
./PyObfuscator.pyz code.py # execute file
Python module (command line):
python3 -m PyObfuscator -o "obfu.py" -l 6 -n "name1:obfu_name1" "name2:obfu_name2" -n "name3:obfu_name3" -d -w "mypassword" -e "utf-8" -s 8 -p -g 50 -f "logs.log" code.py
python3 -m PyObfuscator.Obfuscator code.py
Tests
cd tests
python3 -m unittest discover
Attributes and super Error
Becareful with attribute name and definition !
Your attributes must be defined as attributes and your attributes functions mustn't have same name than attributes function defined in different files !
With the super
function your must add self.class
and self
as arguments (without consequences).
class Classe:
abc: str = "abc"
class Classe2(Classe):
def __init__(self):
self.abc2: str = "abc"
class Test(Classe2):
def __init__(self, string: str):
#super().__init__() ## THIS LINE RETURN AN ERROR
super(self.__class__, self).__init__() ## this line doesn't return an error
#"self.abc" ## THIS LINE RETURN AN ERROR (because "abc" is not define as attribute, the name will be obfuscate)
self.abc2 ## this line doesn't return an error (because "self.abc2" is defined as attribute)
import module
class Classe:
def __init__(self):
self.attr
def function():
pass
Classe.function() # This line will be obfuscate (this line is safe)
module.function() ## THIS LINE RETURN AN ERROR (because "function" attribute will be obfuscate (only for function attributes))
module.attr # this line is safe (because "attr" is not function)
Links
Licence
Licensed under the GPL, version 3.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PyObfuscator-0.0.1.tar.gz
(24.5 kB
view details)
File details
Details for the file PyObfuscator-0.0.1.tar.gz
.
File metadata
- Download URL: PyObfuscator-0.0.1.tar.gz
- Upload date:
- Size: 24.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abdd6e52e129917bef04d9e1d20e147b1be9ccd71f644db1a20f3bc451be9fc7 |
|
MD5 | d4174e2cb328b7315cf8cffff809dc19 |
|
BLAKE2b-256 | df9c00bfd6635da397a11e2b646e5590070c738aae671dde5c79dee341a9098b |