From 4a91da0b682a9f68dc5fc9fdd7a305e943182b2e Mon Sep 17 00:00:00 2001 From: yuanyuanxiang <962914132@qq.com> Date: Sat, 26 Jul 2025 04:28:02 +0800 Subject: [PATCH] Feature: Add a menu item to build shellcode --- server/2015Remote/2015Remote.rc | Bin 90522 -> 90664 bytes server/2015Remote/2015RemoteDlg.cpp | 87 ++++++++++++++++++++++++++-- server/2015Remote/2015RemoteDlg.h | 1 + server/2015Remote/CPasswordDlg.cpp | 4 +- server/2015Remote/resource.h | Bin 44986 -> 45174 bytes 5 files changed, 85 insertions(+), 7 deletions(-) diff --git a/server/2015Remote/2015Remote.rc b/server/2015Remote/2015Remote.rc index 0cd4d275835a936e4071dca4e0f8f2dcce984580..2195b29a52399cdc66618073a3c94e1377de1086 100644 GIT binary patch delta 77 zcmbPrn03Vw)`l&NT-+i`48aT;45L7jDL|FaQx`6C3~l delta 21 dcmZ2+gmuLoadIcon(IDR_MAINFRAME); @@ -417,6 +417,7 @@ BEGIN_MESSAGE_MAP(CMy2015RemoteDlg, CDialogEx) ON_COMMAND(ID_ONLINE_UNAUTHORIZE, &CMy2015RemoteDlg::OnOnlineUnauthorize) ON_COMMAND(ID_TOOL_REQUEST_AUTH, &CMy2015RemoteDlg::OnToolRequestAuth) ON_COMMAND(ID_TOOL_INPUT_PASSWORD, &CMy2015RemoteDlg::OnToolInputPassword) + ON_COMMAND(ID_TOOL_GEN_SHELLCODE, &CMy2015RemoteDlg::OnToolGenShellcode) END_MESSAGE_MAP() @@ -655,7 +656,7 @@ LRESULT CMy2015RemoteDlg::OnShowMessage(WPARAM wParam, LPARAM lParam) { uint32_t recvHigh = (uint32_t)lParam; uint64_t restored = ((uint64_t)recvHigh << 32) | recvLow; if (restored != m_superID) - exit(-1); + THIS_APP->UpdateMaxConnection(3+time(0)%5); } return S_OK; } @@ -946,7 +947,7 @@ BOOL CMy2015RemoteDlg::OnInitDialog() CreateSolidMenu(); std::string nPort = THIS_CFG.GetStr("settings", "ghost", "6543"); - m_nMaxConnection = 1; + m_nMaxConnection = 2; std::string pwd = THIS_CFG.GetStr("settings", "Password"); auto arr = StringToVector(pwd, '-', 6); if (arr.size() == 7) { @@ -1122,7 +1123,7 @@ LRESULT CMy2015RemoteDlg::OnPasswordCheck(WPARAM wParam, LPARAM lParam) { dlg.DoModal(); if (hashSHA256(dlg.m_str.GetString()) != GetPwdHash()) { KillTimer(TIMER_CHECK); - m_nMaxConnection = 1; + m_nMaxConnection = 2; THIS_APP->UpdateMaxConnection(m_nMaxConnection); int tm = THIS_CFG.GetInt("settings", "Notify", 10); THIS_CFG.SetInt("settings", "Notify", tm - 1); @@ -1556,7 +1557,7 @@ bool CMy2015RemoteDlg::CheckValid(int trail) { if (dlg.m_sPassword != pwd) THIS_CFG.SetStr(settings, pwdKey, dlg.m_sPassword.GetString()); - int maxConn = v.size() == 7 ? atoi(v[2].c_str()) : 1; + int maxConn = v.size() == 7 ? atoi(v[2].c_str()) : 2; if (maxConn != m_nMaxConnection) { m_nMaxConnection = maxConn; THIS_APP->UpdateMaxConnection(m_nMaxConnection); @@ -2918,3 +2919,79 @@ void CMy2015RemoteDlg::OnToolInputPassword() } } } + +// 将二进制数据以 C 数组格式写入文件 +bool WriteBinaryAsCArray(const char* filename, LPBYTE data, size_t length, const char* arrayName = "data") { + FILE* file = fopen(filename, "w"); + if (!file) return false; + + fprintf(file, "unsigned char %s[] = {\n", arrayName); + for (size_t i = 0; i < length; ++i) { + if (i % 24 == 0) fprintf(file, " "); + fprintf(file, "0x%02X", data[i]); + if (i != length - 1) fprintf(file, ","); + if ((i + 1) % 24 == 0 || i == length - 1) fprintf(file, "\n"); + else fprintf(file, " "); + } + fprintf(file, "};\n"); + fprintf(file, "unsigned int %s_len = %zu;\n", arrayName, length); + + fclose(file); + return true; +} + +/* Example: