First POC.

This commit is contained in:
dabruh 2022-06-05 00:10:25 +02:00
parent 69aef52b9a
commit 5aca4bf06e
1 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,39 @@
function Get-Hash([string]$textToHash) {
$hasher = new-object System.Security.Cryptography.MD5CryptoServiceProvider
$toHash = [System.Text.Encoding]::UTF8.GetBytes($textToHash)
$hashByteArray = $hasher.ComputeHash($toHash)
foreach($byte in $hashByteArray){
$result += "{0:X2}" -f $byte
}
return $result;
}
$ClearClipboard = $true
$PreviousHash = Get-Hash(Get-Clipboard)
while ($true) {
$Clipboard = Get-Clipboard
$ClipboardHash = Get-Hash($Clipboard)
if ($ClipboardHash -eq $PreviousHash) {
Write-Host "NOCHG"
Start-Sleep -Milliseconds 250
Continue
}
elseif ($Clipboard -match '^bankid:\/\/\/') {
Write-Host $Clipboard
start "$Clipboard"
}
else {
Write-Host "CHG"
}
if ($ClearClipboard) {
Set-Clipboard -Value $null
}
$PreviousHash = Get-Hash($Clipboard)
Start-Sleep -Milliseconds 250
}