Skip to content

Commit 18bba0e

Browse files
committed
Add AddVararg step
1 parent 3b7e163 commit 18bba0e

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/prometheus/steps.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ return {
88
BreakBeautify = require("prometheus.steps.BreakBeautify");
99
EncryptStrings = require("prometheus.steps.EncryptStrings");
1010
NumbersToExpressions = require("prometheus.steps.NumbersToExpressions");
11+
AddVararg = require("prometheus.steps.AddVararg");
1112
}

src/prometheus/steps/AddVararg.lua

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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;

0 commit comments

Comments
 (0)