-
Notifications
You must be signed in to change notification settings - Fork 196
Expand file tree
/
Copy pathrandomLiterals.lua
More file actions
43 lines (34 loc) · 1.11 KB
/
randomLiterals.lua
File metadata and controls
43 lines (34 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
-- This Script is Part of the Prometheus Obfuscator by levno-710
--
-- randomLiterals.lua
--
-- This Script provides a library for creating random literals
local Ast = require("prometheus.ast");
local RandomStrings = require("prometheus.randomStrings");
local RandomLiterals = {};
local function callNameGenerator(generatorFunction, ...)
if(type(generatorFunction) == "table") then
generatorFunction = generatorFunction.generateName;
end
return generatorFunction(...);
end
function RandomLiterals.String(pipeline)
return Ast.StringExpression(callNameGenerator(pipeline.namegenerator, math.random(1, 4096)));
end
function RandomLiterals.Dictionary()
return RandomStrings.randomStringNode(true);
end
function RandomLiterals.Number()
return Ast.NumberExpression(math.random(-8388608, 8388607));
end
function RandomLiterals.Any(pipeline)
local type = math.random(1, 3);
if type == 1 then
return RandomLiterals.String(pipeline);
elseif type == 2 then
return RandomLiterals.Number();
elseif type == 3 then
return RandomLiterals.Dictionary();
end
end
return RandomLiterals;