Extension Prometheus

Please add a feature request in the extension repo!

@Chung_Xa please, look and comment

1 Like


Today I’ve tried many times but still stuck at this file by this error.
Any clues to solve it?

Does it say anything in the editor logs?

I have some errors, when prometheus can’t build.
It was when I use “continue” string as a table key.

I recommend you to try build with Bob. You will see all prometheus errors.

Or read log in build folder

It’s exactly my issue. Not as a table key but a variable name

Which file in build folder contains infor about prometheus errors?

1 Like

I’m afraid that this is not true. I’ve just tested and this is what I recieved although I didn’t change any in code and setup already the Seed value to my number.

how your prometheus.lua file looks?

There’s also a mistery thing with this extension.
I’ve updated the extension so that it will be only worked when having prometheus.lua file but the when running it acted just like using somewhere Prometheus.java file, not my file.
I even deleted .internal/cache, .internal/libs, build/plugins/prometheus folders and then fetched libraries, tried to restart the editor. I can see the code changed but every time I run building, it says

2024-07-13 15:56:00 INFO    Obfuscating D:\Defold\Projects\KyHoang\scripts\utf8.lua 

C:\Users\chung\AppData\Local\Temp\5204355870568368611\x86_64-win32\luajit-64.exe: ...s\chung\AppData\Local\Temp\554505601878780961\logger.lua:54: The config file "D:\Defold\Projects\KyHoang\prometheus.lua" was not found!
stack traceback:
	[C]: in function 'error'
	...s\chung\AppData\Local\Temp\554505601878780961\logger.lua:54: in function 'errorCallback'
	...s\chung\AppData\Local\Temp\554505601878780961\logger.lua:57: in function 'error'
	...sers\chung\AppData\Local\Temp\554505601878780961\cli.lua:70: in main chunk
	[C]: at 0x7ff685ca8910
e[0me[31mPROMETHEUS: The config file "D:\Defold\Projects\KyHoang\prometheus.lua" was not found!e[0m

java.lang.Exception: Unable to run prometheus, return code: 1

	at com.defold.extension.pipeline.Prometheus.obfuscate(Prometheus.java:176)

	at com.dynamo.bob.pipeline.LuaBuilder.build(LuaBuilder.java:436)

	at com.dynamo.bob.Project.runTasks(Project.java:1892)

	at com.dynamo.bob.Project.createAndRunTasks(Project.java:1563)

	at com.dynamo.bob.Project.doBuild(Project.java:1690)

	at com.dynamo.bob.Project.build(Project.java:742)

	at editor.pipeline.bob$run_commands_BANG_$fn__56498.invoke(bob.clj:150)

	at editor.pipeline.bob$run_commands_BANG_.invokeStatic(bob.clj:149)

	at editor.pipeline.bob$bob_build_BANG_.invokeStatic(bob.clj:224)

	at editor.disk$async_bob_build_BANG_$fn__57606$fn__57609$fn__57610.invoke(disk.clj:250)

	at clojure.core$binding_conveyor_fn$fn__5739.invoke(core.clj:2030)

	at clojure.lang.AFn.call(AFn.java:18)

	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)

	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)

	at java.base/java.lang.Thread.run(Thread.java:833)

but my file is like this:

return {
	-- The default LuaVersion is Lua51
	LuaVersion = "Lua51", -- or "LuaU"
	-- All Variables will start with this prefix
	VarNamePrefix = "",
	-- Name Generator for Variables that look like this: b, a, c, D, t, G
	NameGenerator = "MangledShuffled",
	-- No pretty printing
	PrettyPrint = false,
	-- Seed is generated based on current time 
	-- When specifying a seed that is not 0, you will get the same output every time
	Seed = 7034,
	-- Obfuscation steps
	Steps = {
		{
			-- This obfuscation step puts all constants into an array at the beginning of the code
			Name = "ConstantArray",
			Settings = {
				-- Apply to Strings only
				StringsOnly = true,
				-- Apply to all Constants, 0.5 would only affect 50% of strings
				Treshold    = 1,
			},
		},
	}
}

What if you remove obfuscation step? Will be content same?

If you changed java cole, you need to rebuild plugin.
After plugin rebuild you will have jar file in build folder. Then you need change plugin.jar to your new version

2 Likes

There are a few files changed hexDigest value unknown cause but not as much as when using obfuscation.

The extension uses a pipeline extension, and it’s built from Prometheus.java.
As mentioned, have you rebuilt the plugin?
The is a pre-build step, and is not done automaticlally.

See build_plugin.sh for guidance.

3 Likes

I’ve built it and it works as expected

1 Like

I struggle to confirm that prometheus obfuscation take place while build or bundle. I have prometheus.lua file with default configuration. I have log like this

Found plugins: 
2024-11-26 06:20:09 INFO      build/plugins/prometheus/plugins/share/pluginPrometheus.jar 
2024-11-26 06:20:09 INFO      build/plugins/prometheus/plugins/share/pluginPrometheusSource.jar 
2024-11-26 06:20:09 INFO     

but later I dont see any log that would suggest prometheus obfuscate some files. Also I have problem to found some tool to decompress .arcd file and look if they are obfuscated or not so I cant confirm if files were obfustated. Also if I add mistakes to prometheus.lua file I dont get any errors.

You should see this line in the console for every Lua file that is obfuscated

Obfuscating /Users/bjornritzl/projects/extension-prometheus/main/main.script

A few moment ago we released a new version of the extension which works with new versions of bob which build project resources using multiple threads. In this version the log will also show the path of the temporary file where the obfuscated version of a Lua file is located:

Obfuscating /Users/bjornritzl/projects/extension-prometheus/main/main.script to /var/folders/11/46kfq53d3qg84mb4gjdm5hk40000gn/T/prometheus5494517346464807231

There is a python script here: https://github.com/defold/defold/blob/dev/scripts/unpack_arc.py

2 Likes

is fetching prometheus library and prometheus.lua all that is needed for code to be obfuscated or I missed some steps?

That should be all. Try with the latest version of the plugin and look for the console logs I mentioned. If it doesn’t work then please share some more information, for instance which OS you using.

1 Like

thank you for your help, unfortunately after syncing my prometheus fork here https://github.com/karol-wolonciej/extension-prometheus/archive/master.zip and removing and adding again and fetching to defold with prometheus.lua like this below I still dont get any log suggesting obfuscation is taking place. I am using linux ubuntu 24 lts wayland session. I think I have updated defold version 1.9.5.

return {
	-- The default LuaVersion is Lua51
	LuaVersion = "Lua51"; -- or "LuaU"
	-- All Variables will start with this prefix
	VarNamePrefix = "";
	-- Name Generator for Variables that look like this: b, a, c, D, t, G
	NameGenerator = "MangledShuffled";
	-- No pretty printing
	PrettyPrint = false;
	-- Seed is generated based on current time 
	-- When specifying a seed that is not 0, you will get the same output every time
	Seed = 0;
	-- Obfuscation steps
	Steps = {
		{
			-- This obfuscation step puts all constants into an array at the beginning of the code
			Name = "ConstantArray";
			Settings = {
				-- Apply to Strings only
				StringsOnly = true;
				-- Apply to all Constants, 0.5 would only affect 50% of strings
				Treshold    = 1;
			}
		},
	}
}