Windows远程桌面
July 3, 2020 12:41 AM
参考如下网站内容
1.远程桌面 Rdp文件的生成
2.rdp密码生成 v1.0
3.远程桌面,身份验证错误:要求的函数不正确等解决办法
Rdp文件的生成
1.windows+R->[cmd]->mstsc 弹出远程桌面对话框
2.输入远程主机IP、用户名,然后:选项->保存、另存为,用记事本打开,可以看到:
full address:s:192.168.2.31
username:s:Admin
3.此时,文件中无密码,生成远程连接使用的密码
- 现成的密码生成器:rdp密码生成 v1.0
- 使用win32的crypt32.dll的CryptProtectData方法
CryptProtectData function
Header dpapi.h
Library Crypt32.lib
DLL Crypt32.dll
// Encrypt data from DATA_BLOB DataIn to DATA_BLOB DataOut.
//--------------------------------------------------------------------
// Declare and initialize variables.
DATA_BLOB DataIn;
DATA_BLOB DataOut;
BYTE *pbDataInput =(BYTE *)"Hello world of data protection.";
DWORD cbDataInput = strlen((char *)pbDataInput)+1;
//--------------------------------------------------------------------
// Initialize the DataIn structure.
DataIn.pbData = pbDataInput;
DataIn.cbData = cbDataInput;
//--------------------------------------------------------------------
// Begin protect phase. Note that the encryption key is created
// by the function and is not passed.
if(CryptProtectData(
&DataIn,
L"This is the description string.", // A description string
// to be included with the
// encrypted data.
NULL, // Optional entropy not used.
NULL, // Reserved.
NULL, // Pass NULL for the
// prompt structure.
0,
&DataOut))
{
printf("The encryption phase worked.
");
}
else
{
printf("Encryption error using CryptProtectData.
");
exit(1);
}
4.生成的密码添加到Rdp文件最后,密码格式
password 51:b:01000000D08C9DDF0115D1118C7A00C04FC297EB01000000BFB48C776FDED54B849EDB08D283E9B104000000080000007000730077000000106600000001000020000000F02FB0345F7BC09C75CF8790BF6C9A8BEACF185CB5CB9BBDEABE4F9DE252E212000000000E8000000002000020000000EAF21C1DB62335A5D1618654B5035C9D6FB1C3D8A3EEBA150A3D86B7E5641DA4100000004ADC8FE7038B182884D7E8BC037FF9734000000011EC0058DBF78AABEB542FECE0643AD28D6A16E7D70673950A7762DCF83342408D4A3CF780FA53CBE4EA5467EEE72D2B4E7486F79C3CBB6B3CA43794554437F2
Exe调用 远程桌面
#include <cstdlib>
#include <windows.h>
std::system("mstsc /v 172.30.10.29");
Sleep(1000); //延时
HANDLE mstsc;
mstsc = FindWindow(NULL, (LPCTSTR)"远程桌面连接");
if(mstsc)
printf("Success.");
std::system("pause"); //让程序暂停
报错:
- 报错信息如下:出现身份验证错误,要求的函数不受支持 可能是由于CredSSP加密Oracle修正。
Solution
将默认设置从"易受攻击"更改为"缓解"的更新 CVE-2018-0886