[Python] Finding connected IP addresses

Timothy Bolz bolzt at efn.org
Mon Oct 16 10:47:06 PDT 2006


I'd like to find the ip addresses of the computers on my network with python.  
Then  I would write a little program which polls what computers which are 
logged in and displays them like an IM who is on box.  I would be nice to 
have  a who command under each which displays if anyone is logged into each 
box.   A lot of times if I start another computer to computer I have do 
ifconfig on it then I can ssh into it.  My connection is using DHCP so it can 
change.  I would like to associate a program such as NoMachine so I could 
start the program associated to that machine.  I don't know if any of you 
have tried NoMachine it's nice, it's like VNC but faster.  It would be nice 
to have find out who's on hamachi too.  What I'm talking about it something 
like hamachi but for a local network which could use hamachi too.  I been 
looking I found this which gets a local IP

import socket
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname)
print ip

I've tried it and it give the localhost number.  I'll keep on looking I 
thought one of you would know how to get the other addresses short of pinging 
all the local ip to see if something is connected.

Thanks 
Tim


More information about the Python mailing list