문제

I'm wanting to find computers with ssh open on my subnet but it shows all host that are up in the results and not just the ones that have open ports this is my command

nmap -PN -p 22 --open -oG - 192.168.*.* | awk '{print $2}' > sshopen.txt

Thanks

도움이 되었습니까?

해결책

You can select with awk to print only in certain cases and not all.

For example, the following matches the last field, if it contains ssh (but you could test also for 22) then it prints the IP.

nmap -PN -p 22 --open -oG - 192.168.*.* | awk '$NF~/ssh/{print $2}' > sshopen.txt
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top