summaryrefslogtreecommitdiff
path: root/client/client_windows.cpp
blob: 02bf78ef80e2a5af0abc24bbfa5155ded1bc3392 (plain)
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
#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <winternl.h>

#pragma comment( lib, "ws2_32.lib" )

#include "connect.hpp"

/*
	1. Connect
	2. Send hello message
	3. Receive hello message from server,
	4. Enter and send username
	5. Enter and send password
	6. Send and let server check hardware id.
	7. Recieve list of games.
	8. Select game and send to server
	9. Receive space of dll.
	10. Allocate space for dll.
	11. Send base address of dll.
	12. Server does relocations.
	13. Server sends dll
	14. Client Manual maps dll
	15. Send game module list and possibly PE headers
	16. Server sends back needed module base addresses and possibly size.
	17. Call DLLMain with correct parameters (Included Base Addresses)
	18. In cheat DLLMain set up base addresses and do cheat stuff. 
*/




// note below is just pseudo unprotected code...
// will make not retarded soon.
int main( ) {
	// TEMPORARY, WE NEED TO ENCRYPT IP STRING SO WE DON'T HAVE DDOS NOOBS.
	std::string ip = "192.168.0.7";
	// std::cin >> ip;

	// START.
	client::c_connect c( ip.c_str( ) );
	if( !c.setup( ) )
		return 1;

	if( !c.connect( ) )
		return 2;

	auto msg = c.get_string( );
	if ( msg != xors( "hello" ) ) {
		std::cout << "connection failed." << std::endl;
		//return 0;
	}

	c.send_msg( "hello" );

	std::string username{ }, password{ };
	std::cout << "Enter your username" << std::endl << "> ";
	std::cin >> username;

	c.send_msg( username.c_str( ) );
	msg = c.get_string( );
	std::cout <<msg <<std::endl;
	if ( msg != xors( "correct username" ) ) {
		std::cout << "incorrect username" << std::endl;
		//return 0; // remember to close connection on server when bad values were sent.
	}

	std::cout << "Enter your password" << std::endl << "> ";
	std::cin >> password;

	c.send_msg( password.c_str( ) );
	if ( c.get_string( ) != xors( "correct password" ) ) {
		std::cout << "incorrect password";
		//return 0; // remember to close connection on server when bad values were sent.
	}

	// Receive list of games, 
	msg = c.get_string( );
	std::cout << msg << std::endl;

	


	/*
	const char* yes = "hello server";
	char buf[ 255 ];
	memcpy( buf, yes, strlen( yes ) );

	c.send_msg( ( uint8_t* )( buf ), strlen( yes ) );
	printf( "message sent\n" );

	auto msg = c.get_msg( );
	while( !msg.size( ) ) {
		Sleep( 1 );
	}

	printf( "[message received]: " );
	for( auto& it : msg )
		printf( "%c", it );

	printf( "\n" );

	c.send_msg( ( uint8_t* )( buf ), strlen( yes ) );
	*/

	// c.~c_connect( );


	system( "pause" );
	return 0;
}