3gstudent / feedback

0 stars 0 forks source link

关于 [2018-3-15-渗透技巧——获得Windows系统的远程桌面连接历史记录] 的一点细节问题 #47

Closed w-devin closed 3 years ago

w-devin commented 3 years ago

在代码样例:

$RegPath = "Registry::HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers\"
$QueryPath = dir $RegPath -Name
foreach($Name in $QueryPath)
{   
    Try  
    {  
        $User = (Get-ItemProperty -Path $RegPath$Name -ErrorAction Stop | Out-Null).UsernameHint
            Write-Host "Server:"$Name
            Write-Host "User:"$User"`n"
        }
        Catch  
        {
        Write-Host "No RDP Connections History"
        }
}

| Out-Null 应该会导致$User 为空

3gstudent commented 3 years ago

感谢,已更正