Suramya's Blog : Welcome to my crazy life…

January 20, 2010

List all machines connected to a LAN with additional details on each

Filed under: Knowledgebase,Security Tools,Tech Related — Suramya @ 12:15 AM

If you ever had to figure out how many systems are connected to a network and what IP’s they have then you will find this tip useful. It is also useful to identify any rouge machines on your network if you know how many systems are supposed to be there on that network. Like in case of my home network, where I know the exact no of machines.

There are multiple software out that, that allow you to do this. Some are free, some are very expensive. In my opinion the best one is nmap. It is free, fast and can be scripted.

To find all machines on my LAN (IP Range: 192.168.2.x) I just have to issue the following command:

nmap -sP 192.168.2.0/24

This gives an output like the following when I run it as a normal user:

suramya@Wyrm:~$ nmap -sP 192.168.2.0/24

Starting Nmap 5.00 ( http://nmap.org ) at 2010-01-20 00:01 IST
Host 192.168.2.1 is up (0.0018s latency).
Host 192.168.2.5 is up (0.00018s latency).
Host 192.168.2.100 is up (0.00018s latency).
Nmap done: 256 IP addresses (3 hosts up) scanned in 2.93 seconds

When I run the same command as root, it gives me additional information that looks like:

Wyrm:~# nmap -sP 192.168.2.0/24
Starting Nmap 5.00 ( http://nmap.org ) at 2010-01-19 23:50 IST
Host 192.168.2.1 is up (0.0015s latency).
MAC Address: 00:XX:XX:XX:XX:XX (Cisco-Linksys)
Host 192.168.2.5 is up.
Host 192.168.2.100 is up (0.011s latency).
MAC Address: 00:XX:XX:XX:XX:XX (Intel)
Nmap done: 256 IP addresses (3 hosts up) scanned in 3.00 seconds

In this case, as you can see nmap also gives me the MAC address of the machine. 192.168.2.5 is the machine I ran the scan from so I didn’t get any information on that one.

If you want additional details on a system you can issue the following command to get the system to try and identify the OS and services running in detail.

nmap -A 192.168.2.5

It gives an output that looks something like:

Wyrm:~# nmap -A 192.168.2.5
Starting Nmap 5.00 ( http://nmap.org ) at 2010-01-19 23:52 IST
Interesting ports on 192.168.2.5:
Not shown: 995 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 5.1p1 Debian 8 (protocol 2.0)
| ssh-hostkey: 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx (DSA)
|_ 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx (RSA)
80/tcp open http Apache httpd 2.2.14 ((Debian))
|_ html-title: Index of /
139/tcp open netbios-ssn Samba smbd 3.X (workgroup: WORKGROUP)
445/tcp open netbios-ssn Samba smbd 3.X (workgroup: WORKGROUP)
631/tcp open ipp CUPS 1.4
Device type: general purpose
Running: Linux 2.6.X
OS details: Linux 2.6.17 – 2.6.28
Network Distance: 0 hops
Service Info: OS: Linux

Host script results:
additional information on the server

Hope you also find this useful.

– Suramya

6 Comments »

  1. Thnx suramya…
    do you have any idea to get details about connected machines without using any s/w??
    If you have please reply..
    Bcs Im trying to create a s/w to get details about connected machines without installing any s/w on client machines.

    Comment by Ahamed — September 28, 2010 @ 10:50 PM

  2. Well.. you could put a for loop and ping each IP address in the subnet. If you get a response then that is a valid machine. Can’t think of ways to get additional info without using nmap or something similar.

    In any case nmap is usually installed by default on most linux systems.

    – Suramya

    Comment by Suramya — October 2, 2010 @ 11:21 PM

  3. Suramya,
    You don’t need to install any software on the client. nmap will only be installed on the server. And it will report all the machines connected to the network.

    Comment by Mehul Ved — October 15, 2010 @ 9:24 PM

  4. oops the previous comment was addressed to Ahamed. My bad.

    Comment by Mehul Ved — October 15, 2010 @ 9:26 PM

  5. Hi suramya,
    I want to check all the systems ip address and gateways which is connected in my local lan network, Can you please tel me where we find the software for.

    Regards,
    Naveen.

    Comment by Naveen Kumar K — December 20, 2010 @ 2:12 PM

  6. i am also trying for the same but not able to get
    i am uisng asp.net web application
    i am able to get all the systems names in LAN aswell as their IP
    but i am not able to get the details of the systems in LAN lie their processor, type, RAM , port no used etc

    i tried many ways hop e to get it solved

    Comment by SVK — April 19, 2011 @ 11:01 AM

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress