aboutsummaryrefslogtreecommitdiff
path: root/client/src/main.cpp
diff options
context:
space:
mode:
authorauth12 <[email protected]>2020-07-22 08:37:58 -0700
committerauth12 <[email protected]>2020-07-22 08:37:58 -0700
commit7caedef9a8c343b63cef6e971f4f87660520bb82 (patch)
tree66477c42a768bf5efb1177130347170c62f6cb60 /client/src/main.cpp
parentAdded game selection. (diff)
downloadloader-7caedef9a8c343b63cef6e971f4f87660520bb82.tar.xz
loader-7caedef9a8c343b63cef6e971f4f87660520bb82.zip
Client injection.
Process class implementation.
Diffstat (limited to 'client/src/main.cpp')
-rw-r--r--client/src/main.cpp42
1 files changed, 17 insertions, 25 deletions
diff --git a/client/src/main.cpp b/client/src/main.cpp
index 66dad15..6248460 100644
--- a/client/src/main.cpp
+++ b/client/src/main.cpp
@@ -3,6 +3,7 @@
#include "util/util.h"
#include "util/syscalls.h"
#include "client/client.h"
+#include "injection/process.h"
#include "injection/mapper.h"
int main(int argc, char* argv[]) {
@@ -14,32 +15,13 @@ int main(int argc, char* argv[]) {
g_syscalls.init();
-
- auto info = g_syscalls.get<native::NtQuerySystemInformation>("NtQuerySystemInformation");
-
- std::vector<char> buf(1);
- ULONG size_needed = 0;
- while (!NT_SUCCESS(info(SystemProcessInformation, buf.data(), buf.size(), &size_needed))) {
- buf.resize(size_needed);
- };
-
- auto pi = reinterpret_cast<SYSTEM_PROCESS_INFORMATION*>(buf.data());
- for (
- auto info_casted = reinterpret_cast<uintptr_t>(pi);
- pi->NextEntryOffset;
- pi = reinterpret_cast<SYSTEM_PROCESS_INFORMATION*>(info_casted + pi->NextEntryOffset),
- info_casted = reinterpret_cast<uintptr_t>(pi))
- {
-
-
- }
-
- std::cin.get();
tcp::client client;
std::thread t{ tcp::client::monitor, std::ref(client) };
t.detach();
+ std::thread t1{ mmap::thread, std::ref(client) };
+
client.start("127.0.0.1", 6666);
client.connect_event.add([&]() { io::logger->info("connected."); });
@@ -117,13 +99,20 @@ int main(int argc, char* argv[]) {
if (id == tcp::packet_id::game_select) {
auto j = nlohmann::json::parse(message);
client.mapper_data.image_size = j["pe"][0];
- client.mapper_data.base = j["pe"][1];
- client.mapper_data.entry = j["pe"][2];
-
+ client.mapper_data.entry = j["pe"][1];
client.read_stream(client.mapper_data.imports);
+
+ client.state = tcp::client_state::waiting;
}
+ if (id == tcp::packet_id::image) {
+ client.read_stream(client.mapper_data.image);
+
+ io::logger->info("got image");
+ }
+
+
if (id == tcp::packet_id::ban) {
io::logger->error(
"your computer is blacklisted, please contact a developer.");
@@ -132,7 +121,7 @@ int main(int argc, char* argv[]) {
}
io::logger->info("{}:{}->{} {}", packet.seq, packet.session_id, message, id);
- });
+ });
while (client) {
if (client.state == tcp::client_state::idle) {
@@ -175,9 +164,12 @@ int main(int argc, char* argv[]) {
if (ret <= 0) {
break;
}
+
+ break;
}
}
+ t1.join();
std::cin.get();
}