python-obfuscation-framework 1.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pof/__init__.py +21 -0
- pof/__main__.py +22 -0
- pof/cli.py +187 -0
- pof/errors.py +2 -0
- pof/evasion/__init__.py +57 -0
- pof/evasion/argv.py +44 -0
- pof/evasion/base.py +48 -0
- pof/evasion/cpu/__init__.py +0 -0
- pof/evasion/cpu/cpu_count.py +27 -0
- pof/evasion/fs/__init__.py +0 -0
- pof/evasion/fs/directory_exist.py +29 -0
- pof/evasion/fs/directory_list_exist.py +46 -0
- pof/evasion/fs/directory_list_missing.py +45 -0
- pof/evasion/fs/directory_missing.py +28 -0
- pof/evasion/fs/exec_method.py +51 -0
- pof/evasion/fs/executable_path.py +66 -0
- pof/evasion/fs/file_exist.py +29 -0
- pof/evasion/fs/file_list_exist.py +46 -0
- pof/evasion/fs/file_list_missing.py +45 -0
- pof/evasion/fs/file_missing.py +31 -0
- pof/evasion/fs/tmp.py +112 -0
- pof/evasion/hardware/__init__.py +0 -0
- pof/evasion/hardware/ram_count.py +50 -0
- pof/evasion/hooks/__init__.py +0 -0
- pof/evasion/hooks/debugger.py +36 -0
- pof/evasion/hooks/tracemalloc.py +23 -0
- pof/evasion/human/__init__.py +0 -0
- pof/evasion/human/p.py +45 -0
- pof/evasion/human/prompt.py +69 -0
- pof/evasion/integrity.py +129 -0
- pof/evasion/multi.py +41 -0
- pof/evasion/os/__init__.py +0 -0
- pof/evasion/os/domain.py +27 -0
- pof/evasion/os/hostname.py +27 -0
- pof/evasion/os/uid.py +28 -0
- pof/evasion/os/username.py +27 -0
- pof/evasion/processes/__init__.py +0 -0
- pof/evasion/processes/proc_count.py +47 -0
- pof/evasion/time/__init__.py +0 -0
- pof/evasion/time/expire.py +75 -0
- pof/evasion/time/uptime.py +48 -0
- pof/evasion/time/utc.py +26 -0
- pof/evasion/utils.py +198 -0
- pof/main.py +369 -0
- pof/obfuscator/__init__.py +86 -0
- pof/obfuscator/builtins.py +482 -0
- pof/obfuscator/cipher/__init__.py +0 -0
- pof/obfuscator/cipher/deep_encryption.py +194 -0
- pof/obfuscator/cipher/rc4.py +22 -0
- pof/obfuscator/cipher/shift.py +19 -0
- pof/obfuscator/cipher/xor.py +121 -0
- pof/obfuscator/compression/__init__.py +0 -0
- pof/obfuscator/compression/bz2.py +22 -0
- pof/obfuscator/compression/gzip.py +22 -0
- pof/obfuscator/compression/lzma.py +22 -0
- pof/obfuscator/compression/zlib.py +22 -0
- pof/obfuscator/constants.py +294 -0
- pof/obfuscator/definitions.py +341 -0
- pof/obfuscator/encoding/__init__.py +0 -0
- pof/obfuscator/encoding/a85.py +21 -0
- pof/obfuscator/encoding/b16.py +21 -0
- pof/obfuscator/encoding/b32.py +21 -0
- pof/obfuscator/encoding/b32hex.py +21 -0
- pof/obfuscator/encoding/b64.py +21 -0
- pof/obfuscator/encoding/b85.py +25 -0
- pof/obfuscator/encoding/binascii.py +22 -0
- pof/obfuscator/encoding/snt.py +23 -0
- pof/obfuscator/esoteric/__init__.py +0 -0
- pof/obfuscator/esoteric/call.py +49 -0
- pof/obfuscator/esoteric/doc.py +237 -0
- pof/obfuscator/esoteric/globals.py +62 -0
- pof/obfuscator/esoteric/imports.py +55 -0
- pof/obfuscator/extract_variables.py +297 -0
- pof/obfuscator/junk/__init__.py +0 -0
- pof/obfuscator/junk/add_comments.py +102 -0
- pof/obfuscator/junk/add_newlines.py +36 -0
- pof/obfuscator/names.py +474 -0
- pof/obfuscator/names_rope.py +375 -0
- pof/obfuscator/numbers.py +271 -0
- pof/obfuscator/other/__init__.py +0 -0
- pof/obfuscator/other/tokens.py +47 -0
- pof/obfuscator/remove/__init__.py +0 -0
- pof/obfuscator/remove/comments.py +36 -0
- pof/obfuscator/remove/exceptions.py +75 -0
- pof/obfuscator/remove/indents.py +28 -0
- pof/obfuscator/remove/loggings.py +120 -0
- pof/obfuscator/remove/loggings_old.py +45 -0
- pof/obfuscator/remove/newline.py +27 -0
- pof/obfuscator/remove/print.py +40 -0
- pof/obfuscator/restructure.py +15 -0
- pof/obfuscator/stegano/__init__.py +0 -0
- pof/obfuscator/stegano/docstrings.py +111 -0
- pof/obfuscator/stegano/ipv6encoding.py +21 -0
- pof/obfuscator/stegano/macencoding.py +21 -0
- pof/obfuscator/stegano/uuidencoding.py +21 -0
- pof/obfuscator/strings.py +359 -0
- pof/stager/__init__.py +17 -0
- pof/stager/cipher/__init__.py +0 -0
- pof/stager/cipher/rc4.py +36 -0
- pof/stager/download.py +80 -0
- pof/stager/image.py +374 -0
- pof/stager/lots/__init__.py +1 -0
- pof/stager/lots/cl1pnet.py +51 -0
- pof/stager/lots/pastebin.py +35 -0
- pof/stager/lots/pasters.py +30 -0
- pof/stager/quine.py +135 -0
- pof/utils/__init__.py +0 -0
- pof/utils/cipher/__init__.py +7 -0
- pof/utils/cipher/rc4.py +407 -0
- pof/utils/cipher/shift.py +41 -0
- pof/utils/compression/__init__.py +11 -0
- pof/utils/compression/bz2.py +38 -0
- pof/utils/compression/gzip.py +38 -0
- pof/utils/compression/lzma.py +38 -0
- pof/utils/compression/zlib.py +38 -0
- pof/utils/encoding/__init__.py +19 -0
- pof/utils/encoding/a85.py +35 -0
- pof/utils/encoding/b16.py +30 -0
- pof/utils/encoding/b3.py +93 -0
- pof/utils/encoding/b32.py +30 -0
- pof/utils/encoding/b32hex.py +30 -0
- pof/utils/encoding/b64.py +30 -0
- pof/utils/encoding/b85.py +35 -0
- pof/utils/encoding/binascii.py +38 -0
- pof/utils/encoding/snt.py +97 -0
- pof/utils/entropy.py +24 -0
- pof/utils/extract_names.py +204 -0
- pof/utils/generator/__init__.py +17 -0
- pof/utils/generator/advanced.py +53 -0
- pof/utils/generator/base.py +178 -0
- pof/utils/generator/basic.py +107 -0
- pof/utils/generator/names.txt +37241 -0
- pof/utils/generator/unicode.py +171 -0
- pof/utils/se/__init__.py +3 -0
- pof/utils/se/homoglyphs.py +99 -0
- pof/utils/se/homoglyphs.txt +96 -0
- pof/utils/stegano/__init__.py +5 -0
- pof/utils/stegano/ipv6encoding.py +97 -0
- pof/utils/stegano/macencoding.py +96 -0
- pof/utils/stegano/uuidencoding.py +102 -0
- pof/utils/tokens.py +68 -0
- python_obfuscation_framework-1.4.1.dist-info/LICENSE +674 -0
- python_obfuscation_framework-1.4.1.dist-info/METADATA +851 -0
- python_obfuscation_framework-1.4.1.dist-info/RECORD +147 -0
- python_obfuscation_framework-1.4.1.dist-info/WHEEL +5 -0
- python_obfuscation_framework-1.4.1.dist-info/entry_points.txt +2 -0
- python_obfuscation_framework-1.4.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# TODO (deoktr): store BUILTINS in another file to share it
|
|
2
|
+
BUILTINS = (
|
|
3
|
+
"__file__",
|
|
4
|
+
"__name__",
|
|
5
|
+
"__doc__",
|
|
6
|
+
"__package__",
|
|
7
|
+
"__loader__",
|
|
8
|
+
"__spec__",
|
|
9
|
+
"__build_class__",
|
|
10
|
+
"__import__",
|
|
11
|
+
"abs",
|
|
12
|
+
"all",
|
|
13
|
+
"any",
|
|
14
|
+
"ascii",
|
|
15
|
+
"bin",
|
|
16
|
+
"breakpoint",
|
|
17
|
+
"callable",
|
|
18
|
+
"chr",
|
|
19
|
+
"compile",
|
|
20
|
+
"delattr",
|
|
21
|
+
"dir",
|
|
22
|
+
"divmod",
|
|
23
|
+
"eval",
|
|
24
|
+
"exec",
|
|
25
|
+
"format",
|
|
26
|
+
"getattr",
|
|
27
|
+
"globals",
|
|
28
|
+
"hasattr",
|
|
29
|
+
"hash",
|
|
30
|
+
"hex",
|
|
31
|
+
"id",
|
|
32
|
+
"input",
|
|
33
|
+
"isinstance",
|
|
34
|
+
"issubclass",
|
|
35
|
+
"iter",
|
|
36
|
+
"aiter",
|
|
37
|
+
"len",
|
|
38
|
+
"locals",
|
|
39
|
+
"max",
|
|
40
|
+
"min",
|
|
41
|
+
"next",
|
|
42
|
+
"anext",
|
|
43
|
+
"oct",
|
|
44
|
+
"ord",
|
|
45
|
+
"pow",
|
|
46
|
+
"print",
|
|
47
|
+
"repr",
|
|
48
|
+
"round",
|
|
49
|
+
"setattr",
|
|
50
|
+
"sorted",
|
|
51
|
+
"sum",
|
|
52
|
+
"vars",
|
|
53
|
+
"None",
|
|
54
|
+
"Ellipsis",
|
|
55
|
+
"NotImplemented",
|
|
56
|
+
"False",
|
|
57
|
+
"True",
|
|
58
|
+
"bool",
|
|
59
|
+
"memoryview",
|
|
60
|
+
"bytearray",
|
|
61
|
+
"bytes",
|
|
62
|
+
"classmethod",
|
|
63
|
+
"complex",
|
|
64
|
+
"dict",
|
|
65
|
+
"enumerate",
|
|
66
|
+
"filter",
|
|
67
|
+
"float",
|
|
68
|
+
"frozenset",
|
|
69
|
+
"property",
|
|
70
|
+
"int",
|
|
71
|
+
"list",
|
|
72
|
+
"map",
|
|
73
|
+
"object",
|
|
74
|
+
"range",
|
|
75
|
+
"reversed",
|
|
76
|
+
"set",
|
|
77
|
+
"slice",
|
|
78
|
+
"staticmethod",
|
|
79
|
+
"str",
|
|
80
|
+
"super",
|
|
81
|
+
"tuple",
|
|
82
|
+
"type",
|
|
83
|
+
"zip",
|
|
84
|
+
"__debug__",
|
|
85
|
+
"BaseException",
|
|
86
|
+
"Exception",
|
|
87
|
+
"TypeError",
|
|
88
|
+
"StopAsyncIteration",
|
|
89
|
+
"StopIteration",
|
|
90
|
+
"GeneratorExit",
|
|
91
|
+
"SystemExit",
|
|
92
|
+
"KeyboardInterrupt",
|
|
93
|
+
"ImportError",
|
|
94
|
+
"ModuleNotFoundError",
|
|
95
|
+
"OSError",
|
|
96
|
+
"EnvironmentError",
|
|
97
|
+
"IOError",
|
|
98
|
+
"EOFError",
|
|
99
|
+
"RuntimeError",
|
|
100
|
+
"RecursionError",
|
|
101
|
+
"NotImplementedError",
|
|
102
|
+
"NameError",
|
|
103
|
+
"UnboundLocalError",
|
|
104
|
+
"AttributeError",
|
|
105
|
+
"SyntaxError",
|
|
106
|
+
"IndentationError",
|
|
107
|
+
"TabError",
|
|
108
|
+
"LookupError",
|
|
109
|
+
"IndexError",
|
|
110
|
+
"KeyError",
|
|
111
|
+
"ValueError",
|
|
112
|
+
"UnicodeError",
|
|
113
|
+
"UnicodeEncodeError",
|
|
114
|
+
"UnicodeDecodeError",
|
|
115
|
+
"UnicodeTranslateError",
|
|
116
|
+
"AssertionError",
|
|
117
|
+
"ArithmeticError",
|
|
118
|
+
"FloatingPointError",
|
|
119
|
+
"OverflowError",
|
|
120
|
+
"ZeroDivisionError",
|
|
121
|
+
"SystemError",
|
|
122
|
+
"ReferenceError",
|
|
123
|
+
"MemoryError",
|
|
124
|
+
"BufferError",
|
|
125
|
+
"Warning",
|
|
126
|
+
"UserWarning",
|
|
127
|
+
"EncodingWarning",
|
|
128
|
+
"DeprecationWarning",
|
|
129
|
+
"PendingDeprecationWarning",
|
|
130
|
+
"SyntaxWarning",
|
|
131
|
+
"RuntimeWarning",
|
|
132
|
+
"FutureWarning",
|
|
133
|
+
"ImportWarning",
|
|
134
|
+
"UnicodeWarning",
|
|
135
|
+
"BytesWarning",
|
|
136
|
+
"ResourceWarning",
|
|
137
|
+
"ConnectionError",
|
|
138
|
+
"BlockingIOError",
|
|
139
|
+
"BrokenPipeError",
|
|
140
|
+
"ChildProcessError",
|
|
141
|
+
"ConnectionAbortedError",
|
|
142
|
+
"ConnectionRefusedError",
|
|
143
|
+
"ConnectionResetError",
|
|
144
|
+
"FileExistsError",
|
|
145
|
+
"FileNotFoundError",
|
|
146
|
+
"IsADirectoryError",
|
|
147
|
+
"NotADirectoryError",
|
|
148
|
+
"InterruptedError",
|
|
149
|
+
"PermissionError",
|
|
150
|
+
"ProcessLookupError",
|
|
151
|
+
"TimeoutError",
|
|
152
|
+
"open",
|
|
153
|
+
"quit",
|
|
154
|
+
"exit",
|
|
155
|
+
"copyright",
|
|
156
|
+
"credits",
|
|
157
|
+
"license",
|
|
158
|
+
"help",
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
RESERVED_WORDS = (
|
|
162
|
+
"__init__",
|
|
163
|
+
"__eq__",
|
|
164
|
+
"__lt__",
|
|
165
|
+
"append", # on list
|
|
166
|
+
"update", # on dict
|
|
167
|
+
"copy", # copy dict or list
|
|
168
|
+
"join", # on string "".join()
|
|
169
|
+
# TODO (deoktr): add all the others
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
class BaseGenerator:
|
|
174
|
+
RESERVED: list[str] = [] # noqa: RUF012
|
|
175
|
+
|
|
176
|
+
@classmethod
|
|
177
|
+
def extend_reserved(cls, extension):
|
|
178
|
+
cls.RESERVED.extend(extension)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""Basic random names generators."""
|
|
2
|
+
|
|
3
|
+
import random
|
|
4
|
+
|
|
5
|
+
from .base import BaseGenerator
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class BasicGenerator(BaseGenerator):
|
|
9
|
+
@classmethod
|
|
10
|
+
def alphabet_generator(
|
|
11
|
+
cls,
|
|
12
|
+
min_length: int = 3,
|
|
13
|
+
max_length: int = 10,
|
|
14
|
+
chars: str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890__",
|
|
15
|
+
first_chars: str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
16
|
+
):
|
|
17
|
+
"""Random words that can be variables."""
|
|
18
|
+
previous = []
|
|
19
|
+
if first_chars is None:
|
|
20
|
+
first_chars = chars
|
|
21
|
+
while True:
|
|
22
|
+
if min_length != max_length:
|
|
23
|
+
length = random.randint(min_length, max_length)
|
|
24
|
+
else:
|
|
25
|
+
length = max_length
|
|
26
|
+
name = random.choice(first_chars)
|
|
27
|
+
for _ in range(length - 1):
|
|
28
|
+
name += random.choice(chars)
|
|
29
|
+
if name in previous or name in cls.RESERVED:
|
|
30
|
+
continue
|
|
31
|
+
previous.append(name)
|
|
32
|
+
yield name
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def number_name_generator(cls, length=1, prefix="_"):
|
|
36
|
+
"""Generator for endless number of variable name."""
|
|
37
|
+
numbers = list(range(10**length, 10 ** (length + 1)))
|
|
38
|
+
while True:
|
|
39
|
+
if len(numbers) == 0:
|
|
40
|
+
length += 1
|
|
41
|
+
numbers = list(range(10**length, 10 ** (length + 1)))
|
|
42
|
+
n = random.choice(numbers)
|
|
43
|
+
numbers.remove(n)
|
|
44
|
+
yield prefix + str(n)
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def single_symbol_generator(cls, symbol="_"):
|
|
48
|
+
# TODO (deoktr): generate a couple in a list, randomize the order and take them
|
|
49
|
+
# instead of increasing it by one in order
|
|
50
|
+
length = 1
|
|
51
|
+
while True:
|
|
52
|
+
length += 1
|
|
53
|
+
yield symbol * length
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def pointer_generator(
|
|
57
|
+
cls,
|
|
58
|
+
name_format="_0x{}",
|
|
59
|
+
length=12,
|
|
60
|
+
chars="0123456789abcdef",
|
|
61
|
+
):
|
|
62
|
+
"""Generate var names in the format of hexadecimal."""
|
|
63
|
+
ag = cls.alphabet_generator(
|
|
64
|
+
min_length=length,
|
|
65
|
+
max_length=length,
|
|
66
|
+
chars=chars,
|
|
67
|
+
first_chars=chars,
|
|
68
|
+
)
|
|
69
|
+
while True:
|
|
70
|
+
name = next(ag)
|
|
71
|
+
yield name_format.format(name)
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def function_generator(
|
|
75
|
+
cls,
|
|
76
|
+
*args,
|
|
77
|
+
**kwargs,
|
|
78
|
+
):
|
|
79
|
+
"""Generate class names."""
|
|
80
|
+
chars: str = "abcdefghijklmnopqrstuvwxyz__"
|
|
81
|
+
first_chars: str = "abcdefghijklmnopqrstuvwxyz"
|
|
82
|
+
ag = cls.alphabet_generator(
|
|
83
|
+
*args,
|
|
84
|
+
chars=chars,
|
|
85
|
+
first_chars=first_chars,
|
|
86
|
+
**kwargs,
|
|
87
|
+
)
|
|
88
|
+
while True:
|
|
89
|
+
yield next(ag)
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def class_generator(
|
|
93
|
+
cls,
|
|
94
|
+
*args,
|
|
95
|
+
**kwargs,
|
|
96
|
+
):
|
|
97
|
+
"""Generate class names."""
|
|
98
|
+
chars: str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
99
|
+
first_chars: str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
100
|
+
ag = cls.alphabet_generator(
|
|
101
|
+
*args,
|
|
102
|
+
chars=chars,
|
|
103
|
+
first_chars=first_chars,
|
|
104
|
+
**kwargs,
|
|
105
|
+
)
|
|
106
|
+
while True:
|
|
107
|
+
yield next(ag)
|