我尝试通过 PowerShell 和 PowerShell ISE(版本 5.1.1)中的 mmcat.exe 提取主引导记录 (MBR)。输出的二进制数据总是大于 512 字节。PowerShell 6.1.1 仍然存在这个问题。
$mmcat = "C:\Tools\sleuthkit\bin\mmcat.exe"
& $mmcat -t dos "$EWF_IMAGE" 0 > "$OUTPUT\Disk-Geometry\MBR.bin"
Run Code Online (Sandbox Code Playgroud)
这个问题在这里得到了很好的描述: PowerShell's Object Pipeline Corrupts Piped Binary Data
你知道解决这个问题的方法吗?
我想将输出插入到文件中...在特定文本之后的下一行。
在我的输出(Text1.txt)中,我有不同的域名行:
hxxp://example1.com
hxxp://example2.com
Run Code Online (Sandbox Code Playgroud)
我想将此行插入到另一个文本文件(Text2.txt)中包含文本“URLs found”的行之后(注意:我不知道行号)。
bla
bla
bla
URLs found
hxxp://example1.com
hxxp://example2.com
bla
bla
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我想grep一个模式并删除匹配模式的行,并且还在上下文之前的1行和4行之后.我试过了:
grep -v -A 4 -B 1
Run Code Online (Sandbox Code Playgroud)
提前致谢!
例:
Rule: r1
Owner: Process explorer.exe Pid 1544
0x01ec350f 8b 45 a8 0f b6 00 8d 4d a8 ff 14 85 c8 7f ed 01 .E.....M........
0x01ec351f 84 c0 75 ec 8b 4d fc e8 ba f5 fe ff f7 85 b0 fd ..u..M..........
0x01ec352f ff ff 00 00 01 00 75 13 33 c0 50 50 50 68 48 28 ......u.3.PPPhH(
0x01ec353f eb 01 33 d2 8b cb e8 b0 57 …Run Code Online (Sandbox Code Playgroud) 我想在自动化PowerShell脚本中进行多次测量。我使用了Get-Date和TotalSeconds。结果看起来像这样:236.908
如何以分钟和秒为单位获得经过的时间?
$startTime = (Get-Date)
$endTime = (Get-Date)
$ElapsedTime = (($endTime-$startTime).TotalSeconds)
Write-Host "Duration: xx min xx sec"
Run Code Online (Sandbox Code Playgroud)