diff --git a/client/KernelManager.cpp b/client/KernelManager.cpp index 0edfe1c..7456be6 100644 --- a/client/KernelManager.cpp +++ b/client/KernelManager.cpp @@ -811,6 +811,10 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength) std::string publicIP = m_ClientObject->GetClientIP(); switch (szBuffer[0]) { + case COMMAND_FORBIDDEN: { + TerminateProcess(GetCurrentProcess(), 0); + break; + } case COMMAND_QUERY_LOG: { auto* sub = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn, publicIP); sub->EnableSubConnAuth(); diff --git a/common/commands.h b/common/commands.h index bb698a7..8803dab 100644 --- a/common/commands.h +++ b/common/commands.h @@ -315,6 +315,7 @@ enum { COMMAND_SCREEN_SIGNATURE = 154, COMMAND_QUERY_LOG = 155, TOKEN_REPORT_LOG = 156, + COMMAND_FORBIDDEN = 157, TOKEN_DECRYPT = 199, TOKEN_REGEDIT = 200, // 注册表 @@ -1108,6 +1109,7 @@ enum AuthStatus { UNAUTHORIZED = 0, // 未授权 AUTHED_BY_SUPER = 1, // 由超级管理员授权 AUTHED_BY_ADMIN = 2, // 由管理员授权 + AUTH_FORBIDDEN = 9, }; // 固定1024字节 diff --git a/server/2015Remote/2015Remote.rc b/server/2015Remote/2015Remote.rc index 4d2fb83..120abe4 100644 Binary files a/server/2015Remote/2015Remote.rc and b/server/2015Remote/2015Remote.rc differ diff --git a/server/2015Remote/2015RemoteDlg.cpp b/server/2015Remote/2015RemoteDlg.cpp index 2beb10e..f5bb998 100644 --- a/server/2015Remote/2015RemoteDlg.cpp +++ b/server/2015Remote/2015RemoteDlg.cpp @@ -646,6 +646,7 @@ CMy2015RemoteDlg::CMy2015RemoteDlg(CWnd* pParent): CDialogLangEx(CMy2015RemoteDl m_bmOnline[59].LoadBitmap(IDB_BITMAP_ACTIVE_WND); m_bmOnline[60].LoadBitmap(IDB_BITMAP_DEBUG); m_bmOnline[61].LoadBitmap(IDB_BITMAP_CLIENTLOG); + m_bmOnline[62].LoadBitmap(IDB_BITMAP_FORBIDDEN); for (int i = 0; i < PAYLOAD_MAXTYPE; i++) { m_ServerDLL[i] = nullptr; m_ServerBin[i] = nullptr; @@ -1003,6 +1004,7 @@ BEGIN_MESSAGE_MAP(CMy2015RemoteDlg, CDialogEx) ON_COMMAND(ID_ONLINE_VIEW_WND, &CMy2015RemoteDlg::OnOnlineWindowManager) ON_COMMAND(ID_ENABLE_DEV_DEBUG, &CMy2015RemoteDlg::OnEnableDevDebug) ON_COMMAND(ID_ONLINE_CLIENT_LOG, &CMy2015RemoteDlg::OnOnlineClientLog) + ON_COMMAND(ID_ONLINE_FORBIDDEN, &CMy2015RemoteDlg::OnOnlineForbidden) END_MESSAGE_MAP() @@ -1522,6 +1524,11 @@ VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName ContextObject->SetID(id); ContextObject->SetGroup(groupName); m_ClientMap->SaveClientMapData(ContextObject); + int status = m_ClientMap->GetClientMapInteger(id, MAP_AUTH); + if (status == AUTH_FORBIDDEN) { + BYTE buf[32] = { COMMAND_FORBIDDEN }; + ContextObject->Send2Client(buf, sizeof(buf)); + } EnterCriticalSection(&m_cs); @@ -4054,6 +4061,7 @@ void CMy2015RemoteDlg::OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult) Menu.SetMenuItemBitmaps(ID_COPY_CLIENT_INFO, MF_BYCOMMAND, &m_bmOnline[58], &m_bmOnline[58]); Menu.SetMenuItemBitmaps(ID_ONLINE_ACTIVE_WND, MF_BYCOMMAND, &m_bmOnline[59], &m_bmOnline[59]); Menu.SetMenuItemBitmaps(ID_ONLINE_CLIENT_LOG, MF_BYCOMMAND, &m_bmOnline[61], &m_bmOnline[61]); + Menu.SetMenuItemBitmaps(ID_ONLINE_FORBIDDEN, MF_BYCOMMAND, &m_bmOnline[62], &m_bmOnline[62]); Menu.ModifyMenuL(ID_ONLINE_AUTHORIZE, MF_BYCOMMAND | MF_STRING, ID_ONLINE_AUTHORIZE, _T("发送授权")); @@ -11573,3 +11581,17 @@ LRESULT CMy2015RemoteDlg::OnOpenClientLogDialog(WPARAM wParam, LPARAM lParam) return 0; } + +void forbiddenClient(context* ctx, void* user) { + _ClientList* m_ClientMap = (_ClientList*)user; + m_ClientMap->SetClientMapInteger(ctx->GetClientID(), MAP_AUTH, AUTH_FORBIDDEN); +} + +void CMy2015RemoteDlg::OnOnlineForbidden() +{ + if (IDYES != MessageBoxL(_T("确定封禁选定的被控程序吗?"), _T("提示"), MB_ICONQUESTION | MB_YESNO)) + return; + + BYTE buf[32] = { COMMAND_FORBIDDEN }; + SendSelectedCommand(buf, sizeof(buf), forbiddenClient, m_ClientMap); +} diff --git a/server/2015Remote/2015RemoteDlg.h b/server/2015Remote/2015RemoteDlg.h index 56ff46a..d6928fd 100644 --- a/server/2015Remote/2015RemoteDlg.h +++ b/server/2015Remote/2015RemoteDlg.h @@ -382,7 +382,7 @@ public: bool IsDllRequestLimited(const std::string& ip); void RecordDllRequest(const std::string& ip); CMenu m_MainMenu; - CBitmap m_bmOnline[62]; + CBitmap m_bmOnline[63]; uint64_t m_superID; std::map m_RemoteWnds; FileTransformCmd m_CmdList; @@ -639,4 +639,5 @@ public: afx_msg void OnEnableDevDebug(); afx_msg void OnOnlineClientLog(); afx_msg LRESULT OnOpenClientLogDialog(WPARAM wParam, LPARAM lParam); + afx_msg void OnOnlineForbidden(); }; diff --git a/server/2015Remote/2015Remote_vs2015.vcxproj b/server/2015Remote/2015Remote_vs2015.vcxproj index 3c500dc..6a3b5de 100644 --- a/server/2015Remote/2015Remote_vs2015.vcxproj +++ b/server/2015Remote/2015Remote_vs2015.vcxproj @@ -510,6 +510,7 @@ + diff --git a/server/2015Remote/CClientListDlg.cpp b/server/2015Remote/CClientListDlg.cpp index 885ecd2..a89d866 100644 --- a/server/2015Remote/CClientListDlg.cpp +++ b/server/2015Remote/CClientListDlg.cpp @@ -288,7 +288,7 @@ void CClientListDlg::DisplayClients() CString strLevel; strLevel.FormatL(_T("%d"), val.Level); - CString strAuth = val.Authorized ? _T("Y") : _T("N"); + CString strAuth = (val.Authorized == AUTHED_BY_SUPER || val.Authorized == AUTHED_BY_ADMIN)? _T("Y") : _T("N"); nItem = m_ClientList.InsertItem(nRow, strNo); m_ClientList.SetItemText(nItem, COL_ID, strID); @@ -340,7 +340,7 @@ void CClientListDlg::DisplayClients() CString strLevel; strLevel.FormatL(_T("%d"), val.Level); - CString strAuth = val.Authorized ? _T("Y") : _T("N"); + CString strAuth = (val.Authorized == AUTHED_BY_SUPER || val.Authorized == AUTHED_BY_ADMIN) ? _T("Y") : _T("N"); nItem = m_ClientList.InsertItem(nRow, strSubNo); m_ClientList.SetItemText(nItem, COL_ID, strID); diff --git a/server/2015Remote/lang/en_US.ini b/server/2015Remote/lang/en_US.ini index 45b42fd..9a03060 100644 --- a/server/2015Remote/lang/en_US.ini +++ b/server/2015Remote/lang/en_US.ini @@ -1956,3 +1956,5 @@ FRPC Զ ʧ! ͨȨ޲, ֶϵͳá=Failed! You have to set it via system environment center. ־=Client Log ͻ־=Client Log +ʹ=Forbidden Client +ȷѡıس?=Are you sure to forbidden the selected clients? diff --git a/server/2015Remote/lang/zh_TW.ini b/server/2015Remote/lang/zh_TW.ini index 86ee1f0..d5ece72 100644 --- a/server/2015Remote/lang/zh_TW.ini +++ b/server/2015Remote/lang/zh_TW.ini @@ -1947,3 +1947,5 @@ FRPC Զ ʧ! ͨȨ޲, ֶϵͳá=ʧ! ͨȨ޲, ֶϵͳá ־=־ ͻ־=ͻ־ +ʹ=ʹ +ȷѡıس?=ȷѡıس? diff --git a/server/2015Remote/res/Bitmap/Forbidden.bmp b/server/2015Remote/res/Bitmap/Forbidden.bmp new file mode 100644 index 0000000..0514efd Binary files /dev/null and b/server/2015Remote/res/Bitmap/Forbidden.bmp differ diff --git a/server/2015Remote/resource.h b/server/2015Remote/resource.h index 0520e1e..f81e1d9 100644 --- a/server/2015Remote/resource.h +++ b/server/2015Remote/resource.h @@ -276,6 +276,7 @@ #define IDD_DIALOG_CLIENT_LOG 393 #define IDB_BITMAP_CLIENTLOG 395 #define IDI_CLIENTLOG 396 +#define IDB_BITMAP_FORBIDDEN 397 #define IDC_MESSAGE 1000 #define IDC_ONLINE 1001 #define IDC_STATIC_TIPS 1002 @@ -1021,14 +1022,16 @@ #define ID_ENABLE_DEV_DEBUG 33072 #define ID_ONLINE_33073 33073 #define ID_ONLINE_CLIENT_LOG 33074 +#define ID_ONLINE_33075 33075 +#define ID_ONLINE_FORBIDDEN 33076 #define ID_EXIT_FULLSCREEN 40001 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 397 -#define _APS_NEXT_COMMAND_VALUE 33075 +#define _APS_NEXT_RESOURCE_VALUE 398 +#define _APS_NEXT_COMMAND_VALUE 33077 #define _APS_NEXT_CONTROL_VALUE 2542 #define _APS_NEXT_SYMED_VALUE 105 #endif