这段代码实现了绕过Riot服务器的某些安全机制。通过修改散列哈希值,可以实现对游戏内存的修改。该方法可能会导致游戏被检测出作弊行为,因此需谨慎使用。
cpp 代码:
constexpr uint64_t hash_array = 0x2D6A10; // 13.24
struct hash_struct {
char pad1[ 0x68 ]; // will be change
uint64_t hash[ 4 ];
};
struct section_hash {
uint64_t og_hash[ 4] ;
hash_struct* hash_ptr;
section_hash() = default;
explicit section_hash( hash_struct* hash ) : hash_ptr( hash ) {
for ( int i = 0; i < 4; i++ ) {
og_hash[ i ] = hash_ptr->hash[ i ];
}
}
void restore_hash( ) const {
for ( int i = 0; i < 4; i++ ) {
hash_ptr->hash[ i ] = og_hash[ i ];
}
}
void bypass_hash( ) const {
for ( unsigned long long& i : hash_ptr->hash ) {
i = 0x0;
}
}
};
void replace_hash( const uint64_t func_address ) {
const int nb_pages = get_league_nb_pages( );
const uint64_t league = reinterpret_cast< uint64_t >( GetModuleHandleA( nullptr ) );
for ( int i = 4; i <= nb_pages; i++ ) {
uint64_t curr_page = league + static_cast< uint64_t >( 0x1000 ) * i;
const uint64_t next_page = league + static_cast< uint64_t >( 0x1000 ) * ( i + 1 );
if ( func_address < curr_page || func_address > next_page ) {
continue;
}
if ( hashes.contains( curr_page ) ) {
hashes[ curr_page ].bypass_hash( );
}
}
}
uint64_t hook( void* src, void* dest, size_t size ) {
const uint64_t detour = detour_func( src, dest, size );
replace_hash( reinterpret_cast< uint64_t >( src ) );
return detour;
}