6

Tip #405   Find all SSH Hosts

If you want to find all SSH enabled hosts in all subnets to which your computer is connected, you can use this oneliner:

nmap -p22 -oG - $(ip addr | awk '/inet .*global/ {print $2}' | tr '\n' ' ') | awk '/22\/open/ {print $2}' | uniq

 
  • TAGS: