gpt4 book ai didi

powershell - 通过PowerShell搜索没有备用数据流的数据的小问题

转载 作者:行者123 更新时间:2023-12-03 00:07:17 24 4
gpt4 key购买 nike

我正在为备用数据流测试没有ADS的文件。

function recurse($path) {
Pushd $path
Get-ChildItem -Recurse |
ForEach-Object {
if (Get-Item -Literalpath $_.FullName -Stream Test-*) {
Get-Item -Literalpath $_.FullName -Stream Test-*
} else {
Get-Item -Literalpath $_.FullName -Stream *
}
} |
Select-Object FileName, Stream,
@{n='Content';e={gc -Literalpath "$($_.FileName):$($_.Stream)"}} |
Export-Csv -NoTypeInformation -Encoding UTF8 "C:\Temp\Streams.csv"
Import-Csv "C:\Temp\Streams.csv"
}

recurse S:\Testing\Test_Tagging\6000_WK

问题是没有ADS的数据正在用 :$Data流提供给我的脚本,这需要很长时间,而且看起来也不好:

FileName Stream
Content

-------- ------ ------- S:\Testing\Test_Tagging\6000_WK\adfind.exe :$DATA
MZ ÿÿ ¸ @ º ´ Í!¸LÍ!... S:\Testing\Test_Tagging\6000_WK\admod.exe
:$DATA MZP ÿÿ ¸ @
º ´ Í!¸LÍ!... S:\Testing\Test_Tagging\6000_WK\Athens
Test-Classification.txt vertraulich
S:\Testing\Test_Tagging\6000_WK\Athens Test-KSU.txt 0.2 Temporär S:\Testing\Test_Tagging\6000_WK\mariadb-10.4.8-winx64.msi :$DATA
ÐÏࡱá > þÿ
þÿÿÿ ... S:\Testing\Test_Tagging\6000_WK\mariadb-10.4.8-winx64.msi Zone.Identifier ZoneTransfer]
S:\Testing\Test_Tagging\6000_WK\SumSum.txt
Test-Classification.txt vertraulich
S:\Testing\Test_Tagging\6000_WK\SumSum.txt Test-KSU.txt 0.2 Temporär S:\Testing\Test_Tagging\6000_WK[666]\Athens
Test-Classification.txt vertraulich
S:\Testing\Test_Tagging\6000_WK[666]\Athens Test-KSU.txt 0.2 Temporär S:\Testing\Test_Tagging\6000_WK[]\Athens
Test-Classification.txt vertraulich
S:\Testing\Test_Tagging\6000_WK[]\Athens Test-KSU.txt 0.2 Temporär



最好的方法是没有ADS的文件仅显示名称,没有流,也没有数据。

谁能帮助我成为这样的人:

FileName流内容
-------- ------ -------
S:\ Testing \ Test_Tagging \ 6000_WK \ adfind.exe
S:\ Testing \ Test_Tagging \ 6000_WK \ admod.exe
S:\ Testing \ Test_Tagging \ 6000_WK \ Athens Test-Classification.txt
S:\ Testing \ Test_Tagging \ 6000_WK \ Athens Test-KSU.txt 0.2Temporär
S:\ Testing \ Test_Tagging \ 6000_WK \ mariadb-10.4.8-winx64.msi
S:\ Testing \ Test_Tagging \ 6000_WK \ mariadb-10.4.8-winx64.msi Zone.Identifier ZoneTransfer]
S:\ Testing \ Test_Tagging \ 6000_WK \ SumSum.txt Test-Classification.txt
S:\ Testing \ Test_Tagging \ 6000_WK \ SumSum.txt Test-KSU.txt 0.2Temporär
S:\ Testing \ Test_Tagging \ 6000_WK \ [666] \ Athens Test-Classification.txt
S:\ Testing \ Test_Tagging \ 6000_WK \ [666] \ Athens Test-KSU.txt 0.2Temporär
S:\ Testing \ Test_Tagging \ 6000_WK \ [] \ Athens Test-Classification.txt
S:\ Testing \ Test_Tagging \ 6000_WK \ [] \ Athens Test-KSU.txt 0.2Temporär

最佳答案

:$Data是文件的“常规”内容。只需省略在您计算出的属性中读取该流。

... |
Select-Object FileName, Stream,
@{n='Content';e={
if ($_.Stream -ne ':$Data') {
Get-Content -Literalpath "$($_.FileName):$($_.Stream)"
}
}} |
...

关于powershell - 通过PowerShell搜索没有备用数据流的数据的小问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58970206/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com