Windows注册表修改
2018-02-21 17:43
309 查看
有多种方法可以对注册表实现新建、修改、删除等
在恶意代码的行为之中,一般都是将其自身设置到Windows的开机自动启动项中,以达到开机自启动的目的,从而实现对本地机器的监控、开启后门、木马服务端等的功能
方法一:本地运行reg脚本、
举例如下:Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
"Calculation"="C:\\Windows\\system32\\calc.exe"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP6\try\abc]
"valueItem1"="my value"
"valueItem2"=dword:00000014
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP6\try]
"valueItem3"=hex(7):5c,00,44,00,65,00,76,00这里有几个细节:
第一行的5.00标识的是XP版本,一般都是在XP虚拟机里做实验的,其他版本有不同的标识
之后的每一个中括号表示在不同项中作的不同修改
[~~~Run]:这里添加了开机启动项,添加了计算器
[~~~abc]:这里添加了两个值,一个是字符串值,一个是数字值
[~~~try]:这里添加了一个二进制值
方法二:C语言代码,利用API函数对注册表进行操作// reg.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <string.h>
#pragma comment(lib,"Advapi32.lib")
void CreateStringReg(HKEY hRoot,char *szSubKey,char* ValueName,char *Data)
{
HKEY hKey;
long lRet=RegCreateKeyEx(hRoot,szSubKey,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
if (lRet!=ERROR_SUCCESS)
{
printf("error no RegCreateKeyEx %s\n", szSubKey);
return ;
}
lRet=RegSetValueEx(hKey,ValueName,0,REG_SZ,(BYTE*)Data,strlen(Data));
if (lRet!=ERROR_SUCCESS)
{
printf("error no RegSetValueEx %s\n", ValueName);
return;
}
printf("Win~\n");
RegCloseKey(hKey);
return;
}
int autorun()
{
char SystemPath[512];
GetSystemDirectory(SystemPath,sizeof(SystemPath));
strcat(SystemPath,"\\calc.exe");
CreateStringReg(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Windows\\Run","Calculation",SystemPath);
return 0;
}
int main(int argc, char* argv[])
{
autorun();
return 0;
}
在恶意代码的行为之中,一般都是将其自身设置到Windows的开机自动启动项中,以达到开机自启动的目的,从而实现对本地机器的监控、开启后门、木马服务端等的功能
方法一:本地运行reg脚本、
举例如下:Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
"Calculation"="C:\\Windows\\system32\\calc.exe"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP6\try\abc]
"valueItem1"="my value"
"valueItem2"=dword:00000014
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP6\try]
"valueItem3"=hex(7):5c,00,44,00,65,00,76,00这里有几个细节:
第一行的5.00标识的是XP版本,一般都是在XP虚拟机里做实验的,其他版本有不同的标识
之后的每一个中括号表示在不同项中作的不同修改
[~~~Run]:这里添加了开机启动项,添加了计算器
[~~~abc]:这里添加了两个值,一个是字符串值,一个是数字值
[~~~try]:这里添加了一个二进制值
方法二:C语言代码,利用API函数对注册表进行操作// reg.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <string.h>
#pragma comment(lib,"Advapi32.lib")
void CreateStringReg(HKEY hRoot,char *szSubKey,char* ValueName,char *Data)
{
HKEY hKey;
long lRet=RegCreateKeyEx(hRoot,szSubKey,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,NULL);
if (lRet!=ERROR_SUCCESS)
{
printf("error no RegCreateKeyEx %s\n", szSubKey);
return ;
}
lRet=RegSetValueEx(hKey,ValueName,0,REG_SZ,(BYTE*)Data,strlen(Data));
if (lRet!=ERROR_SUCCESS)
{
printf("error no RegSetValueEx %s\n", ValueName);
return;
}
printf("Win~\n");
RegCloseKey(hKey);
return;
}
int autorun()
{
char SystemPath[512];
GetSystemDirectory(SystemPath,sizeof(SystemPath));
strcat(SystemPath,"\\calc.exe");
CreateStringReg(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Windows\\Run","Calculation",SystemPath);
return 0;
}
int main(int argc, char* argv[])
{
autorun();
return 0;
}
相关文章推荐
- 修改注册表,关闭windows 2003的默认共享文件与修改注册表自动登录Windows 2003系统
- 开发Windows Mobile和Wince(Windows Embedded CE)的部署项目(Deploy Project)时,如何修改注册表
- 通过修改注册表建立Windows自定义协议
- 通过修改注册表实现Windows 隐藏账户
- Windows注册表中修改CMD默认路径
- 修改 windows 注册表 跨屏幕显示 参数
- 注册表修改windows 系统安全日志大小
- windows系统通过命令行方式修改多字符串值类型的注册表
- java修改windows注册表设置程序自动运行
- windows文件关联、打开方式列表之修改注册表攻略
- 通过修改注册表建立Windows自定义协议
- 用VBScript实现对Windows注册表的修改
- windows 通过修改注册表来修改主机名
- Windows下使用注册表修改网卡信息
- windows注册表修改计算机名
- windows文件关联、打开方式列表之修改注册表攻略
- 修改注册表 去除Windows快捷方式图标小箭头
- Windows:修改注册表让Windows XP自动登录
- Windows注册表修改实例完全手册(上)
- windows 批处理注册表修改