lua-obfuscator 1.0.0
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.
- package/dist/index.d.ts +14 -0
- package/dist/index.js +58 -0
- package/dist/prometheus/LICENSE +661 -0
- package/dist/prometheus/benchmark.lua +34 -0
- package/dist/prometheus/build.bat +10 -0
- package/dist/prometheus/cli.lua +12 -0
- package/dist/prometheus/doc/README.md +11 -0
- package/dist/prometheus/doc/SUMMARY.md +27 -0
- package/dist/prometheus/doc/advanced/using-prometheus-in-your-lua-application.md +31 -0
- package/dist/prometheus/doc/getting-started/command-line-options.md +13 -0
- package/dist/prometheus/doc/getting-started/installation.md +11 -0
- package/dist/prometheus/doc/getting-started/obfuscating-your-first-script.md +50 -0
- package/dist/prometheus/doc/getting-started/presets.md +10 -0
- package/dist/prometheus/doc/getting-started/the-config-object.md +58 -0
- package/dist/prometheus/doc/getting-started/writing-a-custom-config-file.md +56 -0
- package/dist/prometheus/doc/steps/anti-tamper.md +11 -0
- package/dist/prometheus/doc/steps/constantarray.md +71 -0
- package/dist/prometheus/doc/steps/encryptstrings.md +86 -0
- package/dist/prometheus/doc/steps/proxifylocals.md +47 -0
- package/dist/prometheus/doc/steps/splitstrings.md +40 -0
- package/dist/prometheus/doc/steps/vmify.md +9 -0
- package/dist/prometheus/doc/steps/wrapinfunction.md +29 -0
- package/dist/prometheus/prometheus-main.lua +1 -0
- package/dist/prometheus/readme.md +57 -0
- package/dist/prometheus/readme.txt +5 -0
- package/dist/prometheus/src/cli.lua +154 -0
- package/dist/prometheus/src/colors.lua +61 -0
- package/dist/prometheus/src/config.lua +35 -0
- package/dist/prometheus/src/highlightlua.lua +61 -0
- package/dist/prometheus/src/logger.lua +62 -0
- package/dist/prometheus/src/presets.lua +174 -0
- package/dist/prometheus/src/prometheus/ast.lua +792 -0
- package/dist/prometheus/src/prometheus/bit.lua +521 -0
- package/dist/prometheus/src/prometheus/compiler/compiler.lua +2365 -0
- package/dist/prometheus/src/prometheus/enums.lua +106 -0
- package/dist/prometheus/src/prometheus/namegenerators/Il.lua +41 -0
- package/dist/prometheus/src/prometheus/namegenerators/confuse.lua +169 -0
- package/dist/prometheus/src/prometheus/namegenerators/mangled.lua +26 -0
- package/dist/prometheus/src/prometheus/namegenerators/mangled_shuffled.lua +35 -0
- package/dist/prometheus/src/prometheus/namegenerators/number.lua +11 -0
- package/dist/prometheus/src/prometheus/namegenerators.lua +7 -0
- package/dist/prometheus/src/prometheus/parser.lua +969 -0
- package/dist/prometheus/src/prometheus/pipeline.lua +250 -0
- package/dist/prometheus/src/prometheus/randomLiterals.lua +41 -0
- package/dist/prometheus/src/prometheus/randomStrings.lua +24 -0
- package/dist/prometheus/src/prometheus/scope.lua +332 -0
- package/dist/prometheus/src/prometheus/step.lua +79 -0
- package/dist/prometheus/src/prometheus/steps/AddVararg.lua +33 -0
- package/dist/prometheus/src/prometheus/steps/AntiTamper.lua +194 -0
- package/dist/prometheus/src/prometheus/steps/ConstantArray.lua +521 -0
- package/dist/prometheus/src/prometheus/steps/EncryptStrings.lua +239 -0
- package/dist/prometheus/src/prometheus/steps/NumbersToExpressions.lua +82 -0
- package/dist/prometheus/src/prometheus/steps/ProxifyLocals.lua +313 -0
- package/dist/prometheus/src/prometheus/steps/SplitStrings.lua +338 -0
- package/dist/prometheus/src/prometheus/steps/Vmify.lua +30 -0
- package/dist/prometheus/src/prometheus/steps/Watermark.lua +61 -0
- package/dist/prometheus/src/prometheus/steps/WatermarkCheck.lua +50 -0
- package/dist/prometheus/src/prometheus/steps/WrapInFunction.lua +45 -0
- package/dist/prometheus/src/prometheus/steps.lua +12 -0
- package/dist/prometheus/src/prometheus/tokenizer.lua +546 -0
- package/dist/prometheus/src/prometheus/unparser.lua +866 -0
- package/dist/prometheus/src/prometheus/util.lua +297 -0
- package/dist/prometheus/src/prometheus/visitast.lua +245 -0
- package/dist/prometheus/src/prometheus.lua +71 -0
- package/dist/prometheus/tests/closures.lua +12 -0
- package/dist/prometheus/tests/fibonacci.lua +10 -0
- package/dist/prometheus/tests/loops.lua +8 -0
- package/dist/prometheus/tests/primes.lua +18 -0
- package/dist/prometheus/tests.lua +149 -0
- package/package.json +25 -0
- package/src/index.ts +76 -0
- package/src/prometheus/.editorconfig +4 -0
- package/src/prometheus/.gitattributes +2 -0
- package/src/prometheus/.gitbook.yaml +1 -0
- package/src/prometheus/.github/ISSUE_TEMPLATE/bug_report.md +25 -0
- package/src/prometheus/.github/workflows/Build.yml +49 -0
- package/src/prometheus/.github/workflows/Test.yml +19 -0
- package/src/prometheus/LICENSE +661 -0
- package/src/prometheus/benchmark.lua +34 -0
- package/src/prometheus/build.bat +10 -0
- package/src/prometheus/cli.lua +12 -0
- package/src/prometheus/doc/README.md +11 -0
- package/src/prometheus/doc/SUMMARY.md +27 -0
- package/src/prometheus/doc/advanced/using-prometheus-in-your-lua-application.md +31 -0
- package/src/prometheus/doc/getting-started/command-line-options.md +13 -0
- package/src/prometheus/doc/getting-started/installation.md +11 -0
- package/src/prometheus/doc/getting-started/obfuscating-your-first-script.md +50 -0
- package/src/prometheus/doc/getting-started/presets.md +10 -0
- package/src/prometheus/doc/getting-started/the-config-object.md +58 -0
- package/src/prometheus/doc/getting-started/writing-a-custom-config-file.md +56 -0
- package/src/prometheus/doc/steps/anti-tamper.md +11 -0
- package/src/prometheus/doc/steps/constantarray.md +71 -0
- package/src/prometheus/doc/steps/encryptstrings.md +86 -0
- package/src/prometheus/doc/steps/proxifylocals.md +47 -0
- package/src/prometheus/doc/steps/splitstrings.md +40 -0
- package/src/prometheus/doc/steps/vmify.md +9 -0
- package/src/prometheus/doc/steps/wrapinfunction.md +29 -0
- package/src/prometheus/prometheus-main.lua +1 -0
- package/src/prometheus/readme.md +57 -0
- package/src/prometheus/readme.txt +5 -0
- package/src/prometheus/src/cli.lua +154 -0
- package/src/prometheus/src/colors.lua +61 -0
- package/src/prometheus/src/highlightlua.lua +61 -0
- package/src/prometheus/src/logger.lua +62 -0
- package/src/prometheus/src/presets.lua +174 -0
- package/src/prometheus/src/prometheus/ast.lua +792 -0
- package/src/prometheus/src/prometheus/bit.lua +521 -0
- package/src/prometheus/src/prometheus/compiler/compiler.lua +2365 -0
- package/src/prometheus/src/prometheus/enums.lua +106 -0
- package/src/prometheus/src/prometheus/namegenerators/Il.lua +41 -0
- package/src/prometheus/src/prometheus/namegenerators/confuse.lua +169 -0
- package/src/prometheus/src/prometheus/namegenerators/mangled.lua +26 -0
- package/src/prometheus/src/prometheus/namegenerators/mangled_shuffled.lua +35 -0
- package/src/prometheus/src/prometheus/namegenerators/number.lua +11 -0
- package/src/prometheus/src/prometheus/namegenerators.lua +7 -0
- package/src/prometheus/src/prometheus/parser.lua +969 -0
- package/src/prometheus/src/prometheus/pipeline.lua +250 -0
- package/src/prometheus/src/prometheus/randomLiterals.lua +41 -0
- package/src/prometheus/src/prometheus/randomStrings.lua +24 -0
- package/src/prometheus/src/prometheus/scope.lua +332 -0
- package/src/prometheus/src/prometheus/step.lua +79 -0
- package/src/prometheus/src/prometheus/steps/AddVararg.lua +33 -0
- package/src/prometheus/src/prometheus/steps/AntiTamper.lua +194 -0
- package/src/prometheus/src/prometheus/steps/ConstantArray.lua +521 -0
- package/src/prometheus/src/prometheus/steps/EncryptStrings.lua +239 -0
- package/src/prometheus/src/prometheus/steps/NumbersToExpressions.lua +82 -0
- package/src/prometheus/src/prometheus/steps/ProxifyLocals.lua +313 -0
- package/src/prometheus/src/prometheus/steps/SplitStrings.lua +338 -0
- package/src/prometheus/src/prometheus/steps/Vmify.lua +30 -0
- package/src/prometheus/src/prometheus/steps/Watermark.lua +61 -0
- package/src/prometheus/src/prometheus/steps/WatermarkCheck.lua +50 -0
- package/src/prometheus/src/prometheus/steps/WrapInFunction.lua +45 -0
- package/src/prometheus/src/prometheus/steps.lua +12 -0
- package/src/prometheus/src/prometheus/tokenizer.lua +546 -0
- package/src/prometheus/src/prometheus/unparser.lua +866 -0
- package/src/prometheus/src/prometheus/util.lua +297 -0
- package/src/prometheus/src/prometheus/visitast.lua +245 -0
- package/src/prometheus/src/prometheus.lua +71 -0
- package/src/prometheus/tests/closures.lua +12 -0
- package/src/prometheus/tests/fibonacci.lua +10 -0
- package/src/prometheus/tests/loops.lua +8 -0
- package/src/prometheus/tests/primes.lua +18 -0
- package/src/prometheus/tests.lua +149 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
-- This Script is Part of the Prometheus Obfuscator by Levno_710
|
|
2
|
+
--
|
|
3
|
+
-- SplitStrings.lua
|
|
4
|
+
--
|
|
5
|
+
-- This Script provides a Simple Obfuscation Step for splitting Strings
|
|
6
|
+
|
|
7
|
+
local Step = require("prometheus.step");
|
|
8
|
+
local Ast = require("prometheus.ast");
|
|
9
|
+
local visitAst = require("prometheus.visitast");
|
|
10
|
+
local Parser = require("prometheus.parser");
|
|
11
|
+
local util = require("prometheus.util");
|
|
12
|
+
local enums = require("prometheus.enums")
|
|
13
|
+
|
|
14
|
+
local LuaVersion = enums.LuaVersion;
|
|
15
|
+
|
|
16
|
+
local SplitStrings = Step:extend();
|
|
17
|
+
SplitStrings.Description = "This Step splits Strings to a specific or random length";
|
|
18
|
+
SplitStrings.Name = "Split Strings";
|
|
19
|
+
|
|
20
|
+
SplitStrings.SettingsDescriptor = {
|
|
21
|
+
Treshold = {
|
|
22
|
+
name = "Treshold",
|
|
23
|
+
description = "The relative amount of nodes that will be affected",
|
|
24
|
+
type = "number",
|
|
25
|
+
default = 1,
|
|
26
|
+
min = 0,
|
|
27
|
+
max = 1,
|
|
28
|
+
},
|
|
29
|
+
MinLength = {
|
|
30
|
+
name = "MinLength",
|
|
31
|
+
description = "The minimal length for the chunks in that the Strings are splitted",
|
|
32
|
+
type = "number",
|
|
33
|
+
default = 5,
|
|
34
|
+
min = 1,
|
|
35
|
+
max = nil,
|
|
36
|
+
},
|
|
37
|
+
MaxLength = {
|
|
38
|
+
name = "MaxLength",
|
|
39
|
+
description = "The maximal length for the chunks in that the Strings are splitted",
|
|
40
|
+
type = "number",
|
|
41
|
+
default = 5,
|
|
42
|
+
min = 1,
|
|
43
|
+
max = nil,
|
|
44
|
+
},
|
|
45
|
+
ConcatenationType = {
|
|
46
|
+
name = "ConcatenationType",
|
|
47
|
+
description = "The Functions used for Concatenation. Note that when using custom, the String Array will also be Shuffled",
|
|
48
|
+
type = "enum",
|
|
49
|
+
values = {
|
|
50
|
+
"strcat",
|
|
51
|
+
"table",
|
|
52
|
+
"custom",
|
|
53
|
+
},
|
|
54
|
+
default = "custom",
|
|
55
|
+
},
|
|
56
|
+
CustomFunctionType = {
|
|
57
|
+
name = "CustomFunctionType",
|
|
58
|
+
description = "The Type of Function code injection This Option only applies when custom Concatenation is selected.\
|
|
59
|
+
Note that when chosing inline, the code size may increase significantly!",
|
|
60
|
+
type = "enum",
|
|
61
|
+
values = {
|
|
62
|
+
"global",
|
|
63
|
+
"local",
|
|
64
|
+
"inline",
|
|
65
|
+
},
|
|
66
|
+
default = "global",
|
|
67
|
+
},
|
|
68
|
+
CustomLocalFunctionsCount = {
|
|
69
|
+
name = "CustomLocalFunctionsCount",
|
|
70
|
+
description = "The number of local functions per scope. This option only applies when CustomFunctionType = local",
|
|
71
|
+
type = "number",
|
|
72
|
+
default = 2,
|
|
73
|
+
min = 1,
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function SplitStrings:init(settings) end
|
|
78
|
+
|
|
79
|
+
local function generateTableConcatNode(chunks, data)
|
|
80
|
+
local chunkNodes = {};
|
|
81
|
+
for i, chunk in ipairs(chunks) do
|
|
82
|
+
table.insert(chunkNodes, Ast.TableEntry(Ast.StringExpression(chunk)));
|
|
83
|
+
end
|
|
84
|
+
local tb = Ast.TableConstructorExpression(chunkNodes);
|
|
85
|
+
data.scope:addReferenceToHigherScope(data.tableConcatScope, data.tableConcatId);
|
|
86
|
+
return Ast.FunctionCallExpression(Ast.VariableExpression(data.tableConcatScope, data.tableConcatId), {tb});
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
local function generateStrCatNode(chunks)
|
|
90
|
+
-- Put Together Expression for Concatenating String
|
|
91
|
+
local generatedNode = nil;
|
|
92
|
+
for i, chunk in ipairs(chunks) do
|
|
93
|
+
if generatedNode then
|
|
94
|
+
generatedNode = Ast.StrCatExpression(generatedNode, Ast.StringExpression(chunk));
|
|
95
|
+
else
|
|
96
|
+
generatedNode = Ast.StringExpression(chunk);
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
return generatedNode
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
local customVariants = 2;
|
|
103
|
+
local custom1Code = [=[
|
|
104
|
+
function custom(table)
|
|
105
|
+
local stringTable, str = table[#table], "";
|
|
106
|
+
for i=1,#stringTable, 1 do
|
|
107
|
+
str = str .. stringTable[table[i]];
|
|
108
|
+
end
|
|
109
|
+
return str
|
|
110
|
+
end
|
|
111
|
+
]=];
|
|
112
|
+
|
|
113
|
+
local custom2Code = [=[
|
|
114
|
+
function custom(tb)
|
|
115
|
+
local str = "";
|
|
116
|
+
for i=1, #tb / 2, 1 do
|
|
117
|
+
str = str .. tb[#tb / 2 + tb[i]];
|
|
118
|
+
end
|
|
119
|
+
return str
|
|
120
|
+
end
|
|
121
|
+
]=];
|
|
122
|
+
|
|
123
|
+
local function generateCustomNodeArgs(chunks, data, variant)
|
|
124
|
+
local shuffled = {};
|
|
125
|
+
local shuffledIndices = {};
|
|
126
|
+
for i = 1, #chunks, 1 do
|
|
127
|
+
shuffledIndices[i] = i;
|
|
128
|
+
end
|
|
129
|
+
util.shuffle(shuffledIndices);
|
|
130
|
+
|
|
131
|
+
for i, v in ipairs(shuffledIndices) do
|
|
132
|
+
shuffled[v] = chunks[i];
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
-- Custom Function Type 1
|
|
136
|
+
if variant == 1 then
|
|
137
|
+
local args = {};
|
|
138
|
+
local tbNodes = {};
|
|
139
|
+
|
|
140
|
+
for i, v in ipairs(shuffledIndices) do
|
|
141
|
+
table.insert(args, Ast.TableEntry(Ast.NumberExpression(v)));
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
for i, chunk in ipairs(shuffled) do
|
|
145
|
+
table.insert(tbNodes, Ast.TableEntry(Ast.StringExpression(chunk)));
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
local tb = Ast.TableConstructorExpression(tbNodes);
|
|
149
|
+
|
|
150
|
+
table.insert(args, Ast.TableEntry(tb));
|
|
151
|
+
return {Ast.TableConstructorExpression(args)};
|
|
152
|
+
|
|
153
|
+
-- Custom Function Type 2
|
|
154
|
+
else
|
|
155
|
+
|
|
156
|
+
local args = {};
|
|
157
|
+
for i, v in ipairs(shuffledIndices) do
|
|
158
|
+
table.insert(args, Ast.TableEntry(Ast.NumberExpression(v)));
|
|
159
|
+
end
|
|
160
|
+
for i, chunk in ipairs(shuffled) do
|
|
161
|
+
table.insert(args, Ast.TableEntry(Ast.StringExpression(chunk)));
|
|
162
|
+
end
|
|
163
|
+
return {Ast.TableConstructorExpression(args)};
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
local function generateCustomFunctionLiteral(parentScope, variant)
|
|
169
|
+
local parser = Parser:new({
|
|
170
|
+
LuaVersion = LuaVersion.Lua52;
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
-- Custom Function Type 1
|
|
174
|
+
if variant == 1 then
|
|
175
|
+
local funcDeclNode = parser:parse(custom1Code).body.statements[1];
|
|
176
|
+
local funcBody = funcDeclNode.body;
|
|
177
|
+
local funcArgs = funcDeclNode.args;
|
|
178
|
+
funcBody.scope:setParent(parentScope);
|
|
179
|
+
return Ast.FunctionLiteralExpression(funcArgs, funcBody);
|
|
180
|
+
|
|
181
|
+
-- Custom Function Type 2
|
|
182
|
+
else
|
|
183
|
+
local funcDeclNode = parser:parse(custom2Code).body.statements[1];
|
|
184
|
+
local funcBody = funcDeclNode.body;
|
|
185
|
+
local funcArgs = funcDeclNode.args;
|
|
186
|
+
funcBody.scope:setParent(parentScope);
|
|
187
|
+
return Ast.FunctionLiteralExpression(funcArgs, funcBody);
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
local function generateGlobalCustomFunctionDeclaration(ast, data)
|
|
192
|
+
local parser = Parser:new({
|
|
193
|
+
LuaVersion = LuaVersion.Lua52;
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
-- Custom Function Type 1
|
|
197
|
+
if data.customFunctionVariant == 1 then
|
|
198
|
+
local astScope = ast.body.scope;
|
|
199
|
+
local funcDeclNode = parser:parse(custom1Code).body.statements[1];
|
|
200
|
+
local funcBody = funcDeclNode.body;
|
|
201
|
+
local funcArgs = funcDeclNode.args;
|
|
202
|
+
funcBody.scope:setParent(astScope);
|
|
203
|
+
return Ast.LocalVariableDeclaration(astScope, {data.customFuncId},
|
|
204
|
+
{Ast.FunctionLiteralExpression(funcArgs, funcBody)});
|
|
205
|
+
-- Custom Function Type 2
|
|
206
|
+
else
|
|
207
|
+
local astScope = ast.body.scope;
|
|
208
|
+
local funcDeclNode = parser:parse(custom2Code).body.statements[1];
|
|
209
|
+
local funcBody = funcDeclNode.body;
|
|
210
|
+
local funcArgs = funcDeclNode.args;
|
|
211
|
+
funcBody.scope:setParent(astScope);
|
|
212
|
+
return Ast.LocalVariableDeclaration(data.customFuncScope, {data.customFuncId},
|
|
213
|
+
{Ast.FunctionLiteralExpression(funcArgs, funcBody)});
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
function SplitStrings:variant()
|
|
218
|
+
return math.random(1, customVariants);
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
function SplitStrings:apply(ast, pipeline)
|
|
222
|
+
local data = {};
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
if(self.ConcatenationType == "table") then
|
|
226
|
+
local scope = ast.body.scope;
|
|
227
|
+
local id = scope:addVariable();
|
|
228
|
+
data.tableConcatScope = scope;
|
|
229
|
+
data.tableConcatId = id;
|
|
230
|
+
elseif(self.ConcatenationType == "custom") then
|
|
231
|
+
data.customFunctionType = self.CustomFunctionType;
|
|
232
|
+
if data.customFunctionType == "global" then
|
|
233
|
+
local scope = ast.body.scope;
|
|
234
|
+
local id = scope:addVariable();
|
|
235
|
+
data.customFuncScope = scope;
|
|
236
|
+
data.customFuncId = id;
|
|
237
|
+
data.customFunctionVariant = self:variant();
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
local customLocalFunctionsCount = self.CustomLocalFunctionsCount;
|
|
243
|
+
local self2 = self;
|
|
244
|
+
|
|
245
|
+
visitAst(ast, function(node, data)
|
|
246
|
+
-- Previsit Function
|
|
247
|
+
|
|
248
|
+
-- Create Local Function declarations
|
|
249
|
+
if(self.ConcatenationType == "custom" and data.customFunctionType == "local" and node.kind == Ast.AstKind.Block and node.isFunctionBlock) then
|
|
250
|
+
data.functionData.localFunctions = {};
|
|
251
|
+
for i = 1, customLocalFunctionsCount, 1 do
|
|
252
|
+
local scope = data.scope;
|
|
253
|
+
local id = scope:addVariable();
|
|
254
|
+
local variant = self:variant();
|
|
255
|
+
table.insert(data.functionData.localFunctions, {
|
|
256
|
+
scope = scope,
|
|
257
|
+
id = id,
|
|
258
|
+
variant = variant,
|
|
259
|
+
used = false,
|
|
260
|
+
});
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
end, function(node, data)
|
|
265
|
+
-- PostVisit Function
|
|
266
|
+
|
|
267
|
+
-- Create actual function literals for local customFunctionType
|
|
268
|
+
if(self.ConcatenationType == "custom" and data.customFunctionType == "local" and node.kind == Ast.AstKind.Block and node.isFunctionBlock) then
|
|
269
|
+
for i, func in ipairs(data.functionData.localFunctions) do
|
|
270
|
+
if func.used then
|
|
271
|
+
local literal = generateCustomFunctionLiteral(func.scope, func.variant);
|
|
272
|
+
table.insert(node.statements, 1, Ast.LocalVariableDeclaration(func.scope, {func.id}, {literal}));
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
-- Apply Only to String nodes
|
|
279
|
+
if(node.kind == Ast.AstKind.StringExpression) then
|
|
280
|
+
local str = node.value;
|
|
281
|
+
local chunks = {};
|
|
282
|
+
local i = 1;
|
|
283
|
+
|
|
284
|
+
-- Split String into Parts of length between MinLength and MaxLength
|
|
285
|
+
while i <= string.len(str) do
|
|
286
|
+
local len = math.random(self.MinLength, self.MaxLength);
|
|
287
|
+
table.insert(chunks, string.sub(str, i, i + len - 1));
|
|
288
|
+
i = i + len;
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
if(#chunks > 1) then
|
|
292
|
+
if math.random() < self.Treshold then
|
|
293
|
+
if self.ConcatenationType == "strcat" then
|
|
294
|
+
node = generateStrCatNode(chunks);
|
|
295
|
+
elseif self.ConcatenationType == "table" then
|
|
296
|
+
node = generateTableConcatNode(chunks, data);
|
|
297
|
+
elseif self.ConcatenationType == "custom" then
|
|
298
|
+
if self.CustomFunctionType == "global" then
|
|
299
|
+
local args = generateCustomNodeArgs(chunks, data, data.customFunctionVariant);
|
|
300
|
+
-- Add Reference for Variable Renaming
|
|
301
|
+
data.scope:addReferenceToHigherScope(data.customFuncScope, data.customFuncId);
|
|
302
|
+
node = Ast.FunctionCallExpression(Ast.VariableExpression(data.customFuncScope, data.customFuncId), args);
|
|
303
|
+
elseif self.CustomFunctionType == "local" then
|
|
304
|
+
local lfuncs = data.functionData.localFunctions;
|
|
305
|
+
local idx = math.random(1, #lfuncs);
|
|
306
|
+
local func = lfuncs[idx];
|
|
307
|
+
local args = generateCustomNodeArgs(chunks, data, func.variant);
|
|
308
|
+
func.used = true;
|
|
309
|
+
-- Add Reference for Variable Renaming
|
|
310
|
+
data.scope:addReferenceToHigherScope(func.scope, func.id);
|
|
311
|
+
node = Ast.FunctionCallExpression(Ast.VariableExpression(func.scope, func.id), args);
|
|
312
|
+
elseif self.CustomFunctionType == "inline" then
|
|
313
|
+
local variant = self:variant();
|
|
314
|
+
local args = generateCustomNodeArgs(chunks, data, variant);
|
|
315
|
+
local literal = generateCustomFunctionLiteral(data.scope, variant);
|
|
316
|
+
node = Ast.FunctionCallExpression(literal, args);
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
return node, true;
|
|
323
|
+
end
|
|
324
|
+
end, data)
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
if(self.ConcatenationType == "table") then
|
|
328
|
+
local globalScope = data.globalScope;
|
|
329
|
+
local tableScope, tableId = globalScope:resolve("table")
|
|
330
|
+
ast.body.scope:addReferenceToHigherScope(globalScope, tableId);
|
|
331
|
+
table.insert(ast.body.statements, 1, Ast.LocalVariableDeclaration(data.tableConcatScope, {data.tableConcatId},
|
|
332
|
+
{Ast.IndexExpression(Ast.VariableExpression(tableScope, tableId), Ast.StringExpression("concat"))}));
|
|
333
|
+
elseif(self.ConcatenationType == "custom" and self.CustomFunctionType == "global") then
|
|
334
|
+
table.insert(ast.body.statements, 1, generateGlobalCustomFunctionDeclaration(ast, data));
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
return SplitStrings;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
-- This Script is Part of the Prometheus Obfuscator by Levno_710
|
|
2
|
+
--
|
|
3
|
+
-- Vmify.lua
|
|
4
|
+
--
|
|
5
|
+
-- This Script provides a Complex Obfuscation Step that will compile the entire Script to a fully custom bytecode that does not share it's instructions
|
|
6
|
+
-- with lua, making it much harder to crack than other lua obfuscators
|
|
7
|
+
|
|
8
|
+
local Step = require("prometheus.step");
|
|
9
|
+
local Compiler = require("prometheus.compiler.compiler");
|
|
10
|
+
|
|
11
|
+
local Vmify = Step:extend();
|
|
12
|
+
Vmify.Description = "This Step will Compile your script into a fully-custom (not a half custom like other lua obfuscators) Bytecode Format and emit a vm for executing it.";
|
|
13
|
+
Vmify.Name = "Vmify";
|
|
14
|
+
|
|
15
|
+
Vmify.SettingsDescriptor = {
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function Vmify:init(settings)
|
|
19
|
+
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
function Vmify:apply(ast)
|
|
23
|
+
-- Create Compiler
|
|
24
|
+
local compiler = Compiler:new();
|
|
25
|
+
|
|
26
|
+
-- Compile the Script into a bytecode vm
|
|
27
|
+
return compiler:compile(ast);
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
return Vmify;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
-- This Script is Part of the Prometheus Obfuscator by Levno_710
|
|
2
|
+
--
|
|
3
|
+
-- Watermark.lua
|
|
4
|
+
--
|
|
5
|
+
-- This Script provides a Step that will add a watermark to the script
|
|
6
|
+
|
|
7
|
+
local Step = require("prometheus.step");
|
|
8
|
+
local Ast = require("prometheus.ast");
|
|
9
|
+
local Scope = require("prometheus.scope");
|
|
10
|
+
|
|
11
|
+
local Watermark = Step:extend();
|
|
12
|
+
Watermark.Description = "This Step will add a watermark to the script";
|
|
13
|
+
Watermark.Name = "Watermark";
|
|
14
|
+
|
|
15
|
+
Watermark.SettingsDescriptor = {
|
|
16
|
+
Content = {
|
|
17
|
+
name = "Content",
|
|
18
|
+
description = "The Content of the Watermark",
|
|
19
|
+
type = "string",
|
|
20
|
+
default = "This Script is Part of the Prometheus Obfuscator by Levno_710",
|
|
21
|
+
},
|
|
22
|
+
CustomVariable = {
|
|
23
|
+
name = "Custom Variable",
|
|
24
|
+
description = "The Variable that will be used for the Watermark",
|
|
25
|
+
type = "string",
|
|
26
|
+
default = "_WATERMARK",
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function Watermark:init(settings)
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
function Watermark:apply(ast)
|
|
35
|
+
local body = ast.body;
|
|
36
|
+
if string.len(self.Content) > 0 then
|
|
37
|
+
local scope, variable = ast.globalScope:resolve(self.CustomVariable);
|
|
38
|
+
local watermark = Ast.AssignmentVariable(ast.globalScope, variable);
|
|
39
|
+
|
|
40
|
+
local functionScope = Scope:new(body.scope);
|
|
41
|
+
functionScope:addReferenceToHigherScope(ast.globalScope, variable);
|
|
42
|
+
|
|
43
|
+
local arg = functionScope:addVariable();
|
|
44
|
+
local statement = Ast.PassSelfFunctionCallStatement(Ast.StringExpression(self.Content), "gsub", {
|
|
45
|
+
Ast.StringExpression(".+"),
|
|
46
|
+
Ast.FunctionLiteralExpression({
|
|
47
|
+
Ast.VariableExpression(functionScope, arg)
|
|
48
|
+
}, Ast.Block({
|
|
49
|
+
Ast.AssignmentStatement({
|
|
50
|
+
watermark
|
|
51
|
+
}, {
|
|
52
|
+
Ast.VariableExpression(functionScope, arg)
|
|
53
|
+
})
|
|
54
|
+
}, functionScope))
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
table.insert(ast.body.statements, 1, statement)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
return Watermark;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
-- This Script is Part of the Prometheus Obfuscator by Levno_710
|
|
2
|
+
--
|
|
3
|
+
-- WatermarkCheck.lua
|
|
4
|
+
--
|
|
5
|
+
-- This Script provides a Step that will add a watermark to the script
|
|
6
|
+
|
|
7
|
+
local Step = require("prometheus.step");
|
|
8
|
+
local Ast = require("prometheus.ast");
|
|
9
|
+
local Scope = require("prometheus.scope");
|
|
10
|
+
local Watermark = require("prometheus.steps.Watermark");
|
|
11
|
+
|
|
12
|
+
local WatermarkCheck = Step:extend();
|
|
13
|
+
WatermarkCheck.Description = "This Step will add a watermark to the script";
|
|
14
|
+
WatermarkCheck.Name = "WatermarkCheck";
|
|
15
|
+
|
|
16
|
+
WatermarkCheck.SettingsDescriptor = {
|
|
17
|
+
Content = {
|
|
18
|
+
name = "Content",
|
|
19
|
+
description = "The Content of the WatermarkCheck",
|
|
20
|
+
type = "string",
|
|
21
|
+
default = "This Script is Part of the Prometheus Obfuscator by Levno_710",
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
local function callNameGenerator(generatorFunction, ...)
|
|
26
|
+
if(type(generatorFunction) == "table") then
|
|
27
|
+
generatorFunction = generatorFunction.generateName;
|
|
28
|
+
end
|
|
29
|
+
return generatorFunction(...);
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
function WatermarkCheck:init(settings)
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
function WatermarkCheck:apply(ast, pipeline)
|
|
37
|
+
self.CustomVariable = "_" .. callNameGenerator(pipeline.namegenerator, math.random(10000000000, 100000000000));
|
|
38
|
+
pipeline:addStep(Watermark:new(self));
|
|
39
|
+
|
|
40
|
+
local body = ast.body;
|
|
41
|
+
local watermarkExpression = Ast.StringExpression(self.Content);
|
|
42
|
+
local scope, variable = ast.globalScope:resolve(self.CustomVariable);
|
|
43
|
+
local watermark = Ast.VariableExpression(ast.globalScope, variable);
|
|
44
|
+
local notEqualsExpression = Ast.NotEqualsExpression(watermark, watermarkExpression);
|
|
45
|
+
local ifBody = Ast.Block({Ast.ReturnStatement({})}, Scope:new(ast.body.scope));
|
|
46
|
+
|
|
47
|
+
table.insert(body.statements, 1, Ast.IfStatement(notEqualsExpression, ifBody, {}, nil));
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
return WatermarkCheck;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
-- This Script is Part of the Prometheus Obfuscator by Levno_710
|
|
2
|
+
--
|
|
3
|
+
-- WrapInFunction.lua
|
|
4
|
+
--
|
|
5
|
+
-- This Script provides a Simple Obfuscation Step that wraps the entire Script into a function
|
|
6
|
+
|
|
7
|
+
local Step = require("prometheus.step");
|
|
8
|
+
local Ast = require("prometheus.ast");
|
|
9
|
+
local Scope = require("prometheus.scope");
|
|
10
|
+
|
|
11
|
+
local WrapInFunction = Step:extend();
|
|
12
|
+
WrapInFunction.Description = "This Step Wraps the Entire Script into a Function";
|
|
13
|
+
WrapInFunction.Name = "Wrap in Function";
|
|
14
|
+
|
|
15
|
+
WrapInFunction.SettingsDescriptor = {
|
|
16
|
+
Iterations = {
|
|
17
|
+
name = "Iterations",
|
|
18
|
+
description = "The Number Of Iterations",
|
|
19
|
+
type = "number",
|
|
20
|
+
default = 1,
|
|
21
|
+
min = 1,
|
|
22
|
+
max = nil,
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function WrapInFunction:init(settings)
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
function WrapInFunction:apply(ast)
|
|
31
|
+
for i = 1, self.Iterations, 1 do
|
|
32
|
+
local body = ast.body;
|
|
33
|
+
|
|
34
|
+
local scope = Scope:new(ast.globalScope);
|
|
35
|
+
body.scope:setParent(scope);
|
|
36
|
+
|
|
37
|
+
ast.body = Ast.Block({
|
|
38
|
+
Ast.ReturnStatement({
|
|
39
|
+
Ast.FunctionCallExpression(Ast.FunctionLiteralExpression({Ast.VarargExpression()}, body), {Ast.VarargExpression()})
|
|
40
|
+
});
|
|
41
|
+
}, scope);
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
return WrapInFunction;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
return {
|
|
2
|
+
WrapInFunction = require("prometheus.steps.WrapInFunction");
|
|
3
|
+
SplitStrings = require("prometheus.steps.SplitStrings");
|
|
4
|
+
Vmify = require("prometheus.steps.Vmify");
|
|
5
|
+
ConstantArray = require("prometheus.steps.ConstantArray");
|
|
6
|
+
ProxifyLocals = require("prometheus.steps.ProxifyLocals");
|
|
7
|
+
AntiTamper = require("prometheus.steps.AntiTamper");
|
|
8
|
+
EncryptStrings = require("prometheus.steps.EncryptStrings");
|
|
9
|
+
NumbersToExpressions = require("prometheus.steps.NumbersToExpressions");
|
|
10
|
+
AddVararg = require("prometheus.steps.AddVararg");
|
|
11
|
+
WatermarkCheck = require("prometheus.steps.WatermarkCheck");
|
|
12
|
+
}
|