lua-obfuscator 1.0.0 → 1.0.1

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 (98) hide show
  1. package/.github/workflows/release.yml +40 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +18 -14
  4. package/dist/prometheus/LICENSE +661 -661
  5. package/dist/prometheus/build.bat +9 -9
  6. package/dist/prometheus/doc/README.md +11 -11
  7. package/dist/prometheus/doc/SUMMARY.md +27 -27
  8. package/dist/prometheus/doc/advanced/using-prometheus-in-your-lua-application.md +31 -31
  9. package/dist/prometheus/doc/getting-started/command-line-options.md +13 -13
  10. package/dist/prometheus/doc/getting-started/installation.md +11 -11
  11. package/dist/prometheus/doc/getting-started/obfuscating-your-first-script.md +50 -50
  12. package/dist/prometheus/doc/getting-started/presets.md +10 -10
  13. package/dist/prometheus/doc/getting-started/the-config-object.md +58 -58
  14. package/dist/prometheus/doc/getting-started/writing-a-custom-config-file.md +56 -56
  15. package/dist/prometheus/doc/steps/anti-tamper.md +11 -11
  16. package/dist/prometheus/doc/steps/constantarray.md +71 -71
  17. package/dist/prometheus/doc/steps/encryptstrings.md +86 -86
  18. package/dist/prometheus/doc/steps/proxifylocals.md +47 -47
  19. package/dist/prometheus/doc/steps/splitstrings.md +40 -40
  20. package/dist/prometheus/doc/steps/vmify.md +9 -9
  21. package/dist/prometheus/doc/steps/wrapinfunction.md +29 -29
  22. package/dist/prometheus/readme.md +57 -57
  23. package/dist/prometheus/readme.txt +4 -4
  24. package/package.json +5 -1
  25. package/src/index.ts +81 -75
  26. package/tsconfig.json +12 -12
  27. package/src/prometheus/.editorconfig +0 -4
  28. package/src/prometheus/.gitattributes +0 -2
  29. package/src/prometheus/.gitbook.yaml +0 -1
  30. package/src/prometheus/.github/ISSUE_TEMPLATE/bug_report.md +0 -25
  31. package/src/prometheus/.github/workflows/Build.yml +0 -49
  32. package/src/prometheus/.github/workflows/Test.yml +0 -19
  33. package/src/prometheus/LICENSE +0 -661
  34. package/src/prometheus/benchmark.lua +0 -34
  35. package/src/prometheus/build.bat +0 -10
  36. package/src/prometheus/cli.lua +0 -12
  37. package/src/prometheus/doc/README.md +0 -11
  38. package/src/prometheus/doc/SUMMARY.md +0 -27
  39. package/src/prometheus/doc/advanced/using-prometheus-in-your-lua-application.md +0 -31
  40. package/src/prometheus/doc/getting-started/command-line-options.md +0 -13
  41. package/src/prometheus/doc/getting-started/installation.md +0 -11
  42. package/src/prometheus/doc/getting-started/obfuscating-your-first-script.md +0 -50
  43. package/src/prometheus/doc/getting-started/presets.md +0 -10
  44. package/src/prometheus/doc/getting-started/the-config-object.md +0 -58
  45. package/src/prometheus/doc/getting-started/writing-a-custom-config-file.md +0 -56
  46. package/src/prometheus/doc/steps/anti-tamper.md +0 -11
  47. package/src/prometheus/doc/steps/constantarray.md +0 -71
  48. package/src/prometheus/doc/steps/encryptstrings.md +0 -86
  49. package/src/prometheus/doc/steps/proxifylocals.md +0 -47
  50. package/src/prometheus/doc/steps/splitstrings.md +0 -40
  51. package/src/prometheus/doc/steps/vmify.md +0 -9
  52. package/src/prometheus/doc/steps/wrapinfunction.md +0 -29
  53. package/src/prometheus/prometheus-main.lua +0 -1
  54. package/src/prometheus/readme.md +0 -57
  55. package/src/prometheus/readme.txt +0 -5
  56. package/src/prometheus/src/cli.lua +0 -154
  57. package/src/prometheus/src/colors.lua +0 -61
  58. package/src/prometheus/src/highlightlua.lua +0 -61
  59. package/src/prometheus/src/logger.lua +0 -62
  60. package/src/prometheus/src/presets.lua +0 -174
  61. package/src/prometheus/src/prometheus/ast.lua +0 -792
  62. package/src/prometheus/src/prometheus/bit.lua +0 -521
  63. package/src/prometheus/src/prometheus/compiler/compiler.lua +0 -2365
  64. package/src/prometheus/src/prometheus/enums.lua +0 -106
  65. package/src/prometheus/src/prometheus/namegenerators/Il.lua +0 -41
  66. package/src/prometheus/src/prometheus/namegenerators/confuse.lua +0 -169
  67. package/src/prometheus/src/prometheus/namegenerators/mangled.lua +0 -26
  68. package/src/prometheus/src/prometheus/namegenerators/mangled_shuffled.lua +0 -35
  69. package/src/prometheus/src/prometheus/namegenerators/number.lua +0 -11
  70. package/src/prometheus/src/prometheus/namegenerators.lua +0 -7
  71. package/src/prometheus/src/prometheus/parser.lua +0 -969
  72. package/src/prometheus/src/prometheus/pipeline.lua +0 -250
  73. package/src/prometheus/src/prometheus/randomLiterals.lua +0 -41
  74. package/src/prometheus/src/prometheus/randomStrings.lua +0 -24
  75. package/src/prometheus/src/prometheus/scope.lua +0 -332
  76. package/src/prometheus/src/prometheus/step.lua +0 -79
  77. package/src/prometheus/src/prometheus/steps/AddVararg.lua +0 -33
  78. package/src/prometheus/src/prometheus/steps/AntiTamper.lua +0 -194
  79. package/src/prometheus/src/prometheus/steps/ConstantArray.lua +0 -521
  80. package/src/prometheus/src/prometheus/steps/EncryptStrings.lua +0 -239
  81. package/src/prometheus/src/prometheus/steps/NumbersToExpressions.lua +0 -82
  82. package/src/prometheus/src/prometheus/steps/ProxifyLocals.lua +0 -313
  83. package/src/prometheus/src/prometheus/steps/SplitStrings.lua +0 -338
  84. package/src/prometheus/src/prometheus/steps/Vmify.lua +0 -30
  85. package/src/prometheus/src/prometheus/steps/Watermark.lua +0 -61
  86. package/src/prometheus/src/prometheus/steps/WatermarkCheck.lua +0 -50
  87. package/src/prometheus/src/prometheus/steps/WrapInFunction.lua +0 -45
  88. package/src/prometheus/src/prometheus/steps.lua +0 -12
  89. package/src/prometheus/src/prometheus/tokenizer.lua +0 -546
  90. package/src/prometheus/src/prometheus/unparser.lua +0 -866
  91. package/src/prometheus/src/prometheus/util.lua +0 -297
  92. package/src/prometheus/src/prometheus/visitast.lua +0 -245
  93. package/src/prometheus/src/prometheus.lua +0 -71
  94. package/src/prometheus/tests/closures.lua +0 -12
  95. package/src/prometheus/tests/fibonacci.lua +0 -10
  96. package/src/prometheus/tests/loops.lua +0 -8
  97. package/src/prometheus/tests/primes.lua +0 -18
  98. package/src/prometheus/tests.lua +0 -149
@@ -1,79 +0,0 @@
1
- -- This Script is Part of the Prometheus Obfuscator by Levno_710
2
- --
3
- -- step.lua
4
- --
5
- -- This file Provides the base class for Obfuscation Steps
6
-
7
- local logger = require("logger");
8
- local util = require("prometheus.util");
9
-
10
- local lookupify = util.lookupify;
11
-
12
- local Step = {};
13
-
14
- Step.SettingsDescriptor = {}
15
-
16
- function Step:new(settings)
17
- local instance = {};
18
- setmetatable(instance, self);
19
- self.__index = self;
20
-
21
- if type(settings) ~= "table" then
22
- settings = {};
23
- end
24
-
25
- for key, data in pairs(self.SettingsDescriptor) do
26
- if settings[key] == nil then
27
- if data.default == nil then
28
- logger:error(string.format("The Setting \"%s\" was not provided for the Step \"%s\"", key, self.Name));
29
- end
30
- instance[key] = data.default;
31
- elseif(data.type == "enum") then
32
- local lookup = lookupify(data.values);
33
- if not lookup[settings[key]] then
34
- logger:error(string.format("Invalid value for the Setting \"%s\" of the Step \"%s\". It must be one of the following: %s", key, self.Name, table.concat(data, ", ")));
35
- end
36
- instance[key] = settings[key];
37
- elseif(type(settings[key]) ~= data.type) then
38
- logger:error(string.format("Invalid value for the Setting \"%s\" of the Step \"%s\". It must be a %s", key, self.Name, data.type));
39
- else
40
- if data.min then
41
- if settings[key] < data.min then
42
- logger:error(string.format("Invalid value for the Setting \"%s\" of the Step \"%s\". It must be at least %d", key, self.Name, data.min));
43
- end
44
- end
45
-
46
- if data.max then
47
- if settings[key] > data.max then
48
- logger:error(string.format("Invalid value for the Setting \"%s\" of the Step \"%s\". The biggest allowed value is %d", key, self.Name, data.min));
49
- end
50
- end
51
-
52
- instance[key] = settings[key];
53
- end
54
- end
55
-
56
- instance:init();
57
-
58
- return instance;
59
- end
60
-
61
- function Step:init()
62
- logger:error("Abstract Steps cannot be Created");
63
- end
64
-
65
- function Step:extend()
66
- local ext = {};
67
- setmetatable(ext, self);
68
- self.__index = self;
69
- return ext;
70
- end
71
-
72
- function Step:apply(ast, pipeline)
73
- logger:error("Abstract Steps cannot be Applied")
74
- end
75
-
76
- Step.Name = "Abstract Step";
77
- Step.Description = "Abstract Step";
78
-
79
- return Step;
@@ -1,33 +0,0 @@
1
- -- This Script is Part of the Prometheus Obfuscator by Levno_710
2
- --
3
- -- AddVararg.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 visitast = require("prometheus.visitast");
10
- local AstKind = Ast.AstKind;
11
-
12
- local AddVararg = Step:extend();
13
- AddVararg.Description = "This Step Adds Vararg to all Functions";
14
- AddVararg.Name = "Add Vararg";
15
-
16
- AddVararg.SettingsDescriptor = {
17
- }
18
-
19
- function AddVararg:init(settings)
20
-
21
- end
22
-
23
- function AddVararg:apply(ast)
24
- visitast(ast, nil, function(node)
25
- if node.kind == AstKind.FunctionDeclaration or node.kind == AstKind.LocalFunctionDeclaration or node.kind == AstKind.FunctionLiteralExpression then
26
- if #node.args < 1 or node.args[#node.args].kind ~= AstKind.VarargExpression then
27
- node.args[#node.args + 1] = Ast.VarargExpression();
28
- end
29
- end
30
- end)
31
- end
32
-
33
- return AddVararg;
@@ -1,194 +0,0 @@
1
- -- This Script is Part of the Prometheus Obfuscator by Levno_710
2
- --
3
- -- AntiTamper.lua
4
- --
5
- -- This Script provides an Obfuscation Step, that breaks the script, when someone tries to tamper with it.
6
-
7
- local Step = require("prometheus.step");
8
- local Ast = require("prometheus.ast");
9
- local Scope = require("prometheus.scope");
10
- local RandomStrings = require("prometheus.randomStrings")
11
- local Parser = require("prometheus.parser");
12
- local Enums = require("prometheus.enums");
13
- local logger = require("logger");
14
-
15
- local AntiTamper = Step:extend();
16
- AntiTamper.Description = "This Step Breaks your Script when it is modified. This is only effective when using the new VM.";
17
- AntiTamper.Name = "Anti Tamper";
18
-
19
- AntiTamper.SettingsDescriptor = {
20
- UseDebug = {
21
- type = "boolean",
22
- default = true,
23
- description = "Use debug library. (Recommended, however scripts will not work without debug library.)"
24
- }
25
- }
26
-
27
- function AntiTamper:init(settings)
28
-
29
- end
30
-
31
- function AntiTamper:apply(ast, pipeline)
32
- if pipeline.PrettyPrint then
33
- logger:warn(string.format("\"%s\" cannot be used with PrettyPrint, ignoring \"%s\"", self.Name, self.Name));
34
- return ast;
35
- end
36
- local code = "do local valid = true;";
37
- if self.UseDebug then
38
- local string = RandomStrings.randomString();
39
- code = code .. [[
40
- -- Anti Beautify
41
- local sethook = debug and debug.sethook or function() end;
42
- local allowedLine = nil;
43
- local called = 0;
44
- sethook(function(s, line)
45
- if not line then
46
- return
47
- end
48
- called = called + 1;
49
- if allowedLine then
50
- if allowedLine ~= line then
51
- sethook(error, "l", 5);
52
- end
53
- else
54
- allowedLine = line;
55
- end
56
- end, "l", 5);
57
- (function() end)();
58
- (function() end)();
59
- sethook();
60
- if called < 2 then
61
- valid = false;
62
- end
63
- if called < 2 then
64
- valid = false;
65
- end
66
-
67
- -- Anti Function Hook
68
- local funcs = {pcall, string.char, debug.getinfo, string.dump}
69
- for i = 1, #funcs do
70
- if debug.getinfo(funcs[i]).what ~= "C" then
71
- valid = false;
72
- end
73
-
74
- if debug.getlocal(funcs[i], 1) then
75
- valid = false;
76
- end
77
-
78
- if debug.getupvalue(funcs[i], 1) then
79
- valid = false;
80
- end
81
-
82
- if pcall(string.dump, funcs[i]) then
83
- valid = false;
84
- end
85
- end
86
-
87
- -- Anti Beautify
88
- local function getTraceback()
89
- local str = (function(arg)
90
- return debug.traceback(arg)
91
- end)("]] .. string .. [[");
92
- return str;
93
- end
94
-
95
- local traceback = getTraceback();
96
- valid = valid and traceback:sub(1, traceback:find("\n") - 1) == "]] .. string .. [[";
97
- local iter = traceback:gmatch(":(%d*):");
98
- local v, c = iter(), 1;
99
- for i in iter do
100
- valid = valid and i == v;
101
- c = c + 1;
102
- end
103
- valid = valid and c >= 2;
104
- ]]
105
- end
106
- code = code .. [[
107
- local gmatch = string.gmatch;
108
- local err = function() error("Tamper Detected!") end;
109
-
110
- local pcallIntact2 = false;
111
- local pcallIntact = pcall(function()
112
- pcallIntact2 = true;
113
- end) and pcallIntact2;
114
-
115
- local random = math.random;
116
- local tblconcat = table.concat;
117
- local unpkg = table and table.unpack or unpack;
118
- local n = random(3, 65);
119
- local acc1 = 0;
120
- local acc2 = 0;
121
- local pcallRet = {pcall(function() local a = ]] .. tostring(math.random(1, 2^24)) .. [[ - "]] .. RandomStrings.randomString() .. [[" ^ ]] .. tostring(math.random(1, 2^24)) .. [[ return "]] .. RandomStrings.randomString() .. [[" / a; end)};
122
- local origMsg = pcallRet[2];
123
- local line = tonumber(gmatch(tostring(origMsg), ':(%d*):')());
124
- for i = 1, n do
125
- local len = math.random(1, 100);
126
- local n2 = random(0, 255);
127
- local pos = random(1, len);
128
- local shouldErr = random(1, 2) == 1;
129
- local msg = origMsg:gsub(':(%d*):', ':' .. tostring(random(0, 10000)) .. ':');
130
- local arr = {pcall(function()
131
- if random(1, 2) == 1 or i == n then
132
- local line2 = tonumber(gmatch(tostring(({pcall(function() local a = ]] .. tostring(math.random(1, 2^24)) .. [[ - "]] .. RandomStrings.randomString() .. [[" ^ ]] .. tostring(math.random(1, 2^24)) .. [[ return "]] .. RandomStrings.randomString() .. [[" / a; end)})[2]), ':(%d*):')());
133
- valid = valid and line == line2;
134
- end
135
- if shouldErr then
136
- error(msg, 0);
137
- end
138
- local arr = {};
139
- for i = 1, len do
140
- arr[i] = random(0, 255);
141
- end
142
- arr[pos] = n2;
143
- return unpkg(arr);
144
- end)};
145
- if shouldErr then
146
- valid = valid and arr[1] == false and arr[2] == msg;
147
- else
148
- valid = valid and arr[1];
149
- acc1 = (acc1 + arr[pos + 1]) % 256;
150
- acc2 = (acc2 + n2) % 256;
151
- end
152
- end
153
- valid = valid and acc1 == acc2;
154
-
155
- if valid then else
156
- repeat
157
- return (function()
158
- while true do
159
- l1, l2 = l2, l1;
160
- err();
161
- end
162
- end)();
163
- until true;
164
- while true do
165
- l2 = random(1, 6);
166
- if l2 > 2 then
167
- l2 = tostring(l1);
168
- else
169
- l1 = l2;
170
- end
171
- end
172
- return;
173
- end
174
- end
175
-
176
- -- Anti Function Arg Hook
177
- local obj = setmetatable({}, {
178
- __tostring = err,
179
- });
180
- obj[math.random(1, 100)] = obj;
181
- (function() end)(obj);
182
-
183
- repeat until valid;
184
- ]]
185
-
186
- local parsed = Parser:new({LuaVersion = Enums.LuaVersion.Lua51}):parse(code);
187
- local doStat = parsed.body.statements[1];
188
- doStat.body.scope:setParent(ast.body.scope);
189
- table.insert(ast.body.statements, 1, doStat);
190
-
191
- return ast;
192
- end
193
-
194
- return AntiTamper;