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,149 @@
1
+ -- This Script is Part of the Prometheus Obfuscator by Levno_710
2
+ --
3
+ -- test.lua
4
+ -- This file will Perform tests using all lua files within the tests directory
5
+
6
+ -- Require Prometheus
7
+ local Prometheus = require("src.prometheus")
8
+
9
+ -- Enable Debugging
10
+ -- logger.logLevel = logger.LogLevel.Debug;
11
+
12
+ -- Config Variables - Later passed as Parameters
13
+ local noColors = false; -- Wether Colors in the Console output should be enabled
14
+ local isWindows = true; -- Wether the Test are Performed on a Windows or Linux System
15
+ local ciMode = false; -- Wether the Test error are ignored or not
16
+
17
+ for _, currArg in pairs(arg) do
18
+ if currArg == "--Linux" then
19
+ isWindows = false
20
+ end
21
+ if currArg == "--CI" then
22
+ ciMode = true
23
+ end
24
+ end
25
+
26
+ -- Enable/Disable Console Colors - this may be needed because cmd.exe and powershell.exe do not support ANSI Color Escape Sequences. The Windows Terminal Application is needed
27
+ Prometheus.colors.enabled = not noColors;
28
+
29
+ -- Apply Obfuscation Pipeline
30
+ local pipeline = Prometheus.Pipeline:new({
31
+ Seed = 0; -- For Using Time as Seed
32
+ VarNamePrefix = ""; -- No Custom Prefix
33
+ });
34
+
35
+ -- "Mangled" for names like this : a, b, c, d, ...
36
+ -- "MangledShuffled" is the same except the chars come in a different order - Recomended
37
+ -- "Il" for weird names like this : IlIIl1llI11l1 - Recomended to make less readable
38
+ -- "Number" for names like this : _1, _2, _3, ... - Not recomended
39
+ pipeline:setNameGenerator("MangledShuffled");
40
+
41
+ print("Performing Prometheus Tests ...")
42
+ local function scandir(directory)
43
+ local i, t, popen = 0, {}, io.popen
44
+ local pfile = popen(isWindows and 'dir "'..directory..'" /b' or 'ls -a "'..directory..'"')
45
+ for filename in pfile:lines() do
46
+ if string.sub(filename, -4) == ".lua" then
47
+ i = i + 1
48
+ t[i] = filename
49
+ end
50
+ end
51
+ pfile:close()
52
+ return t
53
+ end
54
+
55
+ local function shallowcopy(orig)
56
+ local orig_type = type(orig)
57
+ local copy
58
+ if orig_type == 'table' then
59
+ copy = {}
60
+ for orig_key, orig_value in pairs(orig) do
61
+ copy[orig_key] = orig_value
62
+ end
63
+ else -- number, string, boolean, etc
64
+ copy = orig
65
+ end
66
+ return copy
67
+ end
68
+
69
+ local function validate(a, b)
70
+ local outa = "";
71
+ local outb = "";
72
+
73
+ local enva = shallowcopy(getfenv(a));
74
+ local envb = shallowcopy(getfenv(a));
75
+
76
+ enva.print = function(...)
77
+ for i, v in ipairs({...}) do
78
+ outa = outa .. tostring(v);
79
+ end
80
+ end
81
+
82
+ envb.print = function(...)
83
+ for i, v in ipairs({...}) do
84
+ outb = outb .. tostring(v);
85
+ end
86
+ end
87
+
88
+ setfenv(a, enva);
89
+ setfenv(b, envb);
90
+
91
+ if(not pcall(a)) then error("Expected Reference Program not to Fail!") end
92
+ if(not pcall(b)) then return false, outa, nil end
93
+
94
+ return outa == outb, outa, outb
95
+ end
96
+
97
+
98
+ local presets = Prometheus.Presets;
99
+ local testdir = "./tests/"
100
+ local failed = {};
101
+ Prometheus.Logger.logLevel = Prometheus.Logger.LogLevel.Error;
102
+ local fc = 0;
103
+ for i, filename in ipairs(scandir(testdir)) do
104
+ local path = testdir .. filename;
105
+ local file = io.open(path,"r");
106
+
107
+ local code = file:read("*a");
108
+ print(Prometheus.colors("[CURRENT] ", "magenta") .. filename);
109
+ for name, preset in pairs(presets) do
110
+ for i = #preset.Steps, 1, -1 do
111
+ if preset.Steps[i].Name == "AntiTamper" then
112
+ table.remove(preset.Steps, i);
113
+ end
114
+ end
115
+ pipeline = Prometheus.Pipeline:fromConfig(preset);
116
+ local obfuscated = pipeline:apply(code);
117
+
118
+ local funca = loadstring(code);
119
+ local funcb = loadstring(obfuscated);
120
+
121
+ if funcb == nil then
122
+ print(Prometheus.colors("[FAILED] ", "red") .. "(" .. filename .. "): " .. name .. ", Invalid Lua!");
123
+ print("[SOURCE]", obfuscated);
124
+ fc = fc + 1;
125
+ else
126
+ local validated, outa, outb = validate(funca, funcb);
127
+
128
+ if not validated then
129
+ print(Prometheus.colors("[FAILED] ", "red") .. "(" .. filename .. "): " .. name);
130
+ print("[OUTA] ", outa);
131
+ print("[OUTB] ", outb);
132
+ print("[SOURCE]", obfuscated);
133
+ fc = fc + 1;
134
+ end
135
+ end
136
+ end
137
+ file:close();
138
+ end
139
+
140
+ if fc < 1 then
141
+ print(Prometheus.colors("[PASSED] ", "green") .. "All tests passed!");
142
+ return 0;
143
+ else
144
+ print(Prometheus.colors("[FAILED] ", "red") .. "Some tests failed!");
145
+ if ciMode then
146
+ error("Test Failed!")
147
+ end
148
+ return -1;
149
+ end
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "outDir": "./dist",
7
+ "rootDir": "./src",
8
+ "strict": true,
9
+ "declaration": true,
10
+ "declarationDir": "./dist",
11
+ "types": ["node"]
12
+ }
13
+ }