欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

卡巴加密驱动解密代码

程序员文章站 2022-04-26 23:19:14
之前看卡巴的驱动,发现它的kl1.sys会在BOOT时读取参数,然后将drivers下的.dat驱动解密并自己分配内存加载(加载的代码填充IAT部分有BUG) 写了个解密小程序: 只试了klick.sys ... 08-10-08...
之前看卡巴的驱动,发现它的kl1.sys会在boot时读取参数,然后将drivers下的.dat驱动解密并自己分配内存加载(加载的代码填充iat部分有bug)
写了个解密小程序:
只试了klick.sys
#include "stdafx.h"
#include "windows.h"
#include "winbase.h"
#include "malloc.h"
unsigned char data[256] = {
0x42, 0xa3, 0x53, 0x04, 0x4d, 0x4b, 0xa3, 0xc4, 0xec, 0xf8, 0xe5, 0x41, 0x9d, 0xef, 0xae, 0x46,
0x95, 0x59, 0x7d, 0xf3, 0x98, 0xbd, 0xdc, 0xd4, 0x1f, 0xe9, 0xc1, 0xd9, 0xfb, 0xf1, 0xe9, 0x8d,
0x85, 0x0b, 0x7b, 0x14, 0x56, 0x12, 0x33, 0xcc, 0xfd, 0x47, 0x48, 0xf5, 0x0c, 0x4c, 0x24, 0xc2,
0x3d, 0x2f, 0xb6, 0xc4, 0x66, 0xd3, 0xdd, 0x73, 0x54, 0xae, 0xe4, 0x4f, 0xf1, 0x1b, 0x94, 0xfc,
0xbc, 0x4e, 0x7c, 0x66, 0xf4, 0x90, 0xcd, 0xa1, 0xa2, 0xf7, 0xb6, 0xdd, 0x83, 0x57, 0x04, 0x7c,
0x10, 0x14, 0x20, 0x10, 0xf4, 0x3c, 0x2c, 0x7a, 0x87, 0x30, 0xab, 0x3c, 0xde, 0x86, 0x31, 0xce,
0x4d, 0x63, 0xad, 0xcb, 0xb3, 0x13, 0x94, 0xfa, 0x5b, 0xd5, 0x88, 0x98, 0x06, 0x29, 0xeb, 0xa0,
0x20, 0x3a, 0xdb, 0x7a, 0x80, 0xbd, 0x1d, 0x08, 0xc3, 0x05, 0x56, 0xca, 0x44, 0xa1, 0xab, 0x3a,
0x41, 0x43, 0x6a, 0x2c, 0x64, 0x27, 0x53, 0xcd, 0xe9, 0x09, 0x45, 0x16, 0x46, 0xaf, 0xbe, 0xb8,
0x0d, 0x8d, 0xba, 0x1b, 0xe1, 0xf3, 0xd2, 0x50, 0xaa, 0xd1, 0x3c, 0xca, 0xea, 0x8d, 0x10, 0xe5,
0x59, 0x2c, 0xa1, 0x21, 0x9b, 0x08, 0xdb, 0x2e, 0x2c, 0x62, 0x6e, 0xff, 0xb1, 0xeb, 0xaa, 0x2d,
0x90, 0xff, 0x0c, 0x59, 0x7b, 0x3a, 0x08, 0xec, 0x0a, 0xc9, 0xc3, 0x4c, 0x63, 0x4f, 0x73, 0xc1,
0xc8, 0x4e, 0xa5, 0x9c, 0xb0, 0xee, 0xf4, 0xee, 0x4d, 0x93, 0x13, 0x67, 0x9e, 0x3d, 0x4d, 0xa6,
0x01, 0x5f, 0x1f, 0x61, 0x8f, 0x9e, 0x57, 0xac, 0x44, 0xb5, 0xfb, 0x40, 0x1e, 0xfc, 0x00, 0xae,
0xda, 0x36, 0xea, 0x49, 0x64, 0x05, 0x1a, 0x1b, 0x4e, 0xd4, 0x29, 0x4d, 0xbb, 0x81, 0x7d, 0x6b,
0xc4, 0xf2, 0x39, 0x98, 0xc9, 0x2f, 0xb7, 0xcb, 0xbd, 0x6d, 0xfc, 0x3e, 0xc9, 0x3e, 0x20, 0xab
};

int main(int argc, char* argv[])
{
file* file ;

if (argc != 2)
{
printf("input sys name!\n");
return 0;

}
printf("decode drv file:%s\n" , argv[1]);
file = fopen(argv[1] , "r b");
fseek(file , 0, seek_end);
ulong t = ftell(file);
printf("file length x\n" , t);
ulong u =(ulong)malloc(t);

fseek(file , 0 , seek_set);
dword z = fread((pvoid)u , 1 , t , file);

fseek(file , 0 , seek_set);

ulong i ;
for (i = 0 ; i < t ; i )

{
__asm
{
push edx
push ecx
mov edx , u
mov ecx , i
mov eax , i
and eax , 0xff
mov al , data[eax]
xor [edx ecx] , al
pop ecx
pop edx
}

}
printf("%u", t);
fwrite((pvoid)u , 1 , t , file);
fclose(file);
printf("ok!\n");
return 0 ;

}