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.
Files changed (144) hide show
  1. package/dist/index.d.ts +14 -0
  2. package/dist/index.js +58 -0
  3. package/dist/prometheus/LICENSE +661 -0
  4. package/dist/prometheus/benchmark.lua +34 -0
  5. package/dist/prometheus/build.bat +10 -0
  6. package/dist/prometheus/cli.lua +12 -0
  7. package/dist/prometheus/doc/README.md +11 -0
  8. package/dist/prometheus/doc/SUMMARY.md +27 -0
  9. package/dist/prometheus/doc/advanced/using-prometheus-in-your-lua-application.md +31 -0
  10. package/dist/prometheus/doc/getting-started/command-line-options.md +13 -0
  11. package/dist/prometheus/doc/getting-started/installation.md +11 -0
  12. package/dist/prometheus/doc/getting-started/obfuscating-your-first-script.md +50 -0
  13. package/dist/prometheus/doc/getting-started/presets.md +10 -0
  14. package/dist/prometheus/doc/getting-started/the-config-object.md +58 -0
  15. package/dist/prometheus/doc/getting-started/writing-a-custom-config-file.md +56 -0
  16. package/dist/prometheus/doc/steps/anti-tamper.md +11 -0
  17. package/dist/prometheus/doc/steps/constantarray.md +71 -0
  18. package/dist/prometheus/doc/steps/encryptstrings.md +86 -0
  19. package/dist/prometheus/doc/steps/proxifylocals.md +47 -0
  20. package/dist/prometheus/doc/steps/splitstrings.md +40 -0
  21. package/dist/prometheus/doc/steps/vmify.md +9 -0
  22. package/dist/prometheus/doc/steps/wrapinfunction.md +29 -0
  23. package/dist/prometheus/prometheus-main.lua +1 -0
  24. package/dist/prometheus/readme.md +57 -0
  25. package/dist/prometheus/readme.txt +5 -0
  26. package/dist/prometheus/src/cli.lua +154 -0
  27. package/dist/prometheus/src/colors.lua +61 -0
  28. package/dist/prometheus/src/config.lua +35 -0
  29. package/dist/prometheus/src/highlightlua.lua +61 -0
  30. package/dist/prometheus/src/logger.lua +62 -0
  31. package/dist/prometheus/src/presets.lua +174 -0
  32. package/dist/prometheus/src/prometheus/ast.lua +792 -0
  33. package/dist/prometheus/src/prometheus/bit.lua +521 -0
  34. package/dist/prometheus/src/prometheus/compiler/compiler.lua +2365 -0
  35. package/dist/prometheus/src/prometheus/enums.lua +106 -0
  36. package/dist/prometheus/src/prometheus/namegenerators/Il.lua +41 -0
  37. package/dist/prometheus/src/prometheus/namegenerators/confuse.lua +169 -0
  38. package/dist/prometheus/src/prometheus/namegenerators/mangled.lua +26 -0
  39. package/dist/prometheus/src/prometheus/namegenerators/mangled_shuffled.lua +35 -0
  40. package/dist/prometheus/src/prometheus/namegenerators/number.lua +11 -0
  41. package/dist/prometheus/src/prometheus/namegenerators.lua +7 -0
  42. package/dist/prometheus/src/prometheus/parser.lua +969 -0
  43. package/dist/prometheus/src/prometheus/pipeline.lua +250 -0
  44. package/dist/prometheus/src/prometheus/randomLiterals.lua +41 -0
  45. package/dist/prometheus/src/prometheus/randomStrings.lua +24 -0
  46. package/dist/prometheus/src/prometheus/scope.lua +332 -0
  47. package/dist/prometheus/src/prometheus/step.lua +79 -0
  48. package/dist/prometheus/src/prometheus/steps/AddVararg.lua +33 -0
  49. package/dist/prometheus/src/prometheus/steps/AntiTamper.lua +194 -0
  50. package/dist/prometheus/src/prometheus/steps/ConstantArray.lua +521 -0
  51. package/dist/prometheus/src/prometheus/steps/EncryptStrings.lua +239 -0
  52. package/dist/prometheus/src/prometheus/steps/NumbersToExpressions.lua +82 -0
  53. package/dist/prometheus/src/prometheus/steps/ProxifyLocals.lua +313 -0
  54. package/dist/prometheus/src/prometheus/steps/SplitStrings.lua +338 -0
  55. package/dist/prometheus/src/prometheus/steps/Vmify.lua +30 -0
  56. package/dist/prometheus/src/prometheus/steps/Watermark.lua +61 -0
  57. package/dist/prometheus/src/prometheus/steps/WatermarkCheck.lua +50 -0
  58. package/dist/prometheus/src/prometheus/steps/WrapInFunction.lua +45 -0
  59. package/dist/prometheus/src/prometheus/steps.lua +12 -0
  60. package/dist/prometheus/src/prometheus/tokenizer.lua +546 -0
  61. package/dist/prometheus/src/prometheus/unparser.lua +866 -0
  62. package/dist/prometheus/src/prometheus/util.lua +297 -0
  63. package/dist/prometheus/src/prometheus/visitast.lua +245 -0
  64. package/dist/prometheus/src/prometheus.lua +71 -0
  65. package/dist/prometheus/tests/closures.lua +12 -0
  66. package/dist/prometheus/tests/fibonacci.lua +10 -0
  67. package/dist/prometheus/tests/loops.lua +8 -0
  68. package/dist/prometheus/tests/primes.lua +18 -0
  69. package/dist/prometheus/tests.lua +149 -0
  70. package/package.json +25 -0
  71. package/src/index.ts +76 -0
  72. package/src/prometheus/.editorconfig +4 -0
  73. package/src/prometheus/.gitattributes +2 -0
  74. package/src/prometheus/.gitbook.yaml +1 -0
  75. package/src/prometheus/.github/ISSUE_TEMPLATE/bug_report.md +25 -0
  76. package/src/prometheus/.github/workflows/Build.yml +49 -0
  77. package/src/prometheus/.github/workflows/Test.yml +19 -0
  78. package/src/prometheus/LICENSE +661 -0
  79. package/src/prometheus/benchmark.lua +34 -0
  80. package/src/prometheus/build.bat +10 -0
  81. package/src/prometheus/cli.lua +12 -0
  82. package/src/prometheus/doc/README.md +11 -0
  83. package/src/prometheus/doc/SUMMARY.md +27 -0
  84. package/src/prometheus/doc/advanced/using-prometheus-in-your-lua-application.md +31 -0
  85. package/src/prometheus/doc/getting-started/command-line-options.md +13 -0
  86. package/src/prometheus/doc/getting-started/installation.md +11 -0
  87. package/src/prometheus/doc/getting-started/obfuscating-your-first-script.md +50 -0
  88. package/src/prometheus/doc/getting-started/presets.md +10 -0
  89. package/src/prometheus/doc/getting-started/the-config-object.md +58 -0
  90. package/src/prometheus/doc/getting-started/writing-a-custom-config-file.md +56 -0
  91. package/src/prometheus/doc/steps/anti-tamper.md +11 -0
  92. package/src/prometheus/doc/steps/constantarray.md +71 -0
  93. package/src/prometheus/doc/steps/encryptstrings.md +86 -0
  94. package/src/prometheus/doc/steps/proxifylocals.md +47 -0
  95. package/src/prometheus/doc/steps/splitstrings.md +40 -0
  96. package/src/prometheus/doc/steps/vmify.md +9 -0
  97. package/src/prometheus/doc/steps/wrapinfunction.md +29 -0
  98. package/src/prometheus/prometheus-main.lua +1 -0
  99. package/src/prometheus/readme.md +57 -0
  100. package/src/prometheus/readme.txt +5 -0
  101. package/src/prometheus/src/cli.lua +154 -0
  102. package/src/prometheus/src/colors.lua +61 -0
  103. package/src/prometheus/src/highlightlua.lua +61 -0
  104. package/src/prometheus/src/logger.lua +62 -0
  105. package/src/prometheus/src/presets.lua +174 -0
  106. package/src/prometheus/src/prometheus/ast.lua +792 -0
  107. package/src/prometheus/src/prometheus/bit.lua +521 -0
  108. package/src/prometheus/src/prometheus/compiler/compiler.lua +2365 -0
  109. package/src/prometheus/src/prometheus/enums.lua +106 -0
  110. package/src/prometheus/src/prometheus/namegenerators/Il.lua +41 -0
  111. package/src/prometheus/src/prometheus/namegenerators/confuse.lua +169 -0
  112. package/src/prometheus/src/prometheus/namegenerators/mangled.lua +26 -0
  113. package/src/prometheus/src/prometheus/namegenerators/mangled_shuffled.lua +35 -0
  114. package/src/prometheus/src/prometheus/namegenerators/number.lua +11 -0
  115. package/src/prometheus/src/prometheus/namegenerators.lua +7 -0
  116. package/src/prometheus/src/prometheus/parser.lua +969 -0
  117. package/src/prometheus/src/prometheus/pipeline.lua +250 -0
  118. package/src/prometheus/src/prometheus/randomLiterals.lua +41 -0
  119. package/src/prometheus/src/prometheus/randomStrings.lua +24 -0
  120. package/src/prometheus/src/prometheus/scope.lua +332 -0
  121. package/src/prometheus/src/prometheus/step.lua +79 -0
  122. package/src/prometheus/src/prometheus/steps/AddVararg.lua +33 -0
  123. package/src/prometheus/src/prometheus/steps/AntiTamper.lua +194 -0
  124. package/src/prometheus/src/prometheus/steps/ConstantArray.lua +521 -0
  125. package/src/prometheus/src/prometheus/steps/EncryptStrings.lua +239 -0
  126. package/src/prometheus/src/prometheus/steps/NumbersToExpressions.lua +82 -0
  127. package/src/prometheus/src/prometheus/steps/ProxifyLocals.lua +313 -0
  128. package/src/prometheus/src/prometheus/steps/SplitStrings.lua +338 -0
  129. package/src/prometheus/src/prometheus/steps/Vmify.lua +30 -0
  130. package/src/prometheus/src/prometheus/steps/Watermark.lua +61 -0
  131. package/src/prometheus/src/prometheus/steps/WatermarkCheck.lua +50 -0
  132. package/src/prometheus/src/prometheus/steps/WrapInFunction.lua +45 -0
  133. package/src/prometheus/src/prometheus/steps.lua +12 -0
  134. package/src/prometheus/src/prometheus/tokenizer.lua +546 -0
  135. package/src/prometheus/src/prometheus/unparser.lua +866 -0
  136. package/src/prometheus/src/prometheus/util.lua +297 -0
  137. package/src/prometheus/src/prometheus/visitast.lua +245 -0
  138. package/src/prometheus/src/prometheus.lua +71 -0
  139. package/src/prometheus/tests/closures.lua +12 -0
  140. package/src/prometheus/tests/fibonacci.lua +10 -0
  141. package/src/prometheus/tests/loops.lua +8 -0
  142. package/src/prometheus/tests/primes.lua +18 -0
  143. package/src/prometheus/tests.lua +149 -0
  144. package/tsconfig.json +13 -0
@@ -0,0 +1,106 @@
1
+ -- This Script is Part of the Prometheus Obfuscator by Levno_710
2
+ --
3
+ -- enums.lua
4
+ -- This file Provides some enums used by the Obfuscator
5
+
6
+ local Enums = {};
7
+
8
+ local chararray = require("prometheus.util").chararray;
9
+
10
+ Enums.LuaVersion = {
11
+ LuaU = "LuaU" ,
12
+ Lua51 = "Lua51",
13
+ }
14
+
15
+ Enums.Conventions = {
16
+ [Enums.LuaVersion.Lua51] = {
17
+ Keywords = {
18
+ "and", "break", "do", "else", "elseif",
19
+ "end", "false", "for", "function", "if",
20
+ "in", "local", "nil", "not", "or",
21
+ "repeat", "return", "then", "true", "until", "while"
22
+ },
23
+
24
+ SymbolChars = chararray("+-*/%^#=~<>(){}[];:,."),
25
+ MaxSymbolLength = 3,
26
+ Symbols = {
27
+ "+", "-", "*", "/", "%", "^", "#",
28
+ "==", "~=", "<=", ">=", "<", ">", "=",
29
+ "(", ")", "{", "}", "[", "]",
30
+ ";", ":", ",", ".", "..", "...",
31
+ },
32
+
33
+ IdentChars = chararray("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789"),
34
+ NumberChars = chararray("0123456789"),
35
+ HexNumberChars = chararray("0123456789abcdefABCDEF"),
36
+ BinaryNumberChars = {"0", "1"},
37
+ DecimalExponent = {"e", "E"},
38
+ HexadecimalNums = {"x", "X"},
39
+ BinaryNums = {"b", "B"},
40
+ DecimalSeperators = false,
41
+
42
+ EscapeSequences = {
43
+ ["a"] = "\a";
44
+ ["b"] = "\b";
45
+ ["f"] = "\f";
46
+ ["n"] = "\n";
47
+ ["r"] = "\r";
48
+ ["t"] = "\t";
49
+ ["v"] = "\v";
50
+ ["\\"] = "\\";
51
+ ["\""] = "\"";
52
+ ["\'"] = "\'";
53
+ },
54
+ NumericalEscapes = true,
55
+ EscapeZIgnoreNextWhitespace = true,
56
+ HexEscapes = true,
57
+ UnicodeEscapes = true,
58
+ },
59
+ [Enums.LuaVersion.LuaU] = {
60
+ Keywords = {
61
+ "and", "break", "do", "else", "elseif", "continue",
62
+ "end", "false", "for", "function", "if",
63
+ "in", "local", "nil", "not", "or",
64
+ "repeat", "return", "then", "true", "until", "while"
65
+ },
66
+
67
+ SymbolChars = chararray("+-*/%^#=~<>(){}[];:,."),
68
+ MaxSymbolLength = 3,
69
+ Symbols = {
70
+ "+", "-", "*", "/", "%", "^", "#",
71
+ "==", "~=", "<=", ">=", "<", ">", "=",
72
+ "+=", "-=", "/=", "%=", "^=", "..=", "*=",
73
+ "(", ")", "{", "}", "[", "]",
74
+ ";", ":", ",", ".", "..", "...",
75
+ "::", "->", "?", "|", "&",
76
+ },
77
+
78
+ IdentChars = chararray("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789"),
79
+ NumberChars = chararray("0123456789"),
80
+ HexNumberChars = chararray("0123456789abcdefABCDEF"),
81
+ BinaryNumberChars = {"0", "1"},
82
+ DecimalExponent = {"e", "E"},
83
+ HexadecimalNums = {"x", "X"},
84
+ BinaryNums = {"b", "B"},
85
+ DecimalSeperators = {"_"},
86
+
87
+ EscapeSequences = {
88
+ ["a"] = "\a";
89
+ ["b"] = "\b";
90
+ ["f"] = "\f";
91
+ ["n"] = "\n";
92
+ ["r"] = "\r";
93
+ ["t"] = "\t";
94
+ ["v"] = "\v";
95
+ ["\\"] = "\\";
96
+ ["\""] = "\"";
97
+ ["\'"] = "\'";
98
+ },
99
+ NumericalEscapes = true,
100
+ EscapeZIgnoreNextWhitespace = true,
101
+ HexEscapes = true,
102
+ UnicodeEscapes = true,
103
+ },
104
+ }
105
+
106
+ return Enums;
@@ -0,0 +1,41 @@
1
+ -- This Script is Part of the Prometheus Obfuscator by Levno_710
2
+ --
3
+ -- namegenerators/il.lua
4
+ --
5
+ -- This Script provides a function for generation of weird names consisting of I, l and 1
6
+
7
+ local MIN_CHARACTERS = 5;
8
+ local MAX_INITIAL_CHARACTERS = 10;
9
+
10
+
11
+ local util = require("prometheus.util");
12
+ local chararray = util.chararray;
13
+
14
+ local offset = 0;
15
+ local VarDigits = chararray("Il1");
16
+ local VarStartDigits = chararray("Il");
17
+
18
+ local function generateName(id, scope)
19
+ local name = ''
20
+ id = id + offset;
21
+ local d = id % #VarStartDigits
22
+ id = (id - d) / #VarStartDigits
23
+ name = name..VarStartDigits[d+1]
24
+ while id > 0 do
25
+ local d = id % #VarDigits
26
+ id = (id - d) / #VarDigits
27
+ name = name..VarDigits[d+1]
28
+ end
29
+ return name
30
+ end
31
+
32
+ local function prepare(ast)
33
+ util.shuffle(VarDigits);
34
+ util.shuffle(VarStartDigits);
35
+ offset = math.random(3 ^ MIN_CHARACTERS, 3 ^ MAX_INITIAL_CHARACTERS);
36
+ end
37
+
38
+ return {
39
+ generateName = generateName,
40
+ prepare = prepare
41
+ };
@@ -0,0 +1,169 @@
1
+ -- This Script is Part of the Prometheus Obfuscator by Levno_710
2
+ --
3
+ -- namegenerators/confuse.lua
4
+ --
5
+ -- This Script provides a function for generation of confusing variable names
6
+
7
+ local util = require("prometheus.util");
8
+ local chararray = util.chararray;
9
+
10
+ local varNames = {
11
+ "index",
12
+ "iterator",
13
+ "length",
14
+ "size",
15
+ "key",
16
+ "value",
17
+ "data",
18
+ "count",
19
+ "increment",
20
+ "include",
21
+ "string",
22
+ "number",
23
+ "type",
24
+ "void",
25
+ "int",
26
+ "float",
27
+ "bool",
28
+ "char",
29
+ "double",
30
+ "long",
31
+ "short",
32
+ "unsigned",
33
+ "signed",
34
+ "program",
35
+ "factory",
36
+ "Factory",
37
+ "new",
38
+ "delete",
39
+ "table",
40
+ "array",
41
+ "object",
42
+ "class",
43
+ "arr",
44
+ "obj",
45
+ "cls",
46
+ "dir",
47
+ "directory",
48
+ "isWindows",
49
+ "isLinux",
50
+ "game",
51
+ "roblox",
52
+ "gmod",
53
+ "gsub",
54
+ "gmatch",
55
+ "gfind",
56
+ "onload",
57
+ "load",
58
+ "loadstring",
59
+ "loadfile",
60
+ "dofile",
61
+ "require",
62
+ "parse",
63
+ "byte",
64
+ "code",
65
+ "bytecode",
66
+ "idx",
67
+ "const",
68
+ "loader",
69
+ "loaders",
70
+ "module",
71
+ "export",
72
+ "exports",
73
+ "import",
74
+ "imports",
75
+ "package",
76
+ "packages",
77
+ "_G",
78
+ "math",
79
+ "os",
80
+ "io",
81
+ "write",
82
+ "print",
83
+ "read",
84
+ "readline",
85
+ "readlines",
86
+ "close",
87
+ "flush",
88
+ "open",
89
+ "popen",
90
+ "tmpfile",
91
+ "tmpname",
92
+ "rename",
93
+ "remove",
94
+ "seek",
95
+ "setvbuf",
96
+ "lines",
97
+ "call",
98
+ "apply",
99
+ "raise",
100
+ "pcall",
101
+ "xpcall",
102
+ "coroutine",
103
+ "create",
104
+ "resume",
105
+ "status",
106
+ "wrap",
107
+ "yield",
108
+ "debug",
109
+ "traceback",
110
+ "getinfo",
111
+ "getlocal",
112
+ "setlocal",
113
+ "getupvalue",
114
+ "setupvalue",
115
+ "getuservalue",
116
+ "setuservalue",
117
+ "upvalueid",
118
+ "upvaluejoin",
119
+ "sethook",
120
+ "gethook",
121
+ "hookfunction",
122
+ "hooks",
123
+ "error",
124
+ "setmetatable",
125
+ "getmetatable",
126
+ "rand",
127
+ "randomseed",
128
+ "next",
129
+ "ipairs",
130
+ "hasnext",
131
+ "loadlib",
132
+ "searchpath",
133
+ "oldpath",
134
+ "newpath",
135
+ "path",
136
+ "rawequal",
137
+ "rawset",
138
+ "rawget",
139
+ "rawnew",
140
+ "rawlen",
141
+ "select",
142
+ "tonumber",
143
+ "tostring",
144
+ "assert",
145
+ "collectgarbage",
146
+ "a", "b", "c", "i", "j", "m",
147
+ }
148
+
149
+ local function generateName(id, scope)
150
+ local name = {};
151
+ local d = id % #varNames
152
+ id = (id - d) / #varNames
153
+ table.insert(name, varNames[d + 1]);
154
+ while id > 0 do
155
+ local d = id % #varNames
156
+ id = (id - d) / #varNames
157
+ table.insert(name, varNames[d + 1]);
158
+ end
159
+ return table.concat(name, "_");
160
+ end
161
+
162
+ local function prepare(ast)
163
+ util.shuffle(varNames);
164
+ end
165
+
166
+ return {
167
+ generateName = generateName,
168
+ prepare = prepare
169
+ };
@@ -0,0 +1,26 @@
1
+ -- This Script is Part of the Prometheus Obfuscator by Levno_710
2
+ --
3
+ -- namegenerators/mangled.lua
4
+ --
5
+ -- This Script provides a function for generation of mangled names
6
+
7
+
8
+ local util = require("prometheus.util");
9
+ local chararray = util.chararray;
10
+
11
+ local idGen = 0
12
+ local VarDigits = chararray("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_");
13
+ local VarStartDigits = chararray("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
14
+
15
+ return function(id, scope)
16
+ local name = ''
17
+ local d = id % #VarStartDigits
18
+ id = (id - d) / #VarStartDigits
19
+ name = name..VarStartDigits[d+1]
20
+ while id > 0 do
21
+ local d = id % #VarDigits
22
+ id = (id - d) / #VarDigits
23
+ name = name..VarDigits[d+1]
24
+ end
25
+ return name
26
+ end
@@ -0,0 +1,35 @@
1
+ -- This Script is Part of the Prometheus Obfuscator by Levno_710
2
+ --
3
+ -- namegenerators/mangled_shuffled.lua
4
+ --
5
+ -- This Script provides a function for generation of mangled names with shuffled character order
6
+
7
+
8
+ local util = require("prometheus.util");
9
+ local chararray = util.chararray;
10
+
11
+ local VarDigits = chararray("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_");
12
+ local VarStartDigits = chararray("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
13
+
14
+ local function generateName(id, scope)
15
+ local name = ''
16
+ local d = id % #VarStartDigits
17
+ id = (id - d) / #VarStartDigits
18
+ name = name..VarStartDigits[d+1]
19
+ while id > 0 do
20
+ local d = id % #VarDigits
21
+ id = (id - d) / #VarDigits
22
+ name = name..VarDigits[d+1]
23
+ end
24
+ return name
25
+ end
26
+
27
+ local function prepare(ast)
28
+ util.shuffle(VarDigits);
29
+ util.shuffle(VarStartDigits);
30
+ end
31
+
32
+ return {
33
+ generateName = generateName,
34
+ prepare = prepare
35
+ };
@@ -0,0 +1,11 @@
1
+ -- This Script is Part of the Prometheus Obfuscator by Levno_710
2
+ --
3
+ -- namegenerators/number.lua
4
+ --
5
+ -- This Script provides a function for generation of simple up counting names but with hex numbers
6
+
7
+ local PREFIX = "_";
8
+
9
+ return function(id, scope)
10
+ return PREFIX .. tostring(id);
11
+ end
@@ -0,0 +1,7 @@
1
+ return {
2
+ Mangled = require("prometheus.namegenerators.mangled");
3
+ MangledShuffled = require("prometheus.namegenerators.mangled_shuffled");
4
+ Il = require("prometheus.namegenerators.Il");
5
+ Number = require("prometheus.namegenerators.number");
6
+ Confuse = require("prometheus.namegenerators.confuse");
7
+ }