Garrysmod Lua Dumper & Runner, written in Rust.
- Dumping all lua scripts to
C:\Users\<User>\autorun\lua_dumps\<ServerIP>\..
(asynchronously to avoid i/o lag) - Runtime lua loading through
lua_run
andlua_openscript
in an external console - Supports both 32* and 64 bit branches (*See #22)
- Running a script before autorun (
autorun.lua
), to detour and bypass any 'anticheats' - Scripthook, stop & run scripts before anything runs on you, gives information & functions to assist in a safe separate lua environment
- File logging (to
autorun/logs
) - Plugin system (
autorun/plugins
) - Settings using TOML
Autorun can also be used as a menu plugin / required from lua automatically from the menu state.
- Put the dll
gmsv_autorun_win<arch>.dll
file into yourgarrysmod/lua/bin
folder. - Add
require("autorun")
at the bottom ofgarrysmod/lua/menu/menu.lua
It will now run automatically when garrysmod loads at the menu.
The traditional (but more inconvenient) method to use this is to just inject it.
- Get an injector (Make sure it's compatible to inject 32/64 bit code depending on your use).
- Inject the dll into gmod while you're in the menu
Autorun features scripthook, which means we'll run your script before any other garrysmod script executes to verify if you want the code to run by running your own hook script.
*This runs in a separate environment from _G
, so to modify globals, do _G.foo = bar
Also note that if you are running in autorun.lua
Functions like http.Fetch
& file.Write
won't exist.
Use their C counterparts (HTTP
and file.Open
)
See an example project using the scripthook here.
C:\Users\<User>\autorun
├── \autorun.lua # Runs *once* before autorun
├── \hook.lua # Runs for every script
├── \lua_dumps\ # Each server gets a folder with their IP as the name.
│ ├── \192.168.1.55_27015\
│ └── \X.Y.Z.W_PORT\
├── \logs\ # Logs are saved here
│ └── YYYY-MM-DD.log
├── \bin\ # Store binary modules to be used with Autorun.requirebin
│ └── gmcl_vistrace_win64.dll
├── \plugins\ # Folder for Autorun plugins, same behavior as above autorun and hook.lua, but meant for plugin developers.
│ └── \Safety\
│ ├── \src\
| | ├── autorun.lua
| | └── hook.lua
│ └── plugin.toml
├── settings.toml # See autorun/src/configs/settings.toml
└── ...
You can find what is passed to the scripthook environment in fields.lua as an EmmyLua definitions file.
This could be used with something like a vscode lua language server extension for intellisense 👍
hook.lua
This file runs before every single lua script run on your client from addons and servers.
You can return true
to not run the script, or a string to replace it.
-- Replace all 'while true do end' scripts with 'while false do end' 😎
local script = Autorun.CODE
if script:find("while true do end") then
Autorun.log("Found an evil script!")
return string.Replace(script, "while true do end", "while false do end")
end
You can find more here
You can get a 'stable' release from the releases.
You can get the absolute latest download (from code in the repo) in the Github Actions tab
Note it may not work as expected (but I'd advise to try this out before trying to report an issue to see if it has been fixed)
If you are using this as a menu plugin 🧩, make sure the DLL is named gmsv_autorun_win<arch>.dll
You may want to build this yourself if you want to make changes / contribute (or don't trust github actions for whatever reason..)
- Setup Rust & Cargo
- Use
build_win_32.bat
orbuild_win_64.bat
.