Skip to content

Commit d6796fd

Browse files
authored
Merge pull request #54 from levno-710/develop
2 parents 206ab81 + d37a6c7 commit d6796fd

File tree

9 files changed

+47
-274
lines changed

9 files changed

+47
-274
lines changed

doc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ description: Prometheus is an Lua Obfuscator, that is written in pure Lua.
66

77
Prometheus can obfuscate Lua51 as well as Roblox's LuaU, which is an optionally typed superset of Lua51.
88

9-
Show Prometheus on [github](https://github.com/levno-710/Prometheus).
9+
View Prometheus on [github](https://github.com/levno-710/Prometheus).
1010

1111
This Documentation only applies to the newest version of Prometheus.

doc/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* [SplitStrings](steps/splitstrings.md)
1919
* [ProxifyLocals](steps/proxifylocals.md)
2020
* [LocalsToTable](steps/localstotable.md)
21+
* [EncryptStrings](steps/encryptstrings.md)
2122
* [ConstantArray](steps/constantarray.md)
2223

2324
## advanced

doc/getting-started/command-line-options.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
The following table provides a brief overview over the command line options:
44

5-
| Option | Usage | |
6-
| ----------------------------- | ----------------------------------------------------------- | - |
7-
| --preset \[name]; --p \[name] | Specify the config preset to be used; [Details](presets.md) | |
8-
| --config \[path]; --c \[path] | Specify the path to a custom config file | |
9-
| --out \[path]; --o \[path] | Specify the path of the output file | |
10-
| --nocolors | Disable ansi colors escape sequences | |
5+
| Option | Usage |
6+
| ----------------------------- | ----------------------------------------------------------- |
7+
| --preset \[name]; --p \[name] | Specify the config preset to be used; [Details](presets.md) |
8+
| --config \[path]; --c \[path] | Specify the path to a custom config file |
9+
| --out \[path]; --o \[path] | Specify the path of the output file |
10+
| --nocolors | Disable ansi colors escape sequences |
11+
| --Lua51 | Handle input as Lua 5.1 |
12+
| --LuaU | Handle input as LuaU |
13+
| --pretty | Pretty print the output |

doc/getting-started/installation.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,3 @@ git clone "https://github.com/levno-710/Prometheus.git"
99
Alternatively you can download the Sources [here](https://github.com/levno-710/Prometheus/archive/refs/heads/master.zip).
1010

1111
Prometheus also Requires LuaJIT or Lua51 in order to work. The Lua51 binaries can be downloaded [here](https://sourceforge.net/projects/luabinaries/files/5.1.5/Tools%20Executables/).
12-
13-
There is also a bundled release for windows, which includes the luajit runtime. This may be usefull for adding prometheus to %PATH% and then directly using it as a command. It can be downloaded [here](https://github.com/levno-710/prometheus/releases).

doc/getting-started/obfuscating-your-first-script.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ Now run the following command inside of the Prometheus directory:
1818
lua ./cli.lua ./hello_world.lua
1919
```
2020

21-
When using the windows release `lua ./cli.lua` must be substituted by `prometheus.exe`.
22-
2321
You may notice, that the console output looks weird. If that is the case, your terminal does not support ansi color escape sequences. You should add the `--nocolors` option:
2422

2523
```batch
@@ -37,17 +35,16 @@ print("Hello, World")
3735
As you can see, the file hasn't changed at all. That is because by default prometheus is just a minifier and the code we gave it was already as small as possible. To actually obfuscate the file, prometheus must be told which obfuscation steps it should apply in which order. In order to do this, the cli provides the `--preset` option which allows you to specify the name of a predefined configuration. There are currently the following presets:
3836

3937
* Minify
40-
* Vm
4138
* Weak
4239
* Medium
4340
* Strong
4441

4542
In order to perform the obfuscation, you need to specify that Prometheus should use the Strong preset:
4643

4744
```batch
48-
lua ./cli.lua --preset Strong ./hello_world.lua
45+
lua ./cli.lua --preset Medium ./hello_world.lua
4946
```
5047

51-
The `hello_world.obfuscated.lua` should now become around 20kB in size, but when running, it should still print "Hello World".
48+
The `hello_world.obfuscated.lua` should now contain the obfuscated code that should still print "Hello World".
5249

53-
Note that using the "Strong" preset is not recommended for large projects as bigger files will get around 15x in size.
50+
Note that using the "Strong" preset is not recommended for large projects.

doc/getting-started/presets.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
The following table provides an overview over the presets
44

5-
| name | usage | size | speed |
6-
| ------ | -------------------------------------------------------------------------------------------------------- | ------ | ------- |
7-
| Minify | Simply minifies your source file | tiny | fastest |
8-
| Vm | Compiles your source file using a custom compiler and implements a vm for running the generated bytecode | big | slow |
9-
| Weak | Extracts all Strings from your Program and puts them into a table at the beginning of the Program | small | fast |
10-
| Medium | Applies more advanced obfuscation techniques. | medium | medium |
11-
| Strong | Applies almost all obfuscation techniques that prometheus provides. | huge | slowest |
5+
| name | size | speed |
6+
| ------ | ------ | ------- |
7+
| Minify | tiny | fastest |
8+
| Weak | small | fast |
9+
| Medium | medium | medium |
10+
| Strong | huge | slowest |

doc/steps/encryptstrings.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
description: This Step will encrypt all String constants in your code
3+
---
4+
5+
# EncryptStrings
6+
7+
## Settings
8+
9+
None
10+
11+
## Example
12+
13+
{% code title="in.lua" %}
14+
```lua
15+
print("Hello, World!")
16+
```
17+
{% endcode %}
18+
19+
{% code title="out.lua" %}
20+
```lua
21+
-- Settings: None
22+
local x,F do local k=math.floor local I=math.random local Y=table.remove local i=string.char local K=0 local J=2 local Q={}local W={}local q=0 local R={}for F=1,256,1 do R[F]=F end repeat local F=I(1,#R)local x=Y(R,F)W[x]=i(x-1)until#R==0 local j={}local function B()if#j==0 then K=(K*173+8408159861491)%35184372088832 repeat J=(J*160)%257 until J~=1 local F=J%32 local x=(k(K/2^(13-(J-F)/32))%4294967296)/2^F local I=k((x%1)*4294967296)+k(x)local Y=I%65536 local i=(I-Y)/65536 local Q=Y%256 local W=(Y-Q)/256 local q=i%256 local R=(i-q)/256 j={Q,W;q,R}end return table.remove(j)end local d={}x=setmetatable({},{__index=d,__metatable=nil})function F(x,k)local I=d if I[k]then else j={}local F=W K=k%35184372088832 J=k%255+2 local Y=string.len(x)I[k]=""local i=198 for Y=1,Y,1 do i=((string.byte(x,Y)+B())+i)%256 I[k]=I[k]..F[i+1]end end return k end end print(x[F("\219\018Q%~Y\225\128u\128\208&\155",6909832146399)])
23+
```
24+
{% endcode %}

doc/steps/vmify.md

Lines changed: 1 addition & 248 deletions
Original file line numberDiff line numberDiff line change
@@ -1,256 +1,9 @@
11
---
2-
description: >-
3-
This Step will Compile your script into a fully-custom (not a half custom like
4-
other lua obfuscators) Bytecode Format and emit a vm for executing it.
2+
description: This Step will Compile your script and run it within a Vm
53
---
64

75
# Vmify
86

97
### Settings
108

119
None
12-
13-
### Example
14-
15-
{% code title="in.lua" %}
16-
```lua
17-
print("Hello, World!")
18-
```
19-
{% endcode %}
20-
21-
{% code title="out.lua" %}
22-
```lua
23-
-- No Settings
24-
local K, B, w, Z, s, M, G, V, u, p, f, P, J, c, W, g, j, X, T, o, r, i, q, L, I, D, R, F, y, Y
25-
u = function(K, B, ...)
26-
local Z = {...}
27-
local s = 0
28-
local M = 1
29-
for B = 0, B - 1, 1 do
30-
s = s + J(w[K + B], Z and Z[B + 1] or 0) * M
31-
M = M * 256
32-
end
33-
return s
34-
end
35-
T = string["find"]
36-
P = bit32 and bit32["bxor"]
37-
F = function(B)
38-
local w = {}
39-
B =
40-
r(
41-
r(
42-
B,
43-
".",
44-
function(K)
45-
if K == "=" then
46-
return ""
47-
end
48-
local B, w = "", T(g, K) - 1
49-
for K = 6, 1, -1 do
50-
B = B .. (w % 2 ^ K - w % 2 ^ (K - 1) > 0 and "1" or "0")
51-
end
52-
return B
53-
end
54-
),
55-
"%d%d%d?%d?%d?%d?%d?%d?",
56-
function(B)
57-
if #B ~= 8 then
58-
return ""
59-
end
60-
local w = 0
61-
for K = 1, 8, 1 do
62-
w = w + (M(B, K, K) == "1" and 2 ^ (8 - K) or 0)
63-
end
64-
return K(w)
65-
end
66-
)
67-
for K = 1, #B, 1 do
68-
w[K] = y(B, K)
69-
end
70-
return w
71-
end
72-
M = string["sub"]
73-
Z = function()
74-
J = P or X
75-
w = F(w)
76-
i()
77-
return (Y(I[1], D()))()
78-
end
79-
r = string["gsub"]
80-
s = table and table["unpack"] or unpack
81-
c = 4
82-
G = math["floor"]
83-
y = string["byte"]
84-
Y = function(K, B, w)
85-
return function(...)
86-
return s(f(K, {...}, B, w))
87-
end
88-
end
89-
f = function(Z, M, G, p)
90-
local f = {[0] = p}
91-
local P = {}
92-
local g = 0
93-
local j, X, T, r, i, q
94-
X = c + (Z - 1) * 4
95-
j = J(w[X], 4)
96-
while true do
97-
T = true
98-
while j == 204 do
99-
if g > 0 then
100-
r = P[g]
101-
else
102-
r = nil
103-
end
104-
P = P[0]
105-
g = P["l"] + 1
106-
P[g] = r
107-
Z = Z + 1
108-
X = c + (Z - 1) * 4
109-
j = J(w[X], 4)
110-
T = false
111-
end
112-
while j == 220 do
113-
P[g] = G[P[g]]
114-
Z = Z + 1
115-
X = c + (Z - 1) * 4
116-
j = J(w[X], 4)
117-
T = false
118-
end
119-
while j == 12 do
120-
P = {[0] = P[0]}
121-
g = 0
122-
Z = Z + 1
123-
X = c + (Z - 1) * 4
124-
j = J(w[X], 4)
125-
T = false
126-
end
127-
while j == 82 do
128-
g = g - 1
129-
P[g], P[g + 1] = {P[g](s(P[g + 1]))}, nil
130-
Z = Z + 1
131-
X = c + (Z - 1) * 4
132-
j = J(w[X], 4)
133-
T = false
134-
end
135-
while j == 5 do
136-
r = {}
137-
for K, B in ipairs(P) do
138-
r[K] = B
139-
end
140-
g = 1
141-
P = {[0] = P[0], [1] = r}
142-
Z = Z + 1
143-
X = c + (Z - 1) * 4
144-
j = J(w[X], 4)
145-
T = false
146-
end
147-
while j == 114 do
148-
return {}
149-
end
150-
while j == 105 do
151-
q = u(X + 1, 3, 102, 103, 175)
152-
g = g + 1
153-
P[g] = V[q]
154-
if not P[g] then
155-
r = B[q] + o
156-
i = w[r]
157-
if i == 153 then
158-
i = u(r + 1, 4)
159-
P[g] = ""
160-
for B = 1, i, 1 do
161-
P[g] = P[g] .. K(w[r + (B + 4)])
162-
end
163-
elseif i == 22 then
164-
P[g] = W(r + 1)
165-
elseif i == 82 then
166-
P[g] = u(r + 1, 4)
167-
elseif i == 125 then
168-
P[g] = -u(r + 1, 4)
169-
end
170-
V[q] = P[g]
171-
end
172-
Z = Z + 1
173-
X = c + (Z - 1) * 4
174-
j = J(w[X], 4)
175-
T = false
176-
end
177-
while j == 122 do
178-
P["l"] = g
179-
g = 0
180-
P = {[0] = P}
181-
Z = Z + 1
182-
X = c + (Z - 1) * 4
183-
j = J(w[X], 4)
184-
T = false
185-
end
186-
if T then
187-
Z = Z + 1
188-
X = c + (Z - 1) * 4
189-
j = J(w[X], 4)
190-
end
191-
end
192-
end
193-
X = function(K, B, w, ...)
194-
local Z = 0
195-
for w = 0, 31, 1 do
196-
local s = K / 2 + B / 2
197-
if s ~= G(s) then
198-
Z = Z + 2 ^ w
199-
end
200-
K = G(K / 2)
201-
B = G(B / 2)
202-
end
203-
if w then
204-
return X(Z, w, ...)
205-
end
206-
return Z
207-
end
208-
K = string["char"]
209-
p = table["remove"]
210-
i = function()
211-
R = u(1, 3)
212-
I = {}
213-
for K = 0, R - 1, 1 do
214-
I[K + 1] = u(c + K * 3, 3)
215-
end
216-
c = c + R * 3
217-
q = u(c, 3)
218-
for K = 0, q - 1, 1 do
219-
B[K + 1] = u(c + (3 + K * 4), 4)
220-
end
221-
c = c + (q * 4 + 6)
222-
L = u(c - 3, 3)
223-
o = c + L * 4
224-
end
225-
B = {}
226-
I = {}
227-
W = function(K)
228-
local B = {}
229-
for Z = 0, 7, 1 do
230-
B[Z + 1] = w[K + Z]
231-
end
232-
local Z = 1
233-
local s = B[2] % 16
234-
for K = 3, 8, 1 do
235-
s = s * 256 + B[K]
236-
end
237-
if B[1] > 127 then
238-
Z = -1
239-
end
240-
local M = B[1] % 128 * 16 + G(B[2] / 16)
241-
if M == 0 then
242-
return 0
243-
end
244-
s = (j(s, -52) + 1) * Z
245-
return j(s, M - 1023)
246-
end
247-
g = 'UnE,Sux\tVWQ"!T5h\b:jR\nq\v2oMOHcpvCD\'XL4d6JgYmbI1etZw3Pf9ak/K8;B\ays'
248-
D = getfenv
249-
w =
250-
'U\bUUU\bUUUDUUUUUUUUgUUUUQUUnUn\'\'jH\vpJb\a\'\tRf\'yKsH3H\v:JbZ\t1K\'"V\bQmQq\'EOVDXc2ypa"J\vw6\b\nUUUnZc6depW4TUUUUjxqIHxBIVuptc6w4V\b=='
251-
j = math["ldexp"]
252-
V = {}
253-
return Z()
254-
255-
```
256-
{% endcode %}

readme.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ To install Prometheus, simply clone the Github Repository using:
1414
git clone https://github.com/levno-710/Prometheus.git
1515
```
1616

17-
Alternatively you can download the Sources [here](https://github.com/Levno710/Prometheus/archive/refs/heads/master.zip).
17+
Alternatively you can download the Sources [here](https://github.com/levno-710/Prometheus/archive/refs/heads/master.zip).
1818

1919
Prometheus also Requires LuaJIT or Lua51 in order to work. The Lua51 binaries can be downloaded [here](https://sourceforge.net/projects/luabinaries/files/5.1.5/Tools%20Executables/).
2020

21-
On Windows the windows release can also be used, which includes everything needed to run the prometheus cli.
2221
## Usage
2322
To quickly obfuscate a script:
2423
```batch
@@ -54,7 +53,6 @@ lua ./cli.lua [options]
5453
- [levno-710](https://github.com/levno-710)
5554
- [brandonsturgeon](https://github.com/brandonsturgeon)
5655
- [pnlmon](https://github.com/pnlmon)
57-
### Libraries Used
58-
- [lua-bit-numberlua](https://github.com/davidm/lua-bit-numberlua)
56+
- [britzl](https://github.com/britzl)
5957
## License
6058
This Project is Licensed under the GNU General Public License v3.0. For more details, please refer to [LICENSE](https://github.com/levno-710/Prometheus/blob/master/LICENSE).

0 commit comments

Comments
 (0)