简体   繁体   English

“#awk '/open/{print $2}' hostdiscovery.gnmap > livehosts.txt”需要一个 windows Nmap 行

[英]Need a windows Nmap line for “# awk '/open/{print $2}' hostdiscovery.gnmap > livehosts.txt”

I need to do this step after first scanning ports, I have a hostdiscovery.gnmap file after that and this is my next step:我需要在第一次扫描端口后执行此步骤,之后我有一个hostdiscovery.gnmap文件,这是我的下一步:

awk '/open/{print $2}' hostdiscovery.gnmap > livehosts.txt

but this is a Linux command line and I'm using windows for this project I need to do on my PC... do you know how I can get the similar windows command?但这是一个 Linux 命令行,我正在为这个项目使用 windows 我需要在我的 PC 上执行...你知道我如何获得类似的 Z0F4137ED1502B5045D6083AA258B5C4Z2 命令吗?

This is my source on step 2: https://www.networkstraining.com/nmap-commands-cheat-sheet/这是我在第 2 步的来源: https://www.networkstraining.com/nmap-commands-cheat-sheet/

With Powershell:使用 Powershell:

ForEach ( $lin in Get-Content hostdiscovery.gnmap ) { if ($lin -like "*open*") { $wrds=$lin.Split(" "); Write-Output $wrds[1] } } >> livehosts.txt

Read the file hostdiscovery.gnmap line by line and then if the line contains "open", split the line into the array wrds and print the first index (the second word)逐行读取文件hostdiscovery.gnmap,然后如果该行包含“open”,则将该行拆分为数组wrds并打印第一个索引(第二个单词)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM