Jump to content

Network Discovery (from linux)


rev.dennis
 Share

Recommended Posts

Trying to discover hosts in a subnet from a linux box and here is what I came up with so far


 


Using a BASH script:



subnet=192.168.2.
addr=1
while [ $addr -lt 256 ]; do
ping -c 1 -t 1 $subnet$addr > /dev/null && echo Found $subnet$addr
let addr=addr+1
done

OR this script may work better



subnet=192.168.2.
for addr in `seq 1 1 255 `; do
( ping -c 1 -t 1 $subnet$addr > /dev/null && echo Found $subnet$addr ) &
done

OR even ping the broadcast address like this



ping -b 192.168.2.255

OR use arp-scan (if loaded)




sudo arp-scan -I eth0 192.168.2.0/24

OR utilize nmap (one of my favorite discovery tools)





nmap -v -sP 192.168.0.0/16 10.0.0.0/8


 

OR even another script



FOR /L %i IN (1,1,254) DO ping -n 1 10.254.254.%i | FIND /i “Reply”>> ipaddresses.txt


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...