prometheus-lua / Prometheus

Lua Obfuscator written in pure Lua
https://levno-710.gitbook.io/prometheus/
GNU Affero General Public License v3.0
220 stars 65 forks source link

[BUG] Doesn't launch #14

Closed yanNotDev closed 2 years ago

yanNotDev commented 2 years ago

Describe the bug Upon running lua ./cli.lua --preset Strong ./test.lua i get the following output

lua: ./src/obfuscator/util.lua:7: module 'bit' not found:
    no field package.preload['bit']
    no file './src/bit.lua'
    no file './src/bit.lua'
    no file './bit.lua'
    no file '/usr/share/lua/5.4/bit.lua'
    no file '/usr/share/lua/5.4/bit/init.lua'
    no file '/usr/lib/lua/5.4/bit.lua'
    no file '/usr/lib/lua/5.4/bit/init.lua'
    no file './bit.lua'
    no file './bit/init.lua'
    no file '/usr/lib/lua/5.4/bit.so'
    no file '/usr/lib/lua/5.4/loadall.so'
    no file './bit.so'
stack traceback:
    [C]: in function 'require'
    ./src/obfuscator/util.lua:7: in main chunk
    [C]: in function 'require'
    ./src/obfuscator/enums.lua:8: in main chunk
    [C]: in function 'require'
    ./src/obfuscator/pipeline.lua:10: in main chunk
    [C]: in function 'require'
    ./src/prometheus.lua:16: in main chunk
    [C]: in function 'require'
    ./src/cli.lua:13: in main chunk
    [C]: in function 'require'
    ./cli.lua:12: in main chunk
    [C]: in ?

Expected behavior The file was supposed to run properly

To Reproduce Steps to reproduce the behavior: Have an arch system with the following lua-related packages installed: lua 5.4.3-1 lua51 5.1.5-9 lua52 5.2.4-5 lua53 5.3.6-1 luajit 2.0.5-3 luarocks 3.8.0-1

git clone the repo, cd into it, and do lua ./cli.lua --preset Strong ./test.lua

tornadia commented 2 years ago

Solution:

levno-710 commented 2 years ago

Fixed

The issue was, that a package was required, that is not present on every system. This was due to me only testing using luajit, where the "bit" package is included. I changed

local bit32 = require("bit");

to

local bit32 = require("prometheus.bit").bit32;

This change is incorporated in the newest release v0.1.6.

Please keep in mind that prometheus was developed for lua51, so it may fail when running on other lua versions.

Thanks to @tornadia for proposing a quick fix for this issue.