[Python] Finding connected IP addresses
Timothy Bolz
bolzt at efn.org
Thu Oct 19 12:48:24 PDT 2006
Thanks Bob
I think nmap is nice. I've been looking and reading trying to find out how to
at least get my ip.
>>> import socket
>>> ip = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>>> ip.connect(("1.1.1.1",1))
>>> print ip.getsockname()
('192.168.0.5', 32926)
I've read somewhere python keeps a socket open to do things like this.
I guess I could do a loop to check all the internal ip address.
Well I did find something what I looking for But I think it would be nice in
an IM who's on format.
http://www.marko.net/cheops/features.html
I liked the above the best.
http://projects.icapsid.net/fe3d/screens.html#fe3d-0.9
The above was a windows build but screenshots are nice.
Umit looks nice but too, almost what I want.
http://sourceforge.net/projects/umit
Umit runs in python too.
Trying to get Umit going. I'm having problems.
Again Thanks
Tim
On Monday 16 October 2006 13:26, Bob Miller wrote:
> Timothy Bolz wrote:
> > I'd like to find the ip addresses of the computers on my network
> > with python.
>
> Take a look at nmap. It scans a range of IP addresses and reports
> which ones respond. (Nmap is not Python, sorry.)
>
> > 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.
>
> Take a look at the obsolete finger and rwho protocols. Those are both
> designed to show who's logged in on which boxes.
>
> Note that both protocols are relics from a time when network security
> was much more lax. Don't run them on a publicly accessible network,
> nor on one where you wouldn't trust all the users with your root
> password.
>
> Ubuntu has packages for the original rwho and rwhod programs from
> Berkeley. It has dozens of finger clients and servers to choose from,
> and I don't have a recommendation.
>
> > My connection is using DHCP so it can change.
>
> You can configure your DHCP server so that it always binds a
> particular MAC address to a particular IP address. Then your hosts'
> IP addresses won't change.
>
> > 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
>
> How about /sbin/ifconfig?
>
> I apologize for the non-Python nature of my answers.
More information about the Python
mailing list