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.
Files changed (147) hide show
  1. pof/__init__.py +21 -0
  2. pof/__main__.py +22 -0
  3. pof/cli.py +187 -0
  4. pof/errors.py +2 -0
  5. pof/evasion/__init__.py +57 -0
  6. pof/evasion/argv.py +44 -0
  7. pof/evasion/base.py +48 -0
  8. pof/evasion/cpu/__init__.py +0 -0
  9. pof/evasion/cpu/cpu_count.py +27 -0
  10. pof/evasion/fs/__init__.py +0 -0
  11. pof/evasion/fs/directory_exist.py +29 -0
  12. pof/evasion/fs/directory_list_exist.py +46 -0
  13. pof/evasion/fs/directory_list_missing.py +45 -0
  14. pof/evasion/fs/directory_missing.py +28 -0
  15. pof/evasion/fs/exec_method.py +51 -0
  16. pof/evasion/fs/executable_path.py +66 -0
  17. pof/evasion/fs/file_exist.py +29 -0
  18. pof/evasion/fs/file_list_exist.py +46 -0
  19. pof/evasion/fs/file_list_missing.py +45 -0
  20. pof/evasion/fs/file_missing.py +31 -0
  21. pof/evasion/fs/tmp.py +112 -0
  22. pof/evasion/hardware/__init__.py +0 -0
  23. pof/evasion/hardware/ram_count.py +50 -0
  24. pof/evasion/hooks/__init__.py +0 -0
  25. pof/evasion/hooks/debugger.py +36 -0
  26. pof/evasion/hooks/tracemalloc.py +23 -0
  27. pof/evasion/human/__init__.py +0 -0
  28. pof/evasion/human/p.py +45 -0
  29. pof/evasion/human/prompt.py +69 -0
  30. pof/evasion/integrity.py +129 -0
  31. pof/evasion/multi.py +41 -0
  32. pof/evasion/os/__init__.py +0 -0
  33. pof/evasion/os/domain.py +27 -0
  34. pof/evasion/os/hostname.py +27 -0
  35. pof/evasion/os/uid.py +28 -0
  36. pof/evasion/os/username.py +27 -0
  37. pof/evasion/processes/__init__.py +0 -0
  38. pof/evasion/processes/proc_count.py +47 -0
  39. pof/evasion/time/__init__.py +0 -0
  40. pof/evasion/time/expire.py +75 -0
  41. pof/evasion/time/uptime.py +48 -0
  42. pof/evasion/time/utc.py +26 -0
  43. pof/evasion/utils.py +198 -0
  44. pof/main.py +369 -0
  45. pof/obfuscator/__init__.py +86 -0
  46. pof/obfuscator/builtins.py +482 -0
  47. pof/obfuscator/cipher/__init__.py +0 -0
  48. pof/obfuscator/cipher/deep_encryption.py +194 -0
  49. pof/obfuscator/cipher/rc4.py +22 -0
  50. pof/obfuscator/cipher/shift.py +19 -0
  51. pof/obfuscator/cipher/xor.py +121 -0
  52. pof/obfuscator/compression/__init__.py +0 -0
  53. pof/obfuscator/compression/bz2.py +22 -0
  54. pof/obfuscator/compression/gzip.py +22 -0
  55. pof/obfuscator/compression/lzma.py +22 -0
  56. pof/obfuscator/compression/zlib.py +22 -0
  57. pof/obfuscator/constants.py +294 -0
  58. pof/obfuscator/definitions.py +341 -0
  59. pof/obfuscator/encoding/__init__.py +0 -0
  60. pof/obfuscator/encoding/a85.py +21 -0
  61. pof/obfuscator/encoding/b16.py +21 -0
  62. pof/obfuscator/encoding/b32.py +21 -0
  63. pof/obfuscator/encoding/b32hex.py +21 -0
  64. pof/obfuscator/encoding/b64.py +21 -0
  65. pof/obfuscator/encoding/b85.py +25 -0
  66. pof/obfuscator/encoding/binascii.py +22 -0
  67. pof/obfuscator/encoding/snt.py +23 -0
  68. pof/obfuscator/esoteric/__init__.py +0 -0
  69. pof/obfuscator/esoteric/call.py +49 -0
  70. pof/obfuscator/esoteric/doc.py +237 -0
  71. pof/obfuscator/esoteric/globals.py +62 -0
  72. pof/obfuscator/esoteric/imports.py +55 -0
  73. pof/obfuscator/extract_variables.py +297 -0
  74. pof/obfuscator/junk/__init__.py +0 -0
  75. pof/obfuscator/junk/add_comments.py +102 -0
  76. pof/obfuscator/junk/add_newlines.py +36 -0
  77. pof/obfuscator/names.py +474 -0
  78. pof/obfuscator/names_rope.py +375 -0
  79. pof/obfuscator/numbers.py +271 -0
  80. pof/obfuscator/other/__init__.py +0 -0
  81. pof/obfuscator/other/tokens.py +47 -0
  82. pof/obfuscator/remove/__init__.py +0 -0
  83. pof/obfuscator/remove/comments.py +36 -0
  84. pof/obfuscator/remove/exceptions.py +75 -0
  85. pof/obfuscator/remove/indents.py +28 -0
  86. pof/obfuscator/remove/loggings.py +120 -0
  87. pof/obfuscator/remove/loggings_old.py +45 -0
  88. pof/obfuscator/remove/newline.py +27 -0
  89. pof/obfuscator/remove/print.py +40 -0
  90. pof/obfuscator/restructure.py +15 -0
  91. pof/obfuscator/stegano/__init__.py +0 -0
  92. pof/obfuscator/stegano/docstrings.py +111 -0
  93. pof/obfuscator/stegano/ipv6encoding.py +21 -0
  94. pof/obfuscator/stegano/macencoding.py +21 -0
  95. pof/obfuscator/stegano/uuidencoding.py +21 -0
  96. pof/obfuscator/strings.py +359 -0
  97. pof/stager/__init__.py +17 -0
  98. pof/stager/cipher/__init__.py +0 -0
  99. pof/stager/cipher/rc4.py +36 -0
  100. pof/stager/download.py +80 -0
  101. pof/stager/image.py +374 -0
  102. pof/stager/lots/__init__.py +1 -0
  103. pof/stager/lots/cl1pnet.py +51 -0
  104. pof/stager/lots/pastebin.py +35 -0
  105. pof/stager/lots/pasters.py +30 -0
  106. pof/stager/quine.py +135 -0
  107. pof/utils/__init__.py +0 -0
  108. pof/utils/cipher/__init__.py +7 -0
  109. pof/utils/cipher/rc4.py +407 -0
  110. pof/utils/cipher/shift.py +41 -0
  111. pof/utils/compression/__init__.py +11 -0
  112. pof/utils/compression/bz2.py +38 -0
  113. pof/utils/compression/gzip.py +38 -0
  114. pof/utils/compression/lzma.py +38 -0
  115. pof/utils/compression/zlib.py +38 -0
  116. pof/utils/encoding/__init__.py +19 -0
  117. pof/utils/encoding/a85.py +35 -0
  118. pof/utils/encoding/b16.py +30 -0
  119. pof/utils/encoding/b3.py +93 -0
  120. pof/utils/encoding/b32.py +30 -0
  121. pof/utils/encoding/b32hex.py +30 -0
  122. pof/utils/encoding/b64.py +30 -0
  123. pof/utils/encoding/b85.py +35 -0
  124. pof/utils/encoding/binascii.py +38 -0
  125. pof/utils/encoding/snt.py +97 -0
  126. pof/utils/entropy.py +24 -0
  127. pof/utils/extract_names.py +204 -0
  128. pof/utils/generator/__init__.py +17 -0
  129. pof/utils/generator/advanced.py +53 -0
  130. pof/utils/generator/base.py +178 -0
  131. pof/utils/generator/basic.py +107 -0
  132. pof/utils/generator/names.txt +37241 -0
  133. pof/utils/generator/unicode.py +171 -0
  134. pof/utils/se/__init__.py +3 -0
  135. pof/utils/se/homoglyphs.py +99 -0
  136. pof/utils/se/homoglyphs.txt +96 -0
  137. pof/utils/stegano/__init__.py +5 -0
  138. pof/utils/stegano/ipv6encoding.py +97 -0
  139. pof/utils/stegano/macencoding.py +96 -0
  140. pof/utils/stegano/uuidencoding.py +102 -0
  141. pof/utils/tokens.py +68 -0
  142. python_obfuscation_framework-1.4.1.dist-info/LICENSE +674 -0
  143. python_obfuscation_framework-1.4.1.dist-info/METADATA +851 -0
  144. python_obfuscation_framework-1.4.1.dist-info/RECORD +147 -0
  145. python_obfuscation_framework-1.4.1.dist-info/WHEEL +5 -0
  146. python_obfuscation_framework-1.4.1.dist-info/entry_points.txt +2 -0
  147. 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)