Feature: Add Shine/HELL protocol selection to share/transfer host

Add a dedicated ShareHostDlg with a "Use Shine protocol" checkbox (default
checked) so the operator can choose Shine (0) or HELL (1) when sharing or
transferring a host. The chosen protocol is appended to the wire payload as a
trailing colon field: "IP:PORT:0/1" for share and "IP:PORT:days:0/1" for
transfer.

The client parses the trailing field from COMMAND_SHARE and
COMMAND_ASSIGN_MASTER, applies it to new connections, and persists it so
auto-share/auto-transfer on restart keeps the same protocol. Old clients
ignore the extra field, and old/missing payloads fall back to -1 (baked-in
HELL), preserving compatibility with existing servers and share_list entries.

Co-Authored-By: deepseek-v4-pro
This commit is contained in:
yuanyuanxianganddeepseek-v4-pro committed 2026-09-11 16:28:37 +02:00
1 parent 42df128f62
commit e9d60e6e23
12 files changed
+223 -17

No files matched your search

+14 -11
View File
@@ -27,6 +27,7 @@
#include <filesystem>
#include "KeyBoardDlg.h"
#include "InputDlg.h"
#include "ShareHostDlg.h"
#include "CPasswordDlg.h"
#include "FeatureFlags.h"
#include "FeatureLimitsDlg.h"
@@ -7903,7 +7904,7 @@ LRESULT CMy2015RemoteDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
void CMy2015RemoteDlg::OnOnlineShare()
{
CInputDialog dlg(this);
CShareHostDlg dlg(this, FALSE);
dlg.Init(_TR("分享主机"), _TR("输入<IP:PORT>地址:"));
dlg.SetHistoryKey("ShareAddress");
if (dlg.DoModal() != IDOK || dlg.m_str.IsEmpty())
@@ -7912,9 +7913,10 @@ void CMy2015RemoteDlg::OnOnlineShare()
MessageBoxL("字符串长度超出[0, 250]范围限制!", "提示", MB_ICONINFORMATION);
return;
}
CharMsg* buf = new CharMsg(dlg.m_str.GetLength()+1);
memcpy(buf->data, dlg.m_str, dlg.m_str.GetLength());
buf->data[dlg.m_str.GetLength()] = 0;
CString payload = dlg.m_str + _T(":") + (dlg.m_bShine ? _T("0") : _T("1"));
CharMsg* buf = new CharMsg(payload.GetLength()+1);
memcpy(buf->data, payload, payload.GetLength());
buf->data[payload.GetLength()] = 0;
PostMessageA(WM_SHARE_CLIENT, (WPARAM)buf, NULL);
}
@@ -9779,26 +9781,27 @@ void CMy2015RemoteDlg::OnShellcodeTestAesBin()
void CMy2015RemoteDlg::OnOnlineAssignTo()
{
CInputDialog dlg(this);
CShareHostDlg dlg(this, TRUE);
dlg.Init(_TR("转移主机(到期自动复原)"), _TR("输入<IP:PORT>地址:"));
dlg.SetHistoryKey("ShareAddress");
dlg.Init2(_TR("天数(支持浮点数):"), "30");
if (dlg.DoModal() != IDOK || dlg.m_str.IsEmpty() || atof(dlg.m_sSecondInput.GetString())<=0)
dlg.InitDays(_TR("天数(支持浮点数):"), "30");
if (dlg.DoModal() != IDOK || dlg.m_str.IsEmpty() || atof(dlg.m_sDays.GetString())<=0)
return;
if (dlg.m_str.GetLength() >= 250) {
MessageBoxL("字符串长度超出[0, 250]范围限制!", "提示", MB_ICONINFORMATION);
return;
}
if (dlg.m_sSecondInput.GetLength() >= 6) {
if (dlg.m_sDays.GetLength() >= 6) {
MessageBoxL("超出使用时间可输入的字符数限制!", "提示", MB_ICONINFORMATION);
return;
}
CString daysProto = dlg.m_sDays + _T(":") + (dlg.m_bShine ? _T("0") : _T("1"));
CharMsg* buf1 = new CharMsg(dlg.m_str.GetLength() + 1);
CharMsg* buf2 = new CharMsg(dlg.m_sSecondInput.GetLength() + 1);
CharMsg* buf2 = new CharMsg(daysProto.GetLength() + 1);
memcpy(buf1->data, dlg.m_str, dlg.m_str.GetLength());
memcpy(buf2->data, dlg.m_sSecondInput, dlg.m_sSecondInput.GetLength());
memcpy(buf2->data, daysProto, daysProto.GetLength());
buf1->data[dlg.m_str.GetLength()] = 0;
buf2->data[dlg.m_sSecondInput.GetLength()] = 0;
buf2->data[daysProto.GetLength()] = 0;
PostMessageA(WM_ASSIGN_CLIENT, (WPARAM)buf1, (LPARAM)buf2);
}