Skip to content

Commit 2e21f42

Browse files
authored
Merge pull request #96 from levno-710/master
Sync Develop
2 parents fbd2f06 + e639587 commit 2e21f42

File tree

7 files changed

+33
-26
lines changed

7 files changed

+33
-26
lines changed

src/cli.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- This Script is Part of the Prometheus Obfuscator by Levno_710
22
--
3-
-- test.lua
3+
-- cli.lua
44
-- This script contains the Code for the Prometheus CLI
55

66
-- Configure package.path for requiring Prometheus
@@ -13,25 +13,25 @@ package.path = script_path() .. "?.lua;" .. package.path;
1313
local Prometheus = require("prometheus");
1414
Prometheus.Logger.logLevel = Prometheus.Logger.LogLevel.Info;
1515

16-
-- Override Error callback
16+
-- Override error callback
1717
--[[Prometheus.Logger.errorCallback = function(...)
1818
print(Prometheus.colors(Prometheus.Config.NameUpper .. ": " .. ..., "red"))
1919
os.exit(1);
2020
end]]
2121

22-
-- see if the file exists
22+
-- Check if the file exists
2323
local function file_exists(file)
2424
local f = io.open(file, "rb")
2525
if f then f:close() end
2626
return f ~= nil
2727
end
28-
29-
-- get all lines from a file, returns an empty
28+
29+
-- get all lines from a file, returns an empty
3030
-- list/table if the file does not exist
3131
local function lines_from(file)
3232
if not file_exists(file) then return {} end
3333
local lines = {}
34-
for line in io.lines(file) do
34+
for line in io.lines(file) do
3535
lines[#lines + 1] = line
3636
end
3737
return lines
@@ -135,4 +135,4 @@ Prometheus.Logger:info(string.format("Writing output to \"%s\"", outFile));
135135
-- Write Output
136136
local handle = io.open(outFile, "w");
137137
handle:write(out);
138-
handle:close();
138+
handle:close();

src/prometheus/namegenerators/Il.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- This Script is Part of the Prometheus Obfuscator by Levno_710
22
--
3-
-- namegenerators/mangled.lua
3+
-- namegenerators/il.lua
44
--
55
-- This Script provides a function for generation of weird names consisting of I, l and 1
66

@@ -38,4 +38,4 @@ end
3838
return {
3939
generateName = generateName,
4040
prepare = prepare
41-
};
41+
};

src/prometheus/namegenerators/confuse.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- This Script is Part of the Prometheus Obfuscator by Levno_710
22
--
3-
-- namegenerators/mangled.lua
3+
-- namegenerators/confuse.lua
44
--
55
-- This Script provides a function for generation of confusing variable names
66

@@ -166,4 +166,4 @@ end
166166
return {
167167
generateName = generateName,
168168
prepare = prepare
169-
};
169+
};
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
-- This Script is Part of the Prometheus Obfuscator by Levno_710
22
--
3-
-- namegenerators/mangled.lua
3+
-- namegenerators/number.lua
44
--
55
-- This Script provides a function for generation of simple up counting names but with hex numbers
66

77
local PREFIX = "_";
88

99
return function(id, scope)
1010
return PREFIX .. tostring(id);
11-
end
11+
end

src/prometheus/randomStrings.lua

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
local Ast = require("prometheus.ast");
2-
3-
local charset = {}
4-
5-
-- qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890
6-
for i = 48, 57 do table.insert(charset, string.char(i)) end
7-
for i = 65, 90 do table.insert(charset, string.char(i)) end
8-
for i = 97, 122 do table.insert(charset, string.char(i)) end
1+
local Ast, utils = require("prometheus.ast"), require("prometheus.util");
2+
local charset = utils.chararray("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890")
93

104
local function randomString(wordsOrLen)
115
if type(wordsOrLen) == "table" then
@@ -27,4 +21,4 @@ end
2721
return {
2822
randomString = randomString,
2923
randomStringNode = randomStringNode,
30-
}
24+
}

src/prometheus/step.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- This Script is Part of the Prometheus Obfuscator by Levno_710
22
--
3-
-- util.lua
3+
-- step.lua
44
--
55
-- This file Provides the base class for Obfuscation Steps
66

@@ -76,4 +76,4 @@ end
7676
Step.Name = "Abstract Step";
7777
Step.Description = "Abstract Step";
7878

79-
return Step;
79+
return Step;

src/prometheus/util.lua

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ end
2424

2525
local function escape(str)
2626
return str:gsub(".", function(char)
27-
if char:match('[^ -~\n\t\a\b\v\r\"\']') then -- Check if non Printable Ascii Character
27+
if char:match('[^ -~\n\t\a\b\v\r\"\']') then -- Check if non Printable ASCII Character
2828
return string.format("\\%03d", string.byte(char))
2929
end
3030
if(char == "\\") then
@@ -108,6 +108,18 @@ local function shuffle(tb)
108108
end
109109
return tb
110110
end
111+
local function shuffle_string(str)
112+
local len = #str
113+
local t = {}
114+
for i = 1, len do
115+
t[i] = string.sub(str, i, i)
116+
end
117+
for i = 1, len do
118+
local j = math.random(i, len)
119+
t[i], t[j] = t[j], t[i]
120+
end
121+
return table.concat(t)
122+
end
111123

112124
local function readDouble(bytes)
113125
local sign = 1
@@ -255,6 +267,7 @@ return {
255267
chararray = chararray,
256268
keys = keys,
257269
shuffle = shuffle,
270+
shuffle_string = shuffle_string,
258271
readDouble = readDouble,
259272
writeDouble = writeDouble,
260273
readU16 = readU16,
@@ -270,4 +283,4 @@ return {
270283
toBits = toBits,
271284
bytesToString = bytesToString,
272285
readonly = readonly,
273-
}
286+
}

0 commit comments

Comments
 (0)