The Gmod Backdoor Scanner project is a C++ application developed to scan directories for potential backdoors in Garry's Mod (Gmod) related files. It supports scanning .lua, .vmt, .vtf, and .ttf files for suspicious patterns, such as obfuscated code or malicious function calls, using regular expressions defined in pattern files. The scanner generates a JSON-formatted log file (scan_log.json) with detailed detection results.
This project is not guaranteed to find everything, and will most likely include a few false positives with every scan. Use your own intuition alongside this tool for the best results.
- Scans directories recursively for
.lua,.vmt,.vtf, and.ttffiles. - Supports detection of patterns like
RunString,http.Fetch, and CharCode obfuscation. - Parallel file processing using
std::asyncfor improved performance. - Unicode support for file paths using
std::wstring. - Command-line argument support (
-d <directory>) for automation. - JSON-formatted logging for easy parsing of results.
- Robust error handling for file operations, regex compilation, and path validation.
- C++17 Compiler: Visual Studio 2019 or later (with
v143toolset). - nlohmann/json: JSON for Modern C++ library (available at https://github.com/nlohmann/json).
- Operating System: Windows (with plans for cross-platform support in future versions).
- Pattern Files:
lua_patterns.txt,vmt_patterns.txt,vtf_patterns.txt, andttf_patterns.txtmust be present in the working directory.
- Clone or Download the Project:
- Download the project files or clone the repository.
- Install nlohmann/json:
- Download
json.hppfrom https://github.com/nlohmann/json and place it in the project directory. - Ensure the project directory is included in the include path (configured in
BD-Scan.vcxproj).
- Download
- Open in Visual Studio:
- Open
BD-Scan.slnin Visual Studio (2019 or later). - Ensure the C++17 standard is enabled (
/std:c++17).
- Open
- Build the Project:
- Build for Debug or Release (Win32 or x64).
- The executable
BD-Scan.exewill be generated in the output directory.
- Run the Scanner:
- Interactive Mode: Run
BD-Scan.exeand enter the directory path when prompted. - Command-Line Mode: Use
BD-Scan.exe -d "C:\Path\To\Directory"to specify the directory directly.
- Interactive Mode: Run
- Check Output:
- Results are logged to
scan_log.jsonin the working directory. - Console output displays scan progress, duration, and summary statistics.
- Results are logged to
- Example:
BD-Scan.exe -d "D:\TestDir"- Scans
D:\TestDirfor.lua,.vmt,.vtf, and.ttffiles. - Outputs detections to
scan_log.jsonand the console.
- Scans
An example scan_log.json might look like this:
{
"detections": [
{
"file": "D:/TestDir/test.lua",
"detection": "Code Execution (RunString)",
"line_number": 1,
"line_text": "RunString(\"print('Hello')\")"
},
{
"file": "D:/TestDir/test.lua",
"detection": "http.Fetch",
"line_number": 2,
"line_text": "http.Fetch(\"http://example.com\")"
},
{
"file": "D:/TestDir/test.vmt",
"detection": "CharCode",
"line_number": 1,
"line_text": "97,98,99"
},
{
"file": "D:/TestDir/test.vmt",
"detection": "CharCode",
"line_number": 1,
"line_text": "Decoded Char Code: abc"
}
],
"start_time": 1234567890,
"end_time": 1234567895,
"files_processed": 2,
"detections_found": 4
}To test the scanner:
- Create a test directory with sample files, e.g.:
// test.lua RunString("print('Hello')") http.Fetch("http://example.com")
// test.vmt 97,98,99 - Run the scanner:
BD-Scan.exe -d "D:\TestDir" - Verify the output in
scan_log.jsonand the console.
- Linker Errors: Ensure all global vectors are defined in
BD-Scan.cppand thatnlohmann/json.hppis correctly included. - Compiler Warnings: If warnings about JSON initialization persist, consider adjusting the warning level (e.g.,
/W3instead of/W4) or suppressing specific warnings with#pragma warning(disable:26495). - Missing Pattern Files: Ensure
lua_patterns.txt,vmt_patterns.txt,vtf_patterns.txt, andttf_patterns.txtare in the working directory. - File Access Issues: Verify that the specified directory is accessible and contains valid files.
- hashfarm: Original developer and creator of the Gmod Backdoor Scanner project.
- Hungryy2K: Implemented major improvements in July 2025, including linker fixes, JSON logging, parallel processing, and Unicode support.
The following improvements were implemented by Hungryy2K in July 2025:
- Fixed Linker Errors: Defined global vectors (
LuaCheckPatterns,LuaCheckDefs, etc.) inBD-Scan.cppto resolve unresolved external symbol errors. - Resolved Switch-Case Warnings: Replaced
switchwithif-elseinCheckLineto eliminatefallthroughwarnings, ensuring compatibility with stricter compiler settings. - Improved JSON Initialization: Explicitly initialized
logJsonasjson::object()to suppress static analyzer warnings about uninitialized members. - Enhanced Detections Counter: Refined logic in
ProcessFileto count only actual pattern matches, improving accuracy of thedetections_foundmetric. - Added Unicode Support: Used
std::wstringfor directory input to handle non-ASCII paths. - Command-Line Support: Added support for
-d <directory>argument to specify the scan directory directly. - JSON Logging: Implemented structured JSON output in
scan_log.jsonwith details on detected patterns, file paths, and scan statistics. - Performance Optimization: Introduced parallel processing with
std::asyncfor faster scanning of large directories. - Error Handling: Added robust checks for empty files, invalid paths, and regex compilation errors.
- Pattern Refinement: Updated
vmt_patterns.txtandttf_patterns.txtto improve CharCode detection with the regex[0-9]{2,3}(,[0-9]{2,3})*.
- Add support for additional file types or patterns.
- Implement base64 decoding for obfuscated code detection.
- Enhance cross-platform compatibility (e.g., Linux support).
- Add configuration options for custom log formats or scan parameters.
For issues or feature requests, please contact the developer or open an issue in the hashfarm project repository.