feat: Add showing client type feature
This commit is contained in:
13
ReadMe.txt
13
ReadMe.txt
@@ -242,3 +242,16 @@ reorg: Move commands to common/commands.h
|
||||
2.解决客户端接收大数据包的问题! 主控程序增加显示被控端版本信息,以便实现针对老版本在线更新(仅限基于TestRun的服务)的能力。
|
||||
在主控程序上面增加了显示被控端启动时间的功能,以便掌握被控端程序的稳定性。
|
||||
3.完善生成服务程序的功能。
|
||||
|
||||
2024.12.29
|
||||
增加显示被控程序"类型"的功能:如果被控程序为单个EXE则显示为"EXE",如果被控程序为EXE调用动态库形式,则显示为"DLL".
|
||||
当前,只有类型为DLL的服务支持在线升级。本次提交借机对前一个更新中的"预留字段"进行了验证。
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QQ:962914132
|
||||
联系方式:[Telegram](https://t.me/doge_grandfather) [Email](mailto:yuanyuanxiang163@gmail.com) [LinkedIn](https://www.linkedin.com/in/wishyuanqi)
|
||||
问题报告:请提交 [Issues](https://github.com/yuanyuanxiang/SimpleRemoter/issues) 欢迎提交 [Merge requests](https://github.com/yuanyuanxiang/SimpleRemoter/pulls)
|
||||
|
||||
@@ -13,7 +13,7 @@ using namespace std;
|
||||
#define REG_NAME "a_ghost"
|
||||
|
||||
// Զ<>̵<EFBFBD>ַ
|
||||
CONNECT_ADDRESS g_SETTINGS = {FLAG_GHOST, "", 0};
|
||||
CONNECT_ADDRESS g_SETTINGS = {FLAG_GHOST, "", 0, CLIENT_TYPE_ONE};
|
||||
|
||||
// Ӧ<>ó<EFBFBD><C3B3><EFBFBD>״̬<D7B4><CCAC>1-<2D><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD> 2-<2D><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD> 3-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
BOOL g_bExit = 0;
|
||||
@@ -166,6 +166,7 @@ extern "C" __declspec(dllexport) void TestRun(char* szServerIP,int uPort)
|
||||
{
|
||||
g_bExit = FALSE;
|
||||
g_SETTINGS.SetServer(szServerIP, uPort);
|
||||
g_SETTINGS.SetType(CLIENT_TYPE_DLL);
|
||||
|
||||
HANDLE hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)StartClient,NULL,0,NULL);
|
||||
if (hThread == NULL) {
|
||||
@@ -204,7 +205,7 @@ DWORD WINAPI StartClient(LPVOID lParam)
|
||||
continue;
|
||||
}
|
||||
//<><D7BC><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SendLoginInfo(ClientObject, GetTickCount64()-dwTickCount);
|
||||
SendLoginInfo(ClientObject, GetTickCount64()-dwTickCount, g_SETTINGS.ClientType());
|
||||
|
||||
CKernelManager Manager(ClientObject);
|
||||
bool bIsRun = 0;
|
||||
|
||||
@@ -155,7 +155,7 @@ std::string getProcessTime() {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
int SendLoginInfo(IOCPClient* ClientObject,DWORD dwSpeed)
|
||||
int SendLoginInfo(IOCPClient* ClientObject,DWORD dwSpeed, int nType)
|
||||
{
|
||||
LOGIN_INFOR LoginInfor;
|
||||
LoginInfor.bToken = TOKEN_LOGIN; // <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>¼
|
||||
@@ -182,6 +182,7 @@ int SendLoginInfo(IOCPClient* ClientObject,DWORD dwSpeed)
|
||||
LoginInfor.dwCPUMHz = dwCPUMHz;
|
||||
LoginInfor.bWebCamIsExist = bWebCamIsExist;
|
||||
strcpy_s(LoginInfor.szStartTime, getProcessTime().c_str());
|
||||
sprintf_s(LoginInfor.szReserved, "%s", nType==CLIENT_TYPE_DLL?"DLL":"EXE");
|
||||
int iRet = ClientObject->OnServerSending((char*)&LoginInfor, sizeof(LOGIN_INFOR));
|
||||
|
||||
return iRet;
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
#pragma comment(lib,"Vfw32.lib")
|
||||
|
||||
int SendLoginInfo(IOCPClient* ClientObject,DWORD dwSpeed);
|
||||
int SendLoginInfo(IOCPClient* ClientObject,DWORD dwSpeed, int nType);
|
||||
DWORD CPUClockMHz();
|
||||
BOOL WebCamIsExist();
|
||||
|
||||
@@ -24,7 +24,7 @@ IsExit bExit = NULL;
|
||||
|
||||
BOOL status = 0;
|
||||
|
||||
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN,"",0 };
|
||||
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "", 0, CLIENT_TYPE_DLL };
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
||||
void DebugPrivilege()
|
||||
@@ -110,8 +110,8 @@ int main(int argc, const char *argv[])
|
||||
SetConsoleCtrlHandler(&callback, TRUE);
|
||||
|
||||
do {
|
||||
BOOL ret = Run(argc > 1 ? argv[1] : (strlen(g_ConnectAddress.szServerIP) == 0 ? "127.0.0.1" : g_ConnectAddress.szServerIP),
|
||||
argc > 2 ? atoi(argv[2]) : (g_ConnectAddress.iPort == 0 ? 6543 : g_ConnectAddress.iPort));
|
||||
BOOL ret = Run(argc > 1 ? argv[1] : (strlen(g_ConnectAddress.ServerIP()) == 0 ? "127.0.0.1" : g_ConnectAddress.ServerIP()),
|
||||
argc > 2 ? atoi(argv[2]) : (g_ConnectAddress.ServerPort() == 0 ? 6543 : g_ConnectAddress.ServerPort()));
|
||||
if (ret == 1) {
|
||||
return -1;
|
||||
}
|
||||
@@ -168,16 +168,17 @@ BOOL Run(const char* argv1, int argv2) {
|
||||
bExit = hDll ? IsExit(GetProcAddress(hDll, "IsExit")) : NULL;
|
||||
if (run)
|
||||
{
|
||||
char* ip = g_ConnectAddress.szServerIP;
|
||||
int& port = g_ConnectAddress.iPort;
|
||||
char ip[_MAX_PATH];
|
||||
strcpy_s(ip, g_ConnectAddress.ServerIP());
|
||||
int port = g_ConnectAddress.ServerPort();
|
||||
strcpy(p + 1, "settings.ini");
|
||||
if (_access(path, 0) == -1) { // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD>ȴӲ<C8B4><D3B2><EFBFBD><EFBFBD><EFBFBD>ȡֵ<C8A1><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD>g_ConnectAddressȡֵ.
|
||||
strcpy(ip, argv1);
|
||||
port = argv2;
|
||||
}
|
||||
else {
|
||||
GetPrivateProfileStringA("settings", "localIp", g_ConnectAddress.szServerIP, ip, _MAX_PATH, path);
|
||||
port = GetPrivateProfileIntA("settings", "ghost", g_ConnectAddress.iPort, path);
|
||||
GetPrivateProfileStringA("settings", "localIp", g_ConnectAddress.ServerIP(), ip, _MAX_PATH, path);
|
||||
port = GetPrivateProfileIntA("settings", "ghost", g_ConnectAddress.ServerPort(), path);
|
||||
}
|
||||
printf("[server] %s:%d\n", ip, port);
|
||||
do
|
||||
|
||||
@@ -7,12 +7,14 @@
|
||||
#define _MAX_PATH 260
|
||||
#endif
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>Ψһ<CEA8><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
#define FLAG_FINDEN 0x1234567
|
||||
|
||||
#define FLAG_GHOST 0x7654321
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><D4B7><EFBFBD><EFBFBD>仯ʱ<E4BBAF><CAB1>Ӧ<EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>Ա<EFBFBD><D4B1>Ա<EFBFBD><D4B1>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define DLL_VERSION "20241228" // DLL<4C>汾
|
||||
#define DLL_VERSION "20241229" // DLL<4C>汾
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>б<EFBFBD>
|
||||
enum
|
||||
@@ -136,22 +138,41 @@ enum
|
||||
SERVER_EXIT, // <20><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD>
|
||||
};
|
||||
|
||||
#define CLIENT_TYPE_DLL 0 // <20>ͻ<EFBFBD><CDBB>˴<EFBFBD><CBB4><EFBFBD><EFBFBD><EFBFBD>DLL<4C><4C><EFBFBD><EFBFBD>
|
||||
#define CLIENT_TYPE_ONE 1 // <20>ͻ<EFBFBD><CDBB>˴<EFBFBD><CBB4><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD>EXE<58><45><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
typedef struct CONNECT_ADDRESS
|
||||
{
|
||||
public:
|
||||
unsigned long dwFlag;
|
||||
char szServerIP[_MAX_PATH];
|
||||
int iPort;
|
||||
int iType;
|
||||
|
||||
public:
|
||||
void SetType(int typ) {
|
||||
iType = typ;
|
||||
}
|
||||
const unsigned long & Flag() const {
|
||||
return dwFlag;
|
||||
}
|
||||
const char* ServerIP()const {
|
||||
return szServerIP;
|
||||
}
|
||||
int ServerPort()const {
|
||||
return iPort;
|
||||
}
|
||||
int ClientType()const {
|
||||
return iType;
|
||||
}
|
||||
void SetServer(const char* ip, int port) {
|
||||
strcpy_s(szServerIP, ip);
|
||||
iPort = port;
|
||||
}
|
||||
bool IsValid()const {
|
||||
return strlen(szServerIP) != 0 && iPort > 0;
|
||||
}
|
||||
} CONNECT_ADDRESS ;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߺ<EFBFBD><DFBA><EFBFBD><EFBFBD>͵ļ<CDB5><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
|
||||
@@ -42,6 +42,7 @@ enum
|
||||
ONLINELIST_PING, //PING(<28>Է<EFBFBD><D4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
ONLINELIST_VERSION, // <20>汾<EFBFBD><E6B1BE>Ϣ
|
||||
ONLINELIST_LOGINTIME, // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
ONLINELIST_CLIENTTYPE, // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ONLINELIST_MAX,
|
||||
};
|
||||
|
||||
@@ -64,7 +65,8 @@ COLUMNSTRUCT g_Column_Data_Online[g_Column_Count_Online] =
|
||||
{"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ", 72 },
|
||||
{"PING", 100 },
|
||||
{"<EFBFBD>汾", 80 },
|
||||
{"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>", 180 },
|
||||
{"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>", 150 },
|
||||
{"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 50 },
|
||||
};
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><F2A1B0B9>ڡ<EFBFBD><DAA1>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD> CAboutDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
@@ -329,7 +331,7 @@ VOID CMy2015RemoteDlg::TestOnline()
|
||||
|
||||
|
||||
VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName, CString strOS,
|
||||
CString strCPU, CString strVideo, CString strPing, CString ver, CString st, CONTEXT_OBJECT* ContextObject)
|
||||
CString strCPU, CString strVideo, CString strPing, CString ver, CString st, CString tp, CONTEXT_OBJECT* ContextObject)
|
||||
{
|
||||
EnterCriticalSection(&m_cs);
|
||||
//Ĭ<><C4AC>Ϊ0<CEAA><30> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -343,6 +345,7 @@ VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName
|
||||
m_CList_Online.SetItemText(i,ONLINELIST_PING,strPing);
|
||||
m_CList_Online.SetItemText(i, ONLINELIST_VERSION, ver);
|
||||
m_CList_Online.SetItemText(i, ONLINELIST_LOGINTIME, st);
|
||||
m_CList_Online.SetItemText(i, ONLINELIST_CLIENTTYPE, tp.IsEmpty()?"DLL":tp);
|
||||
|
||||
m_CList_Online.SetItemData(i,(DWORD_PTR)ContextObject);
|
||||
|
||||
@@ -1070,8 +1073,8 @@ LRESULT CMy2015RemoteDlg::OnUserToOnlineList(WPARAM wParam, LPARAM lParam)
|
||||
strVideo = LoginInfor->bWebCamIsExist ? "<EFBFBD><EFBFBD>" : "<EFBFBD><EFBFBD>";
|
||||
|
||||
strAddr.Format("%d", nSocket);
|
||||
|
||||
AddList(strIP,strAddr,strPCName,strOS,strCPU,strVideo,strPing,LoginInfor->moduleVersion,LoginInfor->szStartTime,ContextObject);
|
||||
AddList(strIP,strAddr,strPCName,strOS,strCPU,strVideo,strPing,LoginInfor->moduleVersion,LoginInfor->szStartTime,
|
||||
LoginInfor->szReserved,ContextObject);
|
||||
delete LoginInfor;
|
||||
return S_OK;
|
||||
}catch(...){
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
VOID InitControl(); //<2F><>ʼ<EFBFBD>ؼ<EFBFBD>
|
||||
VOID TestOnline(); //<2F><><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD>
|
||||
VOID AddList(CString strIP, CString strAddr, CString strPCName, CString strOS,
|
||||
CString strCPU, CString strVideo, CString strPing, CString ver, CString st, CONTEXT_OBJECT* ContextObject);
|
||||
CString strCPU, CString strVideo, CString strPing, CString ver, CString st, CString tp, CONTEXT_OBJECT* ContextObject);
|
||||
VOID ShowMessage(BOOL bOk, CString strMsg);
|
||||
VOID CreatStatusBar();
|
||||
VOID CreateToolBar();
|
||||
|
||||
@@ -60,13 +60,12 @@ void CBuildDlg::OnBnClickedOk()
|
||||
MessageBox("<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD>!");
|
||||
return CDialog::OnOK();
|
||||
}
|
||||
unsigned long flag = index == 0 ? FLAG_FINDEN : (index == 1 ? FLAG_GHOST : FLAG_FINDEN);
|
||||
unsigned long flag = index == 0 ? FLAG_FINDEN : FLAG_GHOST;
|
||||
//////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ//////////////////////
|
||||
CONNECT_ADDRESS g_ConnectAddress = { flag,"",0 };
|
||||
strcpy(g_ConnectAddress.szServerIP,m_strIP); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP
|
||||
CONNECT_ADDRESS g_ConnectAddress = { flag, "", 0, index };
|
||||
g_ConnectAddress.SetServer(m_strIP, atoi(m_strPort));
|
||||
|
||||
g_ConnectAddress.iPort=atoi(m_strPort); //<2F>˿<EFBFBD>
|
||||
if (strlen(m_strIP)==0 || g_ConnectAddress.iPort==0)
|
||||
if (!g_ConnectAddress.IsValid())
|
||||
return;
|
||||
try
|
||||
{
|
||||
@@ -95,12 +94,17 @@ void CBuildDlg::OnBnClickedOk()
|
||||
File.Read(szBuffer,dwFileSize);
|
||||
File.Close();
|
||||
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<49>Ͷ˿<CDB6> <20><>Ҫ<EFBFBD><D2AA>Ѱ<EFBFBD><D1B0>0x1234567<36><37><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶȻ<CAB6><C8BB>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
int iOffset = MemoryFind((char*)szBuffer,(char*)&g_ConnectAddress.dwFlag,dwFileSize,sizeof(DWORD));
|
||||
int iOffset = MemoryFind((char*)szBuffer,(char*)&g_ConnectAddress.Flag(),dwFileSize,sizeof(DWORD));
|
||||
if (iOffset==-1)
|
||||
{
|
||||
MessageBox(CString(path) + "\r\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>\"" + file + "\"<EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD>!");
|
||||
return;
|
||||
}
|
||||
if (MemoryFind((char*)szBuffer + iOffset + sizeof(sizeof(g_ConnectAddress)), (char*)&g_ConnectAddress.Flag(),
|
||||
dwFileSize - iOffset - sizeof(sizeof(g_ConnectAddress)), sizeof(DWORD)) != -1) {
|
||||
MessageBox(CString(path) + "\r\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>\"" + file + "\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!");
|
||||
return;
|
||||
}
|
||||
memcpy(szBuffer+iOffset,&g_ConnectAddress,sizeof(g_ConnectAddress));
|
||||
//<2F><><EFBFBD>浽<EFBFBD>ļ<EFBFBD>
|
||||
strcpy(p+1, "ClientDemo.exe");
|
||||
|
||||
Reference in New Issue
Block a user