1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
#include <thread>
#include <fstream>
#include "d3d_sprite.hpp"
#include "window.hpp"
#include "ui.h"
#include "http.h"
#include "manualmap.hpp"
#include "iface.hpp"
bool g_in_inject = false;
void on_frame( ) {
if( g_d3d.run_frame( g_window.m_d3d_device ) ) {
g_d3d.begin( );
for( auto& it : d3d::sprites ) {
it->begin( g_window.m_d3d_device );
}
static auto last_time = GetTickCount( ) * 0.001f;
auto cur_time = GetTickCount( ) * 0.001f;
auto deltatime = cur_time - last_time;
last_time = cur_time;
constexpr float anim_step = 1.0f / 15.f;
static float anim_time = 0.f;
static bool flip = false;
if( anim_time == 1.0f ) {
flip = true;
}
if( anim_time == 0.f ) {
flip = false;
}
if( flip ) anim_time = std::clamp( anim_time - anim_step * deltatime, 0.f, 1.0f );
else anim_time = std::clamp( anim_time + anim_step * deltatime, 0.f, 1.0f );
ui::set_animtime( anim_time );
ui::render( );
RECT cur_rect{ };
GetWindowRect( g_window.get_hwnd( ), &cur_rect );
g_d3d.end( );
for( auto& it : d3d::sprites ) {
it->end( );
}
}
}
void decrypt_file( std::vector< uint8_t >& file, uint8_t key ) {
for( size_t i{ }; i < file.size( ); ++i ) {
file.data( )[ i ] ^= key;
}
}
int find_process( std::string name ) {
auto window = FindWindowA( 0, name.c_str( ) );
if( !window ) return -1;
ulong_t pid{ };
GetWindowThreadProcessId( window, &pid );
return pid;
}
void thread_fn( ) {
if( g_in_inject ) return;
g_in_inject = true;
ulong_t hwid{ };
GetVolumeInformationA( xors( "C:\\" ), 0, 0, &hwid, 0, 0, 0, 0 );
g_progress = 0.1f;
std::string game{ };
switch( g_game ) {
case 1:
game = xors( "Counter-Strike: Global Offensive" );
break;
case 2:
game = xors( "Team Fortress 2" );
break;
case 3:
game = xors( "Counter-Strike: Global Offensive" );
break;
case 4:
game = xors( "Garry's Mod" );
break;
default:
MessageBoxA( 0, xors( "unknown error" ), xors( "error" ), MB_OK );
exit( 0 );
break;
}
auto pid = find_process( game );
if( pid == -1 ) {
MessageBoxA( 0, xors( "game must be running" ), xors( "error" ), MB_OK );
g_progress = 0.f;
g_in_inject = false;
return;
}
auto h = OpenProcess( PROCESS_ALL_ACCESS, 0, pid );
iface::manager mgr( h );
mgr.dump_all_modules( pid );
if( !mgr.count( ) ) {
MessageBoxA( 0, xors( "unknown error" ), xors( "error" ), MB_OK );
exit( 0 );
}
g_progress = 0.3f;
//enter a new scope to run cleanup after we're done, epic life hack
{
auto result = http::send_request( g_login, hwid, g_game );
if( result.empty( ) ) {
MessageBoxA( 0, xors( "unknown error" ), xors( "error" ), MB_OK );
exit( 0 );
return;
}
if( result[ 0 ] == '1' ) {
char str[ 256 ];
strenc::w_sprintf_s( str, 256, xors( "hwid mismatch, request change: %08x" ), hwid );
MessageBoxA( 0, str, xors( "error" ), MB_OK );
exit( 0 );
}
if( result[ 0 ] == '2' ) {
MessageBoxA( 0, xors( "user unknown" ), xors( "error" ), MB_OK );
exit( 0 );
}
if( result[ 0 ] == '3' ) {
MessageBoxA( 0, xors( "coming soon" ), xors( "error" ), MB_OK );
g_progress = 0.f;
g_in_inject = false;
return;
}
g_progress = 0.5f;
//to meme whoever decides to reverse this
decrypt_file( result, [ ]( ) {
constexpr auto key_sqr = 49 * 49;
return 49;
}( ) );
inject::c_map map( result );
g_progress = 0.7f;
map.initialize( pid );
std::this_thread::sleep_for( std::chrono::milliseconds( 300 ) );
g_progress = 0.8f;
map.inject( mgr.write_to_process( ) );
g_progress = 1.0f;
}
MessageBoxA( 0, xors( "injection successful" ), xors( "success" ), MB_OK );
exit( 0 );
g_in_inject = false;
}
void execute_login( ) {
std::thread t( thread_fn );
t.detach( );
}
int __stdcall WinMain( HINSTANCE inst, HINSTANCE prev, char* str, int cmdshow ) {
std::thread window_thread( [ & ]( ) {
g_window.create( );
std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) );
g_window.add_on_frame( &on_frame );
for( ;; ) {
g_window.on_frame( );
std::this_thread::sleep_for( std::chrono::milliseconds( 1 ) );
exit( -1 );
}
} );
window_thread.detach( );
while( 1 ) { if( GetAsyncKeyState( VK_END ) & 0x8000 ) break; Sleep( 1 ); }
}
|