Improvement: Support authorize master online
This commit is contained in:
@@ -161,6 +161,7 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\server\2015Remote\pwd_gen.cpp" />
|
||||||
<ClCompile Include="Audio.cpp" />
|
<ClCompile Include="Audio.cpp" />
|
||||||
<ClCompile Include="AudioManager.cpp" />
|
<ClCompile Include="AudioManager.cpp" />
|
||||||
<ClCompile Include="Buffer.cpp" />
|
<ClCompile Include="Buffer.cpp" />
|
||||||
@@ -188,6 +189,7 @@
|
|||||||
<ClCompile Include="X264Encoder.cpp" />
|
<ClCompile Include="X264Encoder.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\server\2015Remote\pwd_gen.h" />
|
||||||
<ClInclude Include="Audio.h" />
|
<ClInclude Include="Audio.h" />
|
||||||
<ClInclude Include="AudioManager.h" />
|
<ClInclude Include="AudioManager.h" />
|
||||||
<ClInclude Include="Buffer.h" />
|
<ClInclude Include="Buffer.h" />
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "ClientDll.h"
|
#include "ClientDll.h"
|
||||||
#include "MemoryModule.h"
|
#include "MemoryModule.h"
|
||||||
#include "common/dllRunner.h"
|
#include "common/dllRunner.h"
|
||||||
|
#include "server/2015Remote/pwd_gen.h"
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Construction/Destruction
|
// Construction/Destruction
|
||||||
@@ -196,6 +197,22 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
|||||||
|
|
||||||
switch (szBuffer[0])
|
switch (szBuffer[0])
|
||||||
{
|
{
|
||||||
|
case CMD_AUTHORIZATION: {
|
||||||
|
char buf[100] = {}, *passCode = buf + 5;
|
||||||
|
memcpy(buf, szBuffer, min(sizeof(buf), ulLength));
|
||||||
|
char path[MAX_PATH] = { 0 };
|
||||||
|
GetModuleFileNameA(NULL, path, MAX_PATH);
|
||||||
|
if (passCode[0] == 0) {
|
||||||
|
std::string devId = getDeviceID();
|
||||||
|
memcpy(buf + 5, devId.c_str(), devId.length()); // 16<31>ֽ<EFBFBD>
|
||||||
|
memcpy(buf + 32, m_conn->pwdHash, 64); // 64<36>ֽ<EFBFBD>
|
||||||
|
m_ClientObject->Send2Server((char*)buf, sizeof(buf));
|
||||||
|
} else {
|
||||||
|
GET_FILEPATH(path, "settings.ini");
|
||||||
|
WritePrivateProfileStringA("settings", "Password", passCode, path);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case CMD_EXECUTE_DLL: {
|
case CMD_EXECUTE_DLL: {
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
static std::map<std::string, std::vector<BYTE>> m_MemDLL;
|
static std::map<std::string, std::vector<BYTE>> m_MemDLL;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
@@ -106,13 +106,13 @@
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
@@ -135,13 +135,13 @@
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -171,6 +171,7 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\server\2015Remote\pwd_gen.cpp" />
|
||||||
<ClCompile Include="Audio.cpp" />
|
<ClCompile Include="Audio.cpp" />
|
||||||
<ClCompile Include="AudioManager.cpp" />
|
<ClCompile Include="AudioManager.cpp" />
|
||||||
<ClCompile Include="Buffer.cpp" />
|
<ClCompile Include="Buffer.cpp" />
|
||||||
@@ -198,6 +199,7 @@
|
|||||||
<ClCompile Include="X264Encoder.cpp" />
|
<ClCompile Include="X264Encoder.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\server\2015Remote\pwd_gen.h" />
|
||||||
<ClInclude Include="Audio.h" />
|
<ClInclude Include="Audio.h" />
|
||||||
<ClInclude Include="AudioManager.h" />
|
<ClInclude Include="AudioManager.h" />
|
||||||
<ClInclude Include="Buffer.h" />
|
<ClInclude Include="Buffer.h" />
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -165,26 +167,90 @@ const char* ReceiveShellcode(const char* sIP, int serverPort, int* sizeOut) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
struct CONNECT_ADDRESS
|
struct CONNECT_ADDRESS
|
||||||
{
|
{
|
||||||
char szFlag[32];
|
char szFlag[32];
|
||||||
char szServerIP[100];
|
char szServerIP[100];
|
||||||
char szPort[8];
|
char szPort[8];
|
||||||
char szReserved[160];
|
int iType;
|
||||||
|
bool bEncrypt;
|
||||||
|
char szBuildDate[12];
|
||||||
|
int iMultiOpen;
|
||||||
|
int iStartup;
|
||||||
|
int iHeaderEnc;
|
||||||
|
char szReserved[62];
|
||||||
|
char pwdHash[64];
|
||||||
}g_Server = { "Hello, World!", "127.0.0.1", "6543" };
|
}g_Server = { "Hello, World!", "127.0.0.1", "6543" };
|
||||||
|
|
||||||
int main() {
|
typedef struct PluginParam {
|
||||||
|
char IP[100];
|
||||||
|
int Port;
|
||||||
|
void* Exit;
|
||||||
|
void* User;
|
||||||
|
}PluginParam;
|
||||||
|
|
||||||
|
#ifdef _WINDLL
|
||||||
|
#define DLL_API __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define DLL_API
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern DLL_API DWORD WINAPI run(LPVOID param) {
|
||||||
|
PluginParam* info = (PluginParam*)param;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
const char* dllData = ReceiveShellcode(g_Server.szServerIP, atoi(g_Server.szPort), &size);
|
const char* dllData = ReceiveShellcode(info->IP, info->Port, &size);
|
||||||
if (dllData == NULL) return -1;
|
if (dllData == NULL) return -1;
|
||||||
void* execMem = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
void* execMem = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||||
if (NULL == execMem) return -2;
|
if (NULL == execMem) return -2;
|
||||||
|
char find[] = "61f04dd637a74ee34493fc1025de2c131022536da751c29e3ff4e9024d8eec43";
|
||||||
|
int offset = MemoryFind(dllData, find, size, sizeof(find)-1);
|
||||||
|
if (offset != -1) {
|
||||||
|
memcpy(dllData + offset, info->User, 64);
|
||||||
|
}
|
||||||
memcpy(execMem, dllData + 22, size);
|
memcpy(execMem, dllData + 22, size);
|
||||||
free((void*)dllData);
|
free((void*)dllData);
|
||||||
DWORD oldProtect = 0;
|
DWORD oldProtect = 0;
|
||||||
if (!VirtualProtect(execMem, size, PAGE_EXECUTE_READ, &oldProtect)) return -3;
|
if (!VirtualProtect(execMem, size, PAGE_EXECUTE_READ, &oldProtect)) return -3;
|
||||||
|
|
||||||
((void(*)())execMem)();
|
((void(*)())execMem)();
|
||||||
Sleep(INFINITE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _WINDLL
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
assert(sizeof(struct CONNECT_ADDRESS) == 300);
|
||||||
|
PluginParam param = { 0 };
|
||||||
|
strcpy(param.IP, g_Server.szServerIP);
|
||||||
|
param.Port = atoi(g_Server.szPort);
|
||||||
|
param.User = g_Server.pwdHash;
|
||||||
|
DWORD result = run(¶m);
|
||||||
|
Sleep(INFINITE);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
|
||||||
|
{
|
||||||
|
if (fdwReason == DLL_PROCESS_ATTACH){
|
||||||
|
static PluginParam param = { 0 };
|
||||||
|
strcpy(param.IP, g_Server.szServerIP);
|
||||||
|
param.Port = atoi(g_Server.szPort);
|
||||||
|
param.User = g_Server.pwdHash;
|
||||||
|
CloseHandle(CreateThread(NULL, 0, run, ¶m, 0, NULL));
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ typedef void* LPVOID, * HANDLE;
|
|||||||
// <20><><EFBFBD>س<EFBFBD><D8B3><EFBFBD>Ψһ<CEA8><D2BB>ʶ
|
// <20><><EFBFBD>س<EFBFBD><D8B3><EFBFBD>Ψһ<CEA8><D2BB>ʶ
|
||||||
#define MASTER_HASH "61f04dd637a74ee34493fc1025de2c131022536da751c29e3ff4e9024d8eec43"
|
#define MASTER_HASH "61f04dd637a74ee34493fc1025de2c131022536da751c29e3ff4e9024d8eec43"
|
||||||
|
|
||||||
|
#ifndef GET_FILEPATH
|
||||||
|
#define GET_FILEPATH(dir,file) [](char*d,const char*f){char*p=d;while(*p)++p;while('\\'!=*p&&p!=d)--p;strcpy(p+1,f);return d;}(dir,file)
|
||||||
|
#endif
|
||||||
|
|
||||||
inline int isValid() {
|
inline int isValid() {
|
||||||
static time_t tm = time(nullptr);
|
static time_t tm = time(nullptr);
|
||||||
return time(nullptr) - tm <= 60;
|
return time(nullptr) - tm <= 60;
|
||||||
@@ -228,6 +232,7 @@ enum
|
|||||||
CMD_RUNASADMIN=214, // ADMIN <20><><EFBFBD><EFBFBD>
|
CMD_RUNASADMIN=214, // ADMIN <20><><EFBFBD><EFBFBD>
|
||||||
CMD_MASTERSETTING = 215, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
CMD_MASTERSETTING = 215, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
CMD_HEARTBEAT_ACK = 216, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
|
CMD_HEARTBEAT_ACK = 216, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ
|
||||||
|
CMD_AUTHORIZATION = 222, // <20><>Ȩ
|
||||||
CMD_SERVER_ADDR = 229, // <20><><EFBFBD>ص<EFBFBD>ַ
|
CMD_SERVER_ADDR = 229, // <20><><EFBFBD>ص<EFBFBD>ַ
|
||||||
TOKEN_ERROR = 230, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
TOKEN_ERROR = 230, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
||||||
TOKEN_SHELL_DATA = 231, // <20>ն˽<D5B6><CBBD><EFBFBD>
|
TOKEN_SHELL_DATA = 231, // <20>ն˽<D5B6><CBBD><EFBFBD>
|
||||||
@@ -473,7 +478,8 @@ public:
|
|||||||
int iMultiOpen;
|
int iMultiOpen;
|
||||||
int iStartup; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
int iStartup; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||||
int iHeaderEnc; // <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
int iHeaderEnc; // <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
char szReserved[126]; // ռλ<D5BC><CEBB>ʹ<EFBFBD>ṹ<EFBFBD><E1B9B9>ռ<EFBFBD><D5BC>300<30>ֽ<EFBFBD>
|
char szReserved[62]; // ռλ<D5BC><CEBB>ʹ<EFBFBD>ṹ<EFBFBD><E1B9B9>ռ<EFBFBD><D5BC>300<30>ֽ<EFBFBD>
|
||||||
|
char pwdHash[64];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SetType(int typ) {
|
void SetType(int typ) {
|
||||||
@@ -749,6 +755,28 @@ inline std::string ToPekingTimeAsString(const time_t* t) {
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct Validation {
|
||||||
|
char From[20]; // <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
||||||
|
char To[20]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
char Admin[100]; // <20><><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>صĹ<D8B5><C4B9><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>
|
||||||
|
int Port; // <20><><EFBFBD><EFBFBD>Ա<EFBFBD>˿ڣ<CBBF>Ĭ<EFBFBD>ϵ<EFBFBD>ǰ<EFBFBD>˿ڣ<CBBF>
|
||||||
|
char Reserved[16]; // Ԥ<><D4A4><EFBFBD>ֶ<EFBFBD>
|
||||||
|
Validation(float days, const char* admin, int port) {
|
||||||
|
time_t from = time(NULL), to = from + time_t(86400 * days);
|
||||||
|
memset(this, 0, sizeof(Validation));
|
||||||
|
std::string fromStr = ToPekingTimeAsString(&from);
|
||||||
|
std::string toStr = ToPekingTimeAsString(&to);
|
||||||
|
strcpy_s(From, fromStr.c_str());
|
||||||
|
strcpy_s(To, toStr.c_str());
|
||||||
|
strcpy_s(Admin, admin);
|
||||||
|
Port = port;
|
||||||
|
}
|
||||||
|
bool IsValid() const {
|
||||||
|
std::string now = ToPekingTimeAsString(NULL);
|
||||||
|
return From <= now && now <= To;
|
||||||
|
}
|
||||||
|
}Validation;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// Ϊ<>˽<EFBFBD><CBBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ꣬<C4BA><EAA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱʹ<CAB1>ã<EFBFBD><C3A3><EFBFBD>ʽ<EFBFBD>汾û<E6B1BE><C3BB>
|
// Ϊ<>˽<EFBFBD><CBBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ꣬<C4BA><EAA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱʹ<CAB1>ã<EFBFBD><C3A3><EFBFBD>ʽ<EFBFBD>汾û<E6B1BE><C3BB>
|
||||||
#define SCREENYSPY_IMPROVE 0
|
#define SCREENYSPY_IMPROVE 0
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ CMy2015RemoteApp theApp;
|
|||||||
|
|
||||||
BOOL CMy2015RemoteApp::InitInstance()
|
BOOL CMy2015RemoteApp::InitInstance()
|
||||||
{
|
{
|
||||||
|
#ifndef _DEBUG
|
||||||
m_Mutex = CreateMutex(NULL, FALSE, "YAMA.EXE");
|
m_Mutex = CreateMutex(NULL, FALSE, "YAMA.EXE");
|
||||||
if (ERROR_ALREADY_EXISTS == GetLastError())
|
if (ERROR_ALREADY_EXISTS == GetLastError())
|
||||||
{
|
{
|
||||||
@@ -87,6 +88,7 @@ BOOL CMy2015RemoteApp::InitInstance()
|
|||||||
m_Mutex = NULL;
|
m_Mutex = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SetUnhandledExceptionFilter(&whenbuged);
|
SetUnhandledExceptionFilter(&whenbuged);
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -36,15 +36,12 @@
|
|||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "DecryptDlg.h"
|
#include "DecryptDlg.h"
|
||||||
#include "adapter.h"
|
#include "adapter.h"
|
||||||
|
#include "client/MemoryModule.h"
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GET_FILEPATH
|
|
||||||
#define GET_FILEPATH(dir,file) [](char*d,const char*f){char*p=d;while(*p)++p;while('\\'!=*p&&p!=d)--p;strcpy(p+1,f);return d;}(dir,file)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define UM_ICONNOTIFY WM_USER+100
|
#define UM_ICONNOTIFY WM_USER+100
|
||||||
#define TIMER_CHECK 1
|
#define TIMER_CHECK 1
|
||||||
|
|
||||||
@@ -283,6 +280,7 @@ CMy2015RemoteDlg::CMy2015RemoteDlg(IOCPServer* iocpServer, CWnd* pParent): CDial
|
|||||||
m_bmOnline[7].LoadBitmap(IDB_BITMAP_GDESKTOP);
|
m_bmOnline[7].LoadBitmap(IDB_BITMAP_GDESKTOP);
|
||||||
m_bmOnline[8].LoadBitmap(IDB_BITMAP_DDESKTOP);
|
m_bmOnline[8].LoadBitmap(IDB_BITMAP_DDESKTOP);
|
||||||
m_bmOnline[9].LoadBitmap(IDB_BITMAP_SDESKTOP);
|
m_bmOnline[9].LoadBitmap(IDB_BITMAP_SDESKTOP);
|
||||||
|
m_bmOnline[10].LoadBitmap(IDB_BITMAP_AUTHORIZE);
|
||||||
|
|
||||||
for (int i = 0; i < PAYLOAD_MAXTYPE; i++) {
|
for (int i = 0; i < PAYLOAD_MAXTYPE; i++) {
|
||||||
m_ServerDLL[i] = nullptr;
|
m_ServerDLL[i] = nullptr;
|
||||||
@@ -296,6 +294,7 @@ CMy2015RemoteDlg::CMy2015RemoteDlg(IOCPServer* iocpServer, CWnd* pParent): CDial
|
|||||||
GetModuleFileNameA(NULL, path, _MAX_PATH);
|
GetModuleFileNameA(NULL, path, _MAX_PATH);
|
||||||
GET_FILEPATH(path, "Plugins");
|
GET_FILEPATH(path, "Plugins");
|
||||||
m_DllList = ReadAllDllFilesWindows(path);
|
m_DllList = ReadAllDllFilesWindows(path);
|
||||||
|
m_tinyDLL = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -310,6 +309,10 @@ CMy2015RemoteDlg::~CMy2015RemoteDlg()
|
|||||||
{
|
{
|
||||||
SAFE_DELETE(m_DllList[i]);
|
SAFE_DELETE(m_DllList[i]);
|
||||||
}
|
}
|
||||||
|
if (m_tinyDLL) {
|
||||||
|
MemoryFreeLibrary(m_tinyDLL);
|
||||||
|
m_tinyDLL = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMy2015RemoteDlg::DoDataExchange(CDataExchange* pDX)
|
void CMy2015RemoteDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
@@ -382,6 +385,8 @@ BEGIN_MESSAGE_MAP(CMy2015RemoteDlg, CDialogEx)
|
|||||||
ON_COMMAND(ID_ONLINE_GRAY_DESKTOP, &CMy2015RemoteDlg::OnOnlineGrayDesktop)
|
ON_COMMAND(ID_ONLINE_GRAY_DESKTOP, &CMy2015RemoteDlg::OnOnlineGrayDesktop)
|
||||||
ON_COMMAND(ID_ONLINE_REMOTE_DESKTOP, &CMy2015RemoteDlg::OnOnlineRemoteDesktop)
|
ON_COMMAND(ID_ONLINE_REMOTE_DESKTOP, &CMy2015RemoteDlg::OnOnlineRemoteDesktop)
|
||||||
ON_COMMAND(ID_ONLINE_H264_DESKTOP, &CMy2015RemoteDlg::OnOnlineH264Desktop)
|
ON_COMMAND(ID_ONLINE_H264_DESKTOP, &CMy2015RemoteDlg::OnOnlineH264Desktop)
|
||||||
|
ON_COMMAND(ID_WHAT_IS_THIS, &CMy2015RemoteDlg::OnWhatIsThis)
|
||||||
|
ON_COMMAND(ID_ONLINE_AUTHORIZE, &CMy2015RemoteDlg::OnOnlineAuthorize)
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
@@ -694,6 +699,7 @@ Buffer* ReadKernelDll(bool is64Bit, bool isDLL=true, const std::string &addr="")
|
|||||||
CONNECT_ADDRESS* server = (CONNECT_ADDRESS*)(szBuffer + offset);
|
CONNECT_ADDRESS* server = (CONNECT_ADDRESS*)(szBuffer + offset);
|
||||||
server->SetServer(ip.c_str(), atoi(port.c_str()));
|
server->SetServer(ip.c_str(), atoi(port.c_str()));
|
||||||
server->SetType(isDLL ? CLIENT_TYPE_MEMDLL : CLIENT_TYPE_SHELLCODE);
|
server->SetType(isDLL ? CLIENT_TYPE_MEMDLL : CLIENT_TYPE_SHELLCODE);
|
||||||
|
memcpy(server->pwdHash, GetPwdHash().c_str(), 64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto ret = new Buffer(szBuffer, bufSize + padding, padding, md5);
|
auto ret = new Buffer(szBuffer, bufSize + padding, padding, md5);
|
||||||
@@ -734,9 +740,30 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 主控程序公网IP
|
// 主控程序公网IP
|
||||||
std::string master = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "master", "");
|
std::string ip = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "master", "");
|
||||||
if (!master.empty()) {
|
std::string port = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "ghost", "6543");
|
||||||
master += ":" + ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "ghost", "6543");
|
std::string master = ip.empty() ? "" : ip + ":" + port;
|
||||||
|
const Validation* v = GetValidation();
|
||||||
|
m_superPass = v->Reserved;
|
||||||
|
#ifdef _DEBUG
|
||||||
|
if (!(strlen(v->Admin) && v->Port > 0)) {
|
||||||
|
static Validation test(1, ip.c_str(), atoi(port.c_str()));
|
||||||
|
v = &test;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (strlen(v->Admin) && v->Port > 0) {
|
||||||
|
DWORD size = 0;
|
||||||
|
LPBYTE data = ReadResource(sizeof(void*) == 8 ? IDR_TINYRUN_X64 : IDR_TINYRUN_X86, size);
|
||||||
|
if (data) {
|
||||||
|
int offset = MemoryFind((char*)data, FLAG_FINDEN, size, strlen(FLAG_FINDEN));
|
||||||
|
if (offset != -1) {
|
||||||
|
CONNECT_ADDRESS* p = (CONNECT_ADDRESS*)(data + offset);
|
||||||
|
p->SetServer(v->Admin, v->Port);
|
||||||
|
memcpy(p->pwdHash, GetPwdHash().c_str(), 64);
|
||||||
|
m_tinyDLL = MemoryLoadLibrary(data, size);
|
||||||
|
}
|
||||||
|
SAFE_DELETE_ARRAY(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_ServerDLL[PAYLOAD_DLL_X86] = ReadKernelDll(false, true, master);
|
m_ServerDLL[PAYLOAD_DLL_X86] = ReadKernelDll(false, true, master);
|
||||||
m_ServerDLL[PAYLOAD_DLL_X64] = ReadKernelDll(true, true, master);
|
m_ServerDLL[PAYLOAD_DLL_X64] = ReadKernelDll(true, true, master);
|
||||||
@@ -908,10 +935,15 @@ void CMy2015RemoteDlg::OnTimer(UINT_PTR nIDEvent)
|
|||||||
{
|
{
|
||||||
KillTimer(nIDEvent);
|
KillTimer(nIDEvent);
|
||||||
CInputDialog dlg(this);
|
CInputDialog dlg(this);
|
||||||
|
dlg.m_str = m_superPass.c_str();
|
||||||
dlg.Init("输入密码", "输入主控程序的密码:");
|
dlg.Init("输入密码", "输入主控程序的密码:");
|
||||||
dlg.DoModal();
|
dlg.DoModal();
|
||||||
if (hashSHA256(dlg.m_str.GetString()) != std::string(skCrypt(MASTER_HASH)))
|
if (hashSHA256(dlg.m_str.GetString()) != GetPwdHash()) {
|
||||||
|
MessageBox("请通知管理员延长授权时间,再关闭此提示信息!!!"
|
||||||
|
"\n否则,关闭此提示信息将退出程序,无法授权成功。", "提示", MB_ICONWARNING);
|
||||||
return OnMainExit();
|
return OnMainExit();
|
||||||
|
}
|
||||||
|
m_superPass = dlg.m_str.GetString();
|
||||||
MessageBox("请及时对当前主控程序授权: 在工具菜单中生成口令!", "提示", MB_ICONWARNING);
|
MessageBox("请及时对当前主控程序授权: 在工具菜单中生成口令!", "提示", MB_ICONWARNING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1024,6 +1056,7 @@ void CMy2015RemoteDlg::OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult)
|
|||||||
Menu.SetMenuItemBitmaps(ID_ONLINE_GRAY_DESKTOP, MF_BYCOMMAND, &m_bmOnline[7], &m_bmOnline[7]);
|
Menu.SetMenuItemBitmaps(ID_ONLINE_GRAY_DESKTOP, MF_BYCOMMAND, &m_bmOnline[7], &m_bmOnline[7]);
|
||||||
Menu.SetMenuItemBitmaps(ID_ONLINE_REMOTE_DESKTOP, MF_BYCOMMAND, &m_bmOnline[8], &m_bmOnline[8]);
|
Menu.SetMenuItemBitmaps(ID_ONLINE_REMOTE_DESKTOP, MF_BYCOMMAND, &m_bmOnline[8], &m_bmOnline[8]);
|
||||||
Menu.SetMenuItemBitmaps(ID_ONLINE_H264_DESKTOP, MF_BYCOMMAND, &m_bmOnline[9], &m_bmOnline[9]);
|
Menu.SetMenuItemBitmaps(ID_ONLINE_H264_DESKTOP, MF_BYCOMMAND, &m_bmOnline[9], &m_bmOnline[9]);
|
||||||
|
Menu.SetMenuItemBitmaps(ID_ONLINE_AUTHORIZE, MF_BYCOMMAND, &m_bmOnline[10], &m_bmOnline[10]);
|
||||||
|
|
||||||
// 创建一个新的子菜单
|
// 创建一个新的子菜单
|
||||||
CMenu newMenu;
|
CMenu newMenu;
|
||||||
@@ -1054,6 +1087,9 @@ void CMy2015RemoteDlg::OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult)
|
|||||||
SubMenu->EnableMenuItem(i, MF_BYPOSITION | MF_DISABLED | MF_GRAYED); //菜单全部变灰
|
SubMenu->EnableMenuItem(i, MF_BYPOSITION | MF_DISABLED | MF_GRAYED); //菜单全部变灰
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (GetPwdHash() != std::string(skCrypt(MASTER_HASH))) {
|
||||||
|
SubMenu->EnableMenuItem(ID_ONLINE_AUTHORIZE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
|
||||||
|
}
|
||||||
|
|
||||||
// 刷新菜单显示
|
// 刷新菜单显示
|
||||||
DrawMenuBar();
|
DrawMenuBar();
|
||||||
@@ -1245,6 +1281,14 @@ bool CMy2015RemoteDlg::CheckValid() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!isTrail) {
|
if (!isTrail) {
|
||||||
|
const Validation *verify = GetValidation();
|
||||||
|
std::string masterHash = skCrypt(MASTER_HASH);
|
||||||
|
if (masterHash != GetPwdHash() && !verify->IsValid()) {
|
||||||
|
KillTimer(TIMER_CHECK);
|
||||||
|
MessageBox("此程序已经失效,请联系管理员处理!", "提示", MB_ICONWARNING);
|
||||||
|
OnMainExit();
|
||||||
|
ExitProcess(-1);
|
||||||
|
}
|
||||||
auto THIS_APP = (CMy2015RemoteApp*)AfxGetApp();
|
auto THIS_APP = (CMy2015RemoteApp*)AfxGetApp();
|
||||||
auto settings = "settings", pwdKey = "Password";
|
auto settings = "settings", pwdKey = "Password";
|
||||||
// 验证口令
|
// 验证口令
|
||||||
@@ -1256,8 +1300,10 @@ bool CMy2015RemoteDlg::CheckValid() {
|
|||||||
|
|
||||||
dlg.m_sDeviceID = deviceID.c_str();
|
dlg.m_sDeviceID = deviceID.c_str();
|
||||||
dlg.m_sPassword = pwd;
|
dlg.m_sPassword = pwd;
|
||||||
if (pwd.IsEmpty() && IDOK != dlg.DoModal() || dlg.m_sPassword.IsEmpty())
|
if (pwd.IsEmpty() && IDOK != dlg.DoModal() || dlg.m_sPassword.IsEmpty()) {
|
||||||
|
KillTimer(TIMER_CHECK);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// 密码形式:20250209 - 20350209: SHA256
|
// 密码形式:20250209 - 20350209: SHA256
|
||||||
auto v = splitString(dlg.m_sPassword.GetBuffer(), '-');
|
auto v = splitString(dlg.m_sPassword.GetBuffer(), '-');
|
||||||
@@ -1265,6 +1311,7 @@ bool CMy2015RemoteDlg::CheckValid() {
|
|||||||
{
|
{
|
||||||
THIS_APP->m_iniFile.SetStr(settings, pwdKey, "");
|
THIS_APP->m_iniFile.SetStr(settings, pwdKey, "");
|
||||||
MessageBox("格式错误,请重新申请口令!", "提示", MB_ICONINFORMATION);
|
MessageBox("格式错误,请重新申请口令!", "提示", MB_ICONINFORMATION);
|
||||||
|
KillTimer(TIMER_CHECK);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::vector<std::string> subvector(v.begin() + 2, v.end());
|
std::vector<std::string> subvector(v.begin() + 2, v.end());
|
||||||
@@ -1277,6 +1324,7 @@ bool CMy2015RemoteDlg::CheckValid() {
|
|||||||
if (pwd.IsEmpty() || (IDOK != dlg.DoModal() || hash256 != fixedKey)) {
|
if (pwd.IsEmpty() || (IDOK != dlg.DoModal() || hash256 != fixedKey)) {
|
||||||
if (!dlg.m_sPassword.IsEmpty())
|
if (!dlg.m_sPassword.IsEmpty())
|
||||||
MessageBox("口令错误, 无法继续操作!", "提示", MB_ICONWARNING);
|
MessageBox("口令错误, 无法继续操作!", "提示", MB_ICONWARNING);
|
||||||
|
KillTimer(TIMER_CHECK);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1287,6 +1335,7 @@ bool CMy2015RemoteDlg::CheckValid() {
|
|||||||
if (curDate < v[0] || curDate > v[1]) {
|
if (curDate < v[0] || curDate > v[1]) {
|
||||||
THIS_APP->m_iniFile.SetStr(settings, pwdKey, "");
|
THIS_APP->m_iniFile.SetStr(settings, pwdKey, "");
|
||||||
MessageBox("口令过期,请重新申请口令!", "提示", MB_ICONINFORMATION);
|
MessageBox("口令过期,请重新申请口令!", "提示", MB_ICONINFORMATION);
|
||||||
|
KillTimer(TIMER_CHECK);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (dlg.m_sPassword != pwd)
|
if (dlg.m_sPassword != pwd)
|
||||||
@@ -1655,6 +1704,22 @@ LRESULT CMy2015RemoteDlg::OnHandleMessage(WPARAM wParam, LPARAM lParam) {
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string getDateStr(int daysOffset = 0) {
|
||||||
|
// 获取当前时间点
|
||||||
|
std::time_t now = std::time(nullptr);
|
||||||
|
|
||||||
|
// 加上指定的天数(可以为负)
|
||||||
|
now += static_cast<std::time_t>(daysOffset * 24 * 60 * 60);
|
||||||
|
|
||||||
|
std::tm* t = std::localtime(&now);
|
||||||
|
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << std::setfill('0') << std::setw(4) << (t->tm_year + 1900)
|
||||||
|
<< std::setw(2) << (t->tm_mon + 1)
|
||||||
|
<< std::setw(2) << t->tm_mday;
|
||||||
|
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
|
||||||
VOID CMy2015RemoteDlg::MessageHandle(CONTEXT_OBJECT* ContextObject)
|
VOID CMy2015RemoteDlg::MessageHandle(CONTEXT_OBJECT* ContextObject)
|
||||||
{
|
{
|
||||||
@@ -1677,6 +1742,23 @@ VOID CMy2015RemoteDlg::MessageHandle(CONTEXT_OBJECT* ContextObject)
|
|||||||
SAFE_DELETE_ARRAY(resp);
|
SAFE_DELETE_ARRAY(resp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CMD_AUTHORIZATION: // 获取授权
|
||||||
|
{
|
||||||
|
int n = ContextObject->InDeCompressedBuffer.GetBufferLength();
|
||||||
|
if (n < 100) break;
|
||||||
|
char resp[100] = { 0 }, *devId = resp + 5, *pwdHash = resp + 32;
|
||||||
|
ContextObject->InDeCompressedBuffer.CopyBuffer(resp, min(n, sizeof(resp)), 0);
|
||||||
|
int *days = (int*)(resp+1);
|
||||||
|
if (devId[0] == 0 || pwdHash[0] == 0)break;
|
||||||
|
// 密码形式:20250209 - 20350209: SHA256
|
||||||
|
std::string password = getDateStr(0) + " - " + getDateStr(*days) + ": " + pwdHash;
|
||||||
|
std::string finalKey = deriveKey(password, devId);
|
||||||
|
std::string fixedKey = getDateStr(0) + std::string("-") + getDateStr(*days) + std::string("-") + getFixedLengthID(finalKey);
|
||||||
|
memcpy(devId, fixedKey.c_str(), fixedKey.length());
|
||||||
|
devId[fixedKey.length()] = 0;
|
||||||
|
m_iocpServer->OnClientPreSending(ContextObject, (LPBYTE)resp, sizeof(resp));
|
||||||
|
break;
|
||||||
|
}
|
||||||
case CMD_EXECUTE_DLL: // 请求DLL
|
case CMD_EXECUTE_DLL: // 请求DLL
|
||||||
{
|
{
|
||||||
DllExecuteInfo *info = (DllExecuteInfo*)ContextObject->InDeCompressedBuffer.GetBuffer(1);
|
DllExecuteInfo *info = (DllExecuteInfo*)ContextObject->InDeCompressedBuffer.GetBuffer(1);
|
||||||
@@ -2341,6 +2423,7 @@ void CMy2015RemoteDlg::OnToolAuth()
|
|||||||
std::string hashedID = hashSHA256(hardwareID);
|
std::string hashedID = hashSHA256(hardwareID);
|
||||||
std::string deviceID = getFixedLengthID(hashedID);
|
std::string deviceID = getFixedLengthID(hashedID);
|
||||||
dlg.m_sDeviceID = deviceID.c_str();
|
dlg.m_sDeviceID = deviceID.c_str();
|
||||||
|
dlg.m_sUserPwd = m_superPass.c_str();
|
||||||
|
|
||||||
dlg.DoModal();
|
dlg.DoModal();
|
||||||
}
|
}
|
||||||
@@ -2548,20 +2631,38 @@ LRESULT CMy2015RemoteDlg::UPXProcResult(WPARAM wParam, LPARAM lParam) {
|
|||||||
|
|
||||||
void CMy2015RemoteDlg::OnToolGenMaster()
|
void CMy2015RemoteDlg::OnToolGenMaster()
|
||||||
{
|
{
|
||||||
CInputDialog pass(this);
|
// 主控程序公网IP
|
||||||
pass.Init("主控生成", "当前主控程序的密码:");
|
std::string master = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "master", "");
|
||||||
if (pass.DoModal() != IDOK || pass.m_str.IsEmpty())
|
if (master.empty()) {
|
||||||
return;
|
MessageBox("请通过菜单设置当前主控程序的公网地址(域名)! 此地址会写入即将生成的主控程序中。"
|
||||||
|
"\n只有正确设置公网地址,才能在线延长由本程序所生成的主控程序的有效期。", "提示", MB_ICONINFORMATION);
|
||||||
|
}
|
||||||
std::string masterHash(skCrypt(MASTER_HASH));
|
std::string masterHash(skCrypt(MASTER_HASH));
|
||||||
if (hashSHA256(pass.m_str.GetBuffer()) != masterHash) {
|
if (m_superPass.empty()) {
|
||||||
MessageBox("密码不正确,无法生成主控程序!", "错误", MB_ICONWARNING);
|
CInputDialog pass(this);
|
||||||
return;
|
pass.Init("主控生成", "当前主控程序的密码:");
|
||||||
|
pass.m_str = m_superPass.c_str();
|
||||||
|
if (pass.DoModal() != IDOK || pass.m_str.IsEmpty())
|
||||||
|
return;
|
||||||
|
if (hashSHA256(pass.m_str.GetBuffer()) != masterHash) {
|
||||||
|
MessageBox("密码不正确,无法生成主控程序!", "错误", MB_ICONWARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_superPass = pass.m_str.GetString();
|
||||||
}
|
}
|
||||||
|
|
||||||
CInputDialog dlg(this);
|
CInputDialog dlg(this);
|
||||||
dlg.Init("主控密码", "新的主控程序的密码:");
|
dlg.Init("主控密码", "新的主控程序的密码:");
|
||||||
if (dlg.DoModal() != IDOK || dlg.m_str.IsEmpty())
|
if (dlg.DoModal() != IDOK || dlg.m_str.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
if (dlg.m_str.GetLength() > 15) {
|
||||||
|
MessageBox("密码长度不能大于15。", "错误", MB_ICONWARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CInputDialog days(this);
|
||||||
|
days.Init("使用天数", "新主控程序使用天数:");
|
||||||
|
if (days.DoModal() != IDOK || days.m_str.IsEmpty())
|
||||||
|
return;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
DWORD len = GetModuleFileNameA(NULL, path, MAX_PATH);
|
DWORD len = GetModuleFileNameA(NULL, path, MAX_PATH);
|
||||||
@@ -2594,7 +2695,9 @@ void CMy2015RemoteDlg::OnToolGenMaster()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!WritePwdHash(curEXE + iOffset, pwdHash)) {
|
int port = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost");
|
||||||
|
Validation verify(atof(days.m_str), master.c_str(), port<=0 ? 6543 : port);
|
||||||
|
if (!WritePwdHash(curEXE + iOffset, pwdHash, verify)) {
|
||||||
MessageBox("写入哈希失败! 无法生成主控。", "错误", MB_ICONWARNING);
|
MessageBox("写入哈希失败! 无法生成主控。", "错误", MB_ICONWARNING);
|
||||||
SAFE_DELETE_ARRAY(curEXE);
|
SAFE_DELETE_ARRAY(curEXE);
|
||||||
return;
|
return;
|
||||||
@@ -2704,3 +2807,36 @@ void CMy2015RemoteDlg::OnOnlineH264Desktop()
|
|||||||
BYTE bToken[32] = { COMMAND_SCREEN_SPY, 0, ALGORITHM_H264 };
|
BYTE bToken[32] = { COMMAND_SCREEN_SPY, 0, ALGORITHM_H264 };
|
||||||
SendSelectedCommand(bToken, sizeof(bToken));
|
SendSelectedCommand(bToken, sizeof(bToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CMy2015RemoteDlg::OnWhatIsThis()
|
||||||
|
{
|
||||||
|
CString url = _T("https://github.com/yuanyuanxiang/SimpleRemoter/wiki");
|
||||||
|
ShellExecute(NULL, _T("open"), url, NULL, NULL, SW_SHOWNORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CMy2015RemoteDlg::OnOnlineAuthorize()
|
||||||
|
{
|
||||||
|
if (m_superPass.empty()) {
|
||||||
|
CInputDialog pass(this);
|
||||||
|
pass.Init("需要密码", "当前主控程序的密码:");
|
||||||
|
if (pass.DoModal() != IDOK || pass.m_str.IsEmpty())
|
||||||
|
return;
|
||||||
|
std::string masterHash(skCrypt(MASTER_HASH));
|
||||||
|
if (hashSHA256(pass.m_str.GetBuffer()) != masterHash) {
|
||||||
|
MessageBox("密码不正确!", "错误", MB_ICONWARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_superPass = pass.m_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
CInputDialog dlg(this);
|
||||||
|
dlg.Init("延长授权", "主控程序授权天数:");
|
||||||
|
if (dlg.DoModal() != IDOK || atoi(dlg.m_str) <= 0)
|
||||||
|
return;
|
||||||
|
BYTE bToken[32] = { CMD_AUTHORIZATION };
|
||||||
|
int days = atoi(dlg.m_str);
|
||||||
|
memcpy(bToken+1, &days, sizeof(days));
|
||||||
|
SendSelectedCommand(bToken, sizeof(bToken));
|
||||||
|
}
|
||||||
|
|||||||
@@ -135,6 +135,8 @@ protected:
|
|||||||
// ʵ<><CAB5>
|
// ʵ<><CAB5>
|
||||||
protected:
|
protected:
|
||||||
HICON m_hIcon;
|
HICON m_hIcon;
|
||||||
|
void* m_tinyDLL;
|
||||||
|
std::string m_superPass;
|
||||||
|
|
||||||
// <20><><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>Ϣӳ<CFA2>亯<EFBFBD><E4BAAF>
|
// <20><><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>Ϣӳ<CFA2>亯<EFBFBD><E4BAAF>
|
||||||
virtual BOOL OnInitDialog();
|
virtual BOOL OnInitDialog();
|
||||||
@@ -182,7 +184,7 @@ public:
|
|||||||
CRITICAL_SECTION m_cs;
|
CRITICAL_SECTION m_cs;
|
||||||
BOOL isClosed;
|
BOOL isClosed;
|
||||||
CMenu m_MainMenu;
|
CMenu m_MainMenu;
|
||||||
CBitmap m_bmOnline[10];
|
CBitmap m_bmOnline[11];
|
||||||
bool CheckValid();
|
bool CheckValid();
|
||||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||||
afx_msg void OnClose();
|
afx_msg void OnClose();
|
||||||
@@ -242,4 +244,6 @@ public:
|
|||||||
afx_msg void OnOnlineGrayDesktop();
|
afx_msg void OnOnlineGrayDesktop();
|
||||||
afx_msg void OnOnlineRemoteDesktop();
|
afx_msg void OnOnlineRemoteDesktop();
|
||||||
afx_msg void OnOnlineH264Desktop();
|
afx_msg void OnOnlineH264Desktop();
|
||||||
|
afx_msg void OnWhatIsThis();
|
||||||
|
afx_msg void OnOnlineAuthorize();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -219,9 +219,11 @@
|
|||||||
<None Include="..\..\Release\ghost.exe" />
|
<None Include="..\..\Release\ghost.exe" />
|
||||||
<None Include="..\..\Release\ServerDll.dll" />
|
<None Include="..\..\Release\ServerDll.dll" />
|
||||||
<None Include="..\..\Release\TestRun.exe" />
|
<None Include="..\..\Release\TestRun.exe" />
|
||||||
|
<None Include="..\..\Release\TinyRun.dll" />
|
||||||
<None Include="..\..\x64\Release\ghost.exe" />
|
<None Include="..\..\x64\Release\ghost.exe" />
|
||||||
<None Include="..\..\x64\Release\ServerDll.dll" />
|
<None Include="..\..\x64\Release\ServerDll.dll" />
|
||||||
<None Include="..\..\x64\Release\TestRun.exe" />
|
<None Include="..\..\x64\Release\TestRun.exe" />
|
||||||
|
<None Include="..\..\x64\Release\TinyRun.dll" />
|
||||||
<None Include="res\1.cur" />
|
<None Include="res\1.cur" />
|
||||||
<None Include="res\2.cur" />
|
<None Include="res\2.cur" />
|
||||||
<None Include="res\2015Remote.ico" />
|
<None Include="res\2015Remote.ico" />
|
||||||
@@ -248,6 +250,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\client\Audio.h" />
|
<ClInclude Include="..\..\client\Audio.h" />
|
||||||
|
<ClInclude Include="..\..\client\MemoryModule.h" />
|
||||||
<ClInclude Include="..\..\common\aes.h" />
|
<ClInclude Include="..\..\common\aes.h" />
|
||||||
<ClInclude Include="..\..\common\encrypt.h" />
|
<ClInclude Include="..\..\common\encrypt.h" />
|
||||||
<ClInclude Include="2015Remote.h" />
|
<ClInclude Include="2015Remote.h" />
|
||||||
@@ -299,6 +302,12 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\client\Audio.cpp" />
|
<ClCompile Include="..\..\client\Audio.cpp" />
|
||||||
|
<ClCompile Include="..\..\client\MemoryModule.c">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\common\aes.c">
|
<ClCompile Include="..\..\common\aes.c">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
@@ -332,7 +341,12 @@
|
|||||||
<ClCompile Include="parse_ip.cpp" />
|
<ClCompile Include="parse_ip.cpp" />
|
||||||
<ClCompile Include="proxy\ProxyConnectServer.cpp" />
|
<ClCompile Include="proxy\ProxyConnectServer.cpp" />
|
||||||
<ClCompile Include="proxy\ProxyMapDlg.cpp" />
|
<ClCompile Include="proxy\ProxyMapDlg.cpp" />
|
||||||
<ClCompile Include="pwd_gen.cpp" />
|
<ClCompile Include="pwd_gen.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="RegisterDlg.cpp" />
|
<ClCompile Include="RegisterDlg.cpp" />
|
||||||
<ClCompile Include="ScreenSpyDlg.cpp" />
|
<ClCompile Include="ScreenSpyDlg.cpp" />
|
||||||
<ClCompile Include="ServicesDlg.cpp" />
|
<ClCompile Include="ServicesDlg.cpp" />
|
||||||
@@ -361,6 +375,7 @@
|
|||||||
<Text Include="..\..\ReadMe.md" />
|
<Text Include="..\..\ReadMe.md" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Image Include="res\Bitmap\authorize.bmp" />
|
||||||
<Image Include="res\Bitmap\DxgiDesktop.bmp" />
|
<Image Include="res\Bitmap\DxgiDesktop.bmp" />
|
||||||
<Image Include="res\Bitmap\GrayDesktop.bmp" />
|
<Image Include="res\Bitmap\GrayDesktop.bmp" />
|
||||||
<Image Include="res\Bitmap\note.bmp" />
|
<Image Include="res\Bitmap\note.bmp" />
|
||||||
|
|||||||
@@ -13,13 +13,17 @@
|
|||||||
IMPLEMENT_DYNAMIC(CPasswordDlg, CDialogEx)
|
IMPLEMENT_DYNAMIC(CPasswordDlg, CDialogEx)
|
||||||
|
|
||||||
// 主控程序唯一标识
|
// 主控程序唯一标识
|
||||||
char g_MasterID[100] = { PWD_HASH256 };
|
char g_MasterID[_MAX_PATH] = { PWD_HASH256 };
|
||||||
|
|
||||||
std::string GetPwdHash(){
|
std::string GetPwdHash(){
|
||||||
static auto id = std::string(g_MasterID).substr(0, 64);
|
static auto id = std::string(g_MasterID).substr(0, 64);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Validation * GetValidation(int offset){
|
||||||
|
return (Validation*)(g_MasterID + offset);
|
||||||
|
}
|
||||||
|
|
||||||
std::string GetMasterId() {
|
std::string GetMasterId() {
|
||||||
static auto id = std::string(g_MasterID).substr(0, 16);
|
static auto id = std::string(g_MasterID).substr(0, 16);
|
||||||
return id;
|
return id;
|
||||||
@@ -35,7 +39,7 @@ extern "C" void shrink32to4(const char* input32, char* output4); // output4
|
|||||||
#pragma comment(lib, "lib/shrink.lib")
|
#pragma comment(lib, "lib/shrink.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool WritePwdHash(char* target, const std::string & pwdHash) {
|
bool WritePwdHash(char* target, const std::string & pwdHash, const Validation& verify) {
|
||||||
char output32[33], output4[5];
|
char output32[33], output4[5];
|
||||||
shrink64to32(pwdHash.c_str(), output32);
|
shrink64to32(pwdHash.c_str(), output32);
|
||||||
shrink32to4(output32, output4);
|
shrink32to4(output32, output4);
|
||||||
@@ -47,6 +51,7 @@ bool WritePwdHash(char* target, const std::string & pwdHash) {
|
|||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
ASSERT(IsPwdHashValid(target));
|
ASSERT(IsPwdHashValid(target));
|
||||||
#endif
|
#endif
|
||||||
|
memcpy(target+100, &verify, sizeof(verify));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,13 @@
|
|||||||
// CPasswordDlg 对话框
|
// CPasswordDlg 对话框
|
||||||
std::string GetPwdHash();
|
std::string GetPwdHash();
|
||||||
|
|
||||||
|
const Validation* GetValidation(int offset=100);
|
||||||
|
|
||||||
std::string GetMasterId();
|
std::string GetMasterId();
|
||||||
|
|
||||||
bool IsPwdHashValid(const char* pwdHash = nullptr);
|
bool IsPwdHashValid(const char* pwdHash = nullptr);
|
||||||
|
|
||||||
bool WritePwdHash(char* target, const std::string& pwdHash);
|
bool WritePwdHash(char* target, const std::string& pwdHash, const Validation &verify);
|
||||||
|
|
||||||
class CPasswordDlg : public CDialogEx
|
class CPasswordDlg : public CDialogEx
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
|
|
||||||
|
#ifdef _WINDOWS
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#else
|
||||||
|
#include <windows.h>
|
||||||
|
#define Mprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "pwd_gen.h"
|
#include "pwd_gen.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <wincrypt.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include "common/commands.h"
|
||||||
|
|
||||||
#pragma comment(lib, "Advapi32.lib")
|
#pragma comment(lib, "Advapi32.lib")
|
||||||
|
|
||||||
@@ -115,3 +128,10 @@ std::string getFixedLengthID(const std::string& hash) {
|
|||||||
std::string deriveKey(const std::string& password, const std::string& hardwareID) {
|
std::string deriveKey(const std::string& password, const std::string& hardwareID) {
|
||||||
return hashSHA256(password + " + " + hardwareID);
|
return hashSHA256(password + " + " + hardwareID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string getDeviceID() {
|
||||||
|
std::string hardwareID = getHardwareID();
|
||||||
|
std::string hashedID = hashSHA256(hardwareID);
|
||||||
|
std::string deviceID = getFixedLengthID(hashedID);
|
||||||
|
return deviceID;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "stdafx.h"
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
|
||||||
#include <sstream>
|
|
||||||
#include <iomanip>
|
|
||||||
#include <wincrypt.h>
|
|
||||||
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD><EFBFBD>˹<EFBFBD><CBB9>ܽ<EFBFBD><DCBD>м<EFBFBD><D0BC><EFBFBD>
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD><EFBFBD>˹<EFBFBD><CBB9>ܽ<EFBFBD><DCBD>м<EFBFBD><D0BC><EFBFBD>
|
||||||
@@ -18,3 +13,4 @@ std::string getFixedLengthID(const std::string& hash);
|
|||||||
|
|
||||||
std::string deriveKey(const std::string& password, const std::string& hardwareID);
|
std::string deriveKey(const std::string& password, const std::string& hardwareID);
|
||||||
|
|
||||||
|
std::string getDeviceID();
|
||||||
|
|||||||
BIN
server/2015Remote/res/Bitmap/authorize.bmp
Normal file
BIN
server/2015Remote/res/Bitmap/authorize.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 822 B |
Binary file not shown.
Reference in New Issue
Block a user