powershell-pro-obfuscator 1.0.0__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.
@@ -0,0 +1,236 @@
1
+ #!/usr/bin/env python
2
+
3
+ ###############################################################################
4
+ #
5
+ # PowerShell Pro Obfuscator WebApi interface usage example.
6
+ #
7
+ # In this example we will obfuscate sample source with custom options.
8
+ #
9
+ # Version : v1.0.0
10
+ # Language : Python
11
+ # Author : Bartosz Wójcik
12
+ # Web page : https://www.pelock.com
13
+ #
14
+ ###############################################################################
15
+
16
+ #
17
+ # include PowerShell Pro Obfuscator module
18
+ #
19
+ from powershellproobfuscator import PowerShellProObfuscator
20
+
21
+ #
22
+ # if you don't want to use Python module, you can import directly from the file
23
+ #
24
+ #from pelock.powershellproobfuscator import PowerShellProObfuscator
25
+
26
+ #
27
+ # create PowerShell Pro Obfuscator class instance (we are using our activation key)
28
+ #
29
+ myPowerShellProObfuscator = PowerShellProObfuscator("ABCD-ABCD-ABCD-ABCD")
30
+
31
+ #
32
+ # should the source code be compressed (both input & compressed)
33
+ #
34
+ myPowerShellProObfuscator.enableCompression = False
35
+
36
+ #
37
+ # global obfuscation options
38
+ #
39
+ # you can disable a particular obfuscation strategy globally if it
40
+ # fails or you don't want to use it without modifying the source codes
41
+ #
42
+ # by default all obfuscation strategies are enabled
43
+ #
44
+
45
+ #
46
+ # protection against tampering with protected code (integrity verification)
47
+ #
48
+ myPowerShellProObfuscator.selfDefending = True
49
+
50
+ #
51
+ # protection linker (decoy call graph)
52
+ #
53
+ myPowerShellProObfuscator.protectionLinker = True
54
+
55
+ #
56
+ # rename variable names to random string values
57
+ #
58
+ myPowerShellProObfuscator.renameVariables = True
59
+
60
+ #
61
+ # rename parameter names to random string values
62
+ #
63
+ myPowerShellProObfuscator.renameParameters = True
64
+
65
+ #
66
+ # rename function names to random string values
67
+ #
68
+ myPowerShellProObfuscator.renameFunctions = True
69
+
70
+ #
71
+ # shuffle function order in the output source
72
+ #
73
+ myPowerShellProObfuscator.shuffleFunctions = True
74
+
75
+ #
76
+ # change linear code execution flow via control-flow flattening
77
+ #
78
+ myPowerShellProObfuscator.controlFlowFlatten = True
79
+
80
+ #
81
+ # rewrite statement blocks into finite-state automata (state-machine obfuscation)
82
+ #
83
+ myPowerShellProObfuscator.stateMachine = True
84
+
85
+ #
86
+ # lift selected statements into a VM engine (virtualized statements)
87
+ #
88
+ myPowerShellProObfuscator.vmStrategy = True
89
+
90
+ #
91
+ # encrypt integers
92
+ #
93
+ myPowerShellProObfuscator.encryptIntegers = True
94
+
95
+ #
96
+ # split strings into concatenated chunks
97
+ #
98
+ myPowerShellProObfuscator.splitStrings = True
99
+
100
+ #
101
+ # encrypt strings using randomly generated polymorphic encryption algorithms
102
+ #
103
+ myPowerShellProObfuscator.encryptStrings = True
104
+
105
+ #
106
+ # move integers to arrays
107
+ #
108
+ myPowerShellProObfuscator.integersToArrays = True
109
+
110
+ #
111
+ # move floats to arrays
112
+ #
113
+ myPowerShellProObfuscator.floatsToArrays = True
114
+
115
+ #
116
+ # insert dead code
117
+ #
118
+ myPowerShellProObfuscator.insertDeadCode = True
119
+
120
+ #
121
+ # replace boolean conditions with equivalent complex expressions
122
+ #
123
+ myPowerShellProObfuscator.complexifyBooleans = True
124
+
125
+ #
126
+ # represent integers via floating-point math
127
+ #
128
+ myPowerShellProObfuscator.integersToFloating = True
129
+
130
+ #
131
+ # encrypt floating point numbers
132
+ #
133
+ myPowerShellProObfuscator.encryptFloating = True
134
+
135
+ #
136
+ # insert decoy functions
137
+ #
138
+ myPowerShellProObfuscator.decoyFunctions = True
139
+
140
+ #
141
+ # insert anti-debugging detections
142
+ #
143
+ myPowerShellProObfuscator.detectDebugger = True
144
+
145
+ #
146
+ # insert fake dot-source comment markers
147
+ #
148
+ myPowerShellProObfuscator.fakeDotSourceMarkers = True
149
+
150
+ #
151
+ # insert opaque predicate branches
152
+ #
153
+ myPowerShellProObfuscator.opaqueBranches = True
154
+
155
+ #
156
+ # insert scriptblock decoys
157
+ #
158
+ myPowerShellProObfuscator.scriptblockDecoys = True
159
+
160
+ #
161
+ # insert here-string padding
162
+ #
163
+ myPowerShellProObfuscator.literalPadding = True
164
+
165
+ #
166
+ # use indirect command invocation
167
+ #
168
+ myPowerShellProObfuscator.reflectInvokeCommands = True
169
+
170
+ #
171
+ # store string fragments in char-code array vaults
172
+ #
173
+ myPowerShellProObfuscator.stringCharArrayVault = True
174
+
175
+ #
176
+ # wrap code in try/finally blocks with dead noise
177
+ #
178
+ myPowerShellProObfuscator.tryFinallyNoise = True
179
+
180
+ #
181
+ # apply redundant xor / affine integer masks
182
+ #
183
+ myPowerShellProObfuscator.affineIntegerMask = True
184
+
185
+ #
186
+ # insert dead event/timer stubs
187
+ #
188
+ myPowerShellProObfuscator.eventStub = True
189
+
190
+ #
191
+ # strip comments from the output source
192
+ #
193
+ myPowerShellProObfuscator.removeComments = True
194
+
195
+ #
196
+ # source code in PowerShell format
197
+ #
198
+ scriptSourceCode = """function Get-Greeting {
199
+ param([string]$Name)
200
+ Write-Host "Hello World from $Name!"
201
+ }
202
+ Get-Greeting "PowerShell Pro Obfuscator\""""
203
+
204
+ #
205
+ # by default all obfuscation options are enabled, so we can just simply call
206
+ #
207
+ result = myPowerShellProObfuscator.obfuscate_script_source(scriptSourceCode)
208
+
209
+ #
210
+ # it's also possible to pass a PowerShell script file path instead of a string with the source e.g.
211
+ #
212
+ # result = myPowerShellProObfuscator.obfuscate_script_file("/path/to/project/script.ps1")
213
+
214
+ #
215
+ # result[] array holds the obfuscation results as well as other information
216
+ #
217
+ # result["error"] - error code
218
+ # result["output"] - obfuscated code
219
+ # result["demo"] - was it used in demo mode (invalid or empty activation key was used)
220
+ # result["credits_left"] - usage credits left after this operation
221
+ # result["credits_total"] - total number of credits for this activation code
222
+ # result["expired"] - if this was the last usage credit for the activation key it will be set to True
223
+ #
224
+ if result and "error" in result:
225
+
226
+ # display obfuscated code
227
+ if result["error"] == PowerShellProObfuscator.ERROR_SUCCESS:
228
+
229
+ # format output code for HTML display
230
+ print(result["output"])
231
+
232
+ else:
233
+ print(f'An error occurred, error code: {result["error"]}')
234
+
235
+ else:
236
+ print("Something unexpected happen while trying to obfuscate the code.")
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env python
2
+
3
+ ###############################################################################
4
+ #
5
+ # PowerShell Pro Obfuscator WebApi interface usage example.
6
+ #
7
+ # In this example we will verify our activation key status.
8
+ #
9
+ # Version : v1.0.0
10
+ # Language : Python
11
+ # Author : Bartosz Wójcik
12
+ # Web page : https://www.pelock.com
13
+ #
14
+ ###############################################################################
15
+
16
+ #
17
+ # include PowerShell Pro Obfuscator module
18
+ #
19
+ from powershellproobfuscator import PowerShellProObfuscator
20
+
21
+ #
22
+ # if you don't want to use Python module, you can import directly from the file
23
+ #
24
+ #from pelock.powershellproobfuscator import PowerShellProObfuscator
25
+
26
+ #
27
+ # create PowerShell Pro Obfuscator class instance (we are using our activation key)
28
+ #
29
+ myPowerShellProObfuscator = PowerShellProObfuscator("ABCD-ABCD-ABCD-ABCD")
30
+
31
+ #
32
+ # login to the service
33
+ #
34
+ result = myPowerShellProObfuscator.login()
35
+
36
+ #
37
+ # result[] array holds the information about the license
38
+ #
39
+ # result["demo"] - is it a demo mode (invalid or empty activation key was used)
40
+ # result["credits_left"] - usage credits left after this operation
41
+ # result["credits_total"] - total number of credits for this activation code
42
+ # result["string_limit"] - max. source code size allowed (it's 1000 bytes for demo mode)
43
+ #
44
+ if result:
45
+
46
+ print(f'Demo version status - {"True" if result["demo"] else "False"}')
47
+ print(f'Usage credits left - {result["credits_left"]}')
48
+ print(f'Total usage credits - {result["credits_total"]}')
49
+ print(f'Max. source code size - {result["string_limit"]}')
50
+
51
+ else:
52
+ print("Something unexpected happen while trying to login to the service.")
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env python
2
+
3
+ ###############################################################################
4
+ #
5
+ # PowerShell Pro Obfuscator WebApi interface usage example.
6
+ #
7
+ # In this example we will obfuscate sample source with default options.
8
+ #
9
+ # Version : v1.0.0
10
+ # Language : Python
11
+ # Author : Bartosz Wójcik
12
+ # Web page : https://www.pelock.com
13
+ #
14
+ ###############################################################################
15
+
16
+ #
17
+ # include PowerShell Pro Obfuscator module
18
+ #
19
+ from powershellproobfuscator import PowerShellProObfuscator
20
+
21
+ #
22
+ # if you don't want to use Python module, you can import directly from the file
23
+ #
24
+ #from pelock.powershellproobfuscator import PowerShellProObfuscator
25
+
26
+ #
27
+ # create PowerShell Pro Obfuscator class instance (we are using our activation key)
28
+ #
29
+ myPowerShellProObfuscator = PowerShellProObfuscator("ABCD-ABCD-ABCD-ABCD")
30
+
31
+ #
32
+ # source code in PowerShell format
33
+ #
34
+ scriptSourceCode = """function Get-Greeting {
35
+ param([string]$Name)
36
+ Write-Host "Hello World from $Name!"
37
+ }
38
+ Get-Greeting "PowerShell Pro Obfuscator\""""
39
+
40
+ #
41
+ # by default all obfuscation options are enabled, so we can just simply call
42
+ #
43
+ result = myPowerShellProObfuscator.obfuscate_script_source(scriptSourceCode)
44
+
45
+ #
46
+ # it's also possible to pass a PowerShell script file path instead of a string with the source e.g.
47
+ #
48
+ # result = myPowerShellProObfuscator.obfuscate_script_file("/path/to/project/script.ps1")
49
+
50
+ #
51
+ # result[] array holds the obfuscation results as well as other information
52
+ #
53
+ # result["error"] - error code
54
+ # result["output"] - obfuscated code
55
+ # result["demo"] - was it used in demo mode (invalid or empty activation key was used)
56
+ # result["credits_left"] - usage credits left after this operation
57
+ # result["credits_total"] - total number of credits for this activation code
58
+ # result["expired"] - if this was the last usage credit for the activation key it will be set to True
59
+ #
60
+ if result and "error" in result:
61
+
62
+ # display obfuscated code
63
+ if result["error"] == PowerShellProObfuscator.ERROR_SUCCESS:
64
+
65
+ # format output code for HTML display
66
+ print(result["output"])
67
+
68
+ else:
69
+ print(f'An error occurred, error code: {result["error"]}')
70
+
71
+ else:
72
+ print("Something unexpected happen while trying to obfuscate the code.")