What I had:
- /etc/hosts file full of local resources + comments
- Pings packages are filter out in the local network
#****Luxoft hosts******
172.30.16.111 luxoftwebmail.luxoft.com #some comments
172.30.128.32 testdb.other.domain.com
To do:
- Use /etc/hosts file
- Skip comments
- Grab custom hosts names
- To monitor the hosts and see what ports are open
Solutions:
To skip comments
less /etc/hosts |grep ^[^#]
To grab only custom hosts
|grep -o "\([[:space:]].*luxoft.com\)\||\([[:space:]].*other.domain.com\)"
where-o - to display only matcher strings
To monitor the hosts and see what ports are open
|nmap -PN -oA hostsMonitoring -iL -
where
-PN - use no pings
-oA - out to the file
-iL - - to get list of host from the input stream
Putting all together
less /etc/hosts |grep ^[^#] |grep -o "\([[:space:]].*luxoft.com\)\|\([[:space:]].*other.domain.com\)"|nmap -PN -oA hostsMonitoring -iL -

0 comments:
Post a Comment