我正在使用我拥有的域进行一些测试,我希望在执行 TXT 查询时,接收 Base64 中的字符串并对其进行解码以显示消息。
在 Linux 上,它可以完美运行:
$ dig -t txt my.domain.com +short | sed -e 's/^"//' -e 's/"$//' | base64 -d > file.txt
$ cat file.txt
Run Code Online (Sandbox Code Playgroud)
测试我的txt记录
现在我想做同样的事情,只不过在Windows中,默认情况下Windows没有dig,但它有一个命令如下:
C:\Users\User\xyz>powershell Resolve-DnsName my.domain.com -Type
TXT > test
C:\Users\Avell\xyz>type test
Name Type TTL Section Strings
---- ---- --- ------- -------
my.domain.com TXT 10557 Answer
{dGVzdGluZyBvdXQgbXkgdHh0IHJlY29yZHMK}
Run Code Online (Sandbox Code Playgroud)
我怎样才能使上面的命令(Linux)在Windows上工作,只进行base64的搅拌和解码来显示消息。
或者花必要的时间学习 PowerShell,利用 Youtube 上的所有免费资源和视频来了解 PowerShell 的所有部分,以及本机可以完成哪些操作以及何时需要自己编码以及何时需要引入 3rdP 工具。
\n\n这不是第一次被问及这个问题。使用“PowerShell Sed”和“PowerShell Grep”进行快速网络搜索,将向您展示这些内容甚至示例的良好列表。
\n\n\n\n\nGet-Content 获取指定位置处的项目内容。
\n\n \n\nSelect-String 在字符串和文件中查找文本。
\n\n \n\nPowerShell 中的 sed
\n\nhttps://docs.microsoft.com/en-us/archive/blogs/sergey_babkins_blog/sed-in-powershell
\n\nPowerShell \xe2\x80\x93 UNIX SED 等效 \xe2\x80\x93 更改文件中的文本
\n\nhttps://www.kittell.net/code/powershell-unix-sed-equivalent-change-text-file
\n\n在 PowerShell 中使用 sed 和 grep
\n\nhttps://www.catapultsystems.com/blogs/using-sed-and-grep-in-powershell
\n\nhttp://www.systemcentercentral.com/using-sed-and-grep-in-powershell
\n\nGrep,PowerShell 方式
\n\nhttps://communary.net/2014/11/10/grep-the-powershell-way
\n\n如何在 PowerShell 中 \xe2\x80\x9cgrep\xe2\x80\x9d
\n\nhttps://antjanus.com/blog/web-development-tutorials/how-to-grep-in-powershell
\n\n如何在 PowerShell 中进行 Grep
\n\nhttps://www.adamfowlerit.com/2017/02/how-to-grep-in-powershell
\n\n快速提示:PowerShell Grep 等效项
\n\nhttps://dereknewton.com/2010/12/powershell-grep-equivalent
\n\nPOWERSHELL:搜索 POWERSHELL 的字符串或 Grep
\n\nhttps://www.thomasmaurer.ch/2011/03/powershell-search-for-string-or-grep-for-powershell
\n
其次,利用Microsoft powershellgallery其次,直接在 PowerShell 控制台或新的 Windows 终端中
\n\nFind-Module -Name \'*grep*\' | Format-Table -AutoSize\n\nVersion Name Repository Description \n------- ---- ---------- ----------- \n1.1.0 PoshGrep PSGallery Greplike PowerShell function\n\n\n\n Find-Package -Name \'*grep*\' | Format-Table -AutoSize\n\nName Version Source Summary \n---- ------- ------ ------- \nwk.Grep 0.2.0 nuget.org Package Description \nLiv.Grep 1.0.5436.17982 nuget.org Grep utility written in c#. Makes it easy to query command line outputs\nAstroGrep 4.3.2 nuget.org This application and its source code are freely distributable. \nGRepo 1.0.0 nuget.org GRepo \nPoshGrep 1.1.0 PSGallery Greplike PowerShell function\nRun Code Online (Sandbox Code Playgroud)\n\n...或者使用 PowerShell 编辑器时 - 提供弹出帮助/IntelliSense(内置 PowerShell_ISE、VScode 下载、PowerShell Plus,它们是免费的)或(Sapien\'s PowerShell Studio ) - 需要花钱。)
\n\n最后,您也在代码中使用 dig 。为此,请参阅:
\n\n\n \n\n \n\n
| 归档时间: |
|
| 查看次数: |
27545 次 |
| 最近记录: |