Skip to content

Commit

Permalink
Added inject_only_vac_bypass option and changed vac3 bypass binary
Browse files Browse the repository at this point in the history
- Changed vac3 bypass binary to a new online compiled with llvm-obfuscator
  • Loading branch information
b1scoito committed Jun 1, 2022
1 parent f013091 commit f5db0c7
Show file tree
Hide file tree
Showing 7 changed files with 11,200 additions and 1,241 deletions.
5 changes: 5 additions & 0 deletions cozinha_loader/Directory.build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<LLVMInstallDir>C:\dev\llvm\ollvm-14</LLVMInstallDir>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions cozinha_loader/cozinha_loader.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<LLVMToolsVersion>14.0.4</LLVMToolsVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
35 changes: 19 additions & 16 deletions cozinha_loader/injection.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "pch.hpp"
#include "injection.hpp"

bool c_injector::initalize( const std::filesystem::path dll_path )
bool c_injector::initalize()
{
if ( vars::b_inject_vac_bypass )
if ( vars::b_inject_vac_bypass || vars::b_inject_only_vac_bypass )
{
log_debug( L"Closing processes..." );

Expand All @@ -16,7 +16,7 @@ bool c_injector::initalize( const std::filesystem::path dll_path )
return failure( L"Failed to get Steam path!" );

std::wstring launch_append = {};
if ( vars::b_open_game_automatically )
if ( vars::b_open_game_automatically && !vars::b_inject_only_vac_bypass )
{
for ( const auto& it : this->vec_app_ids )
{
Expand All @@ -29,7 +29,7 @@ bool c_injector::initalize( const std::filesystem::path dll_path )
launch_append += L" -windowed -w 1280 -h 720";
#endif

PROCESS_INFORMATION pi; // Could use the current handle instead of closing it for steam, might do it in the future...
PROCESS_INFORMATION pi = {}; // Could use the current handle instead of closing it for steam, might do it in the future...
if ( !memory::open_process( steam_path, { L"-console", launch_append }, pi ) )
return failure( L"Failed to open Steam!", { pi.hProcess, pi.hThread } );

Expand All @@ -44,16 +44,19 @@ bool c_injector::initalize( const std::filesystem::path dll_path )
return false;

// Start Steam heartbeat thread
std::thread(&c_injector::check_for_steam_thread, this).detach();
std::thread( &c_injector::check_for_steam_thread, this ).detach();
}

std::vector<std::uint8_t> dll_buffer = {};
if ( !util::read_file_to_memory( std::filesystem::absolute( dll_path ), &dll_buffer ) )
return failure( L"Failed to write DLL to memory!" );
if ( !vars::b_inject_only_vac_bypass )
{
std::vector<std::uint8_t> dll_buffer = {};
if ( !util::read_file_to_memory( std::filesystem::absolute( vars::global_dll_path ), &dll_buffer ) )
return failure( L"Failed to write DLL to memory!" );

// Inject DLL to process
if ( !this->map( string::to_unicode( vars::str_process_name ), string::to_unicode( vars::str_process_mod_name ), dll_buffer ) )
return false;
// Inject DLL to process
if ( !this->map( string::to_unicode( vars::str_process_name ), string::to_unicode( vars::str_process_mod_name ), dll_buffer ) )
return false;
}

return true;
}
Expand Down Expand Up @@ -114,7 +117,7 @@ bool c_injector::map( std::wstring_view str_proc, std::wstring_view wstr_mod_nam
std::uint8_t restore[5];
std::memcpy( restore, ntopenfile_ptr, sizeof( restore ) );

const auto result = bb_proc.memory().Write( (std::uintptr_t) ntopenfile_ptr, restore );
const auto result = bb_proc.memory().Write( (std::uintptr_t)ntopenfile_ptr, restore );

if ( !NT_SUCCESS( result ) )
return failure( L"Failed to write patch memory!" );
Expand Down Expand Up @@ -180,14 +183,14 @@ void c_injector::check_for_steam_thread()
while ( true )
{
proc_list = memory::get_process_list();
if (!memory::is_process_open(proc_list, L"steam.exe"))
if ( !memory::is_process_open( proc_list, L"steam.exe" ) )
break;

std::this_thread::sleep_for(150ms);
std::this_thread::sleep_for( 150ms );
}

log_warn(L"Steam was closed, exiting...");
log_warn( L"Steam was closed, exiting..." );

// Exit if steam was closed (because they logged off or other reasons...)
std::exit(0);
std::exit( 0 );
}
6 changes: 3 additions & 3 deletions cozinha_loader/injection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class c_injector
{
private:
// Manual maps buffer into process
bool map(std::wstring_view str_proc, std::wstring_view wstr_mod_name, std::vector<std::uint8_t> vec_buffer, blackbone::eLoadFlags flags = blackbone::WipeHeader);
bool map( std::wstring_view str_proc, std::wstring_view wstr_mod_name, std::vector<std::uint8_t> vec_buffer, blackbone::eLoadFlags flags = blackbone::WipeHeader );

// Close an array of processes
void close_processes(std::vector<std::wstring> vec_processes);
void close_processes( std::vector<std::wstring> vec_processes );

// A heartbeat thread for the vac bypass
void check_for_steam_thread();
Expand All @@ -42,7 +42,7 @@ class c_injector
~c_injector() = default;

// Initialize routine
bool initalize( const std::filesystem::path dll_path );
bool initalize();
};

inline auto g_injector = std::make_unique<c_injector>();
34 changes: 20 additions & 14 deletions cozinha_loader/main.cpp
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
#include "pch.hpp"
#include "injection.hpp"

INT WINAPI WinMain( _In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
INT WINAPI WinMain( _In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine, _In_ int nShowCmd )
{
std::atexit( [] { std::this_thread::sleep_for( 5s ); } );
std::atexit( []
{
std::this_thread::sleep_for( 5s );
} );

std::int32_t argc; auto* const argv = CommandLineToArgvW( GetCommandLineW(), &argc );

if ( !vars::get_global_vars( ) )
if ( !vars::get_global_vars() )
{
log_err( L"Failed to load config!" );
return EXIT_FAILURE;
}

vars::global_dll_path = argv[1] ? argv[1] : string::to_unicode( vars::str_dll_name );

if ( !std::filesystem::exists(vars::global_dll_path) )
if ( !vars::b_inject_only_vac_bypass )
{
log_err( L"DLL Not found. Place a DLL file called cheat.dll in the same folder as the loader, or drag'n'drop the dll into the exe." );
return EXIT_FAILURE;
vars::global_dll_path = argv[1] ? argv[1] : string::to_unicode( vars::str_dll_name );

if ( !std::filesystem::exists( vars::global_dll_path ) )
{
log_err( L"DLL Not found. Place a DLL file called cheat.dll in the same folder as the loader, or drag'n'drop the dll into the exe." );
return EXIT_FAILURE;
}

log_debug( L"DLL Path: %s", std::filesystem::absolute( vars::global_dll_path ).wstring().data() );
}

log_debug( L"DLL Path: %s", std::filesystem::absolute(vars::global_dll_path).wstring().data() );

g_injector->initalize(vars::global_dll_path);


g_injector->initalize();

log_ok( L"Done." );

return EXIT_SUCCESS;
Expand Down
Loading

0 comments on commit f5db0c7

Please sign in to comment.