나는 내가 가지고 있는 도메인으로 몇 가지 테스트를 수행하고 있습니다. TXT 쿼리를 수행할 때 base64에서 문자열을 수신하고 메시지를 표시하는 디코딩을 원합니다.
Linux에서는 완벽하게 작동합니다.
$ dig -t txt my.domain.com +short | sed -e 's/^"//' -e 's/"$//' | base64 -d > file.txt
$ cat file.txt
내 txt 레코드 테스트하기
이제 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}
Windows에서 작동하도록 위의 명령(Linux)을 어떻게 적용할 수 있습니까? base64의 교반 및 디코딩만 사용하여 메시지를 표시할 수 있습니다.
답변1
또는 Youtube의 모든 무료 리소스와 비디오를 활용하여 PowerShell을 배우는 데 필요한 시간을 투자하여 PowerShell의 모든 부분을 이해하고 기본적으로 수행할 수 있는 작업과 직접 코딩해야 하는 경우, 타사 도구를 가져와야 하는 경우를 이해합니다. .
이런 질문을 받은 것은 이번이 처음이 아닙니다. 'PowerShell Sed' 및 'PowerShell Grep'을 사용하여 빠른 웹 검색을 수행하면 이에 대한 좋은 목록과 예제도 표시됩니다.
Get-Content 지정된 위치에 있는 항목의 콘텐츠를 가져옵니다.
Select-String 문자열과 파일에서 텍스트를 찾습니다.
PowerShell의 sed
https://docs.microsoft.com/en-us/archive/blogs/sergey_babkins_blog/sed-in-powershell
PowerShell – UNIX SED와 동일 – 파일의 텍스트 변경
https://www.kittell.net/code/powershell-unix-sed-equivalent-change-text-file
PowerShell에서 sed 및 grep 사용
https://www.catapultsystems.com/blogs/using-sed-and-grep-in-powershell
http://www.systemcentercentral.com/using-sed-and-grep-in-powershell
Grep, PowerShell 방식
https://communary.net/2014/11/10/grep-the-powershell-way
PowerShell에서 "grep"하는 방법
https://antjanus.com/blog/web-development-tutorials/how-to-grep-in-powershell
PowerShell에서 Grep하는 방법
https://www.adamfowlerit.com/2017/02/how-to-grep-in-powershell
빠른 팁: PowerShell Grep과 동일
https://dereknewton.com/2010/12/powershell-grep-equvalent
POWERSHELL: 문자열을 검색하거나 POWERSHELL을 GREP으로 검색하세요.
https://www.thomasmaurer.ch/2011/03/powershell-search-for-string-or-grep-for-powershell
둘째, 활용마이크로소프트 파워셸갤러리PowerShell 콘솔이나 새로운 Windows 터미널에서 직접 ...
Find-Module -Name '*grep*' | Format-Table -AutoSize
Version Name Repository Description
------- ---- ---------- -----------
1.1.0 PoshGrep PSGallery Greplike PowerShell function
Find-Package -Name '*grep*' | Format-Table -AutoSize
Name Version Source Summary
---- ------- ------ -------
wk.Grep 0.2.0 nuget.org Package Description
Liv.Grep 1.0.5436.17982 nuget.org Grep utility written in c#. Makes it easy to query command line outputs
AstroGrep 4.3.2 nuget.org This application and its source code are freely distributable.
GRepo 1.0.0 nuget.org GRepo
PoshGrep 1.1.0 PSGallery Greplike PowerShell function
... 또는 팝업 도움말을 제공하는 PowerShell 편집기를 사용하는 경우/IntelliSense(PowerShell_ISE 내장,VScode 다운로드,파워셸 플러스무료) 또는 (Sapien의 PowerShell 스튜디오- 돈이 든다.)
마지막으로 코드에서도 dig를 사용하고 있습니다. 이에 대해서는 다음을 참조하십시오.