psychoone7 / pyftpdlib

Automatically exported from code.google.com/p/pyftpdlib
Other
0 stars 0 forks source link

Show all available IP addresses in verbose mode #276

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
After launching pyftpdlib in default mode (0.0.0.0), it is impossible to tell 
to which IP I should connect with my FTP client.

What is the expected output? What do you see instead?
expected> $ pyftpdlib --verbose
expected> >>> starting FTP server on 0.0.0.0:21
expected> ... interfaces that server currently listens on
expected> ...   - 127.0.0.1
expected> ...   - 192.168.1.89
expected> ...   - 129.28.23.11

Please use labels and text to provide additional information.
Do you know how to get the list of IP addresses for network interfaces?
I guess there are two cases:
  1. 0.0.0.0 IPs before listening (expected)
  2. after listening (actual)
I wonder if a new interface is added after pyftpdlib started, will it listen on 
a new interface also if started with 0.0.0.0?

Original issue reported on code.google.com by techtonik@gmail.com on 15 Dec 2013 at 9:54

GoogleCodeExporter commented 9 years ago
AFAIK python does not provide anything to list addresses associated with NIC 
interfaces, or at least not in a portable fashion.
There are third party libs which do that (pcapy comes to mind) but nothing 
within the stdlib.

Displaying NIC "private" addresses is not very important though.
The IP you are usually interested in is the "public" IP address, which is the 
address of your gateway, and the only way to determine that is to have your FTP 
server interact with services such as whatsmyip.org. That is something which 
pyftpdlib should not do by default though.

Original comment by g.rodola on 15 Dec 2013 at 11:02

GoogleCodeExporter commented 9 years ago
The network topology is rightfully out of scope of pyftpdlib. The thing that it 
can do is to report only it's own addresses.

Actually, I thought that this info is exposed in 
http://code.google.com/p/psutil/ =)

I am now looking at 
http://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pytho
ns-stdlib

Original comment by techtonik@gmail.com on 15 Dec 2013 at 11:12

GoogleCodeExporter commented 9 years ago
Hehe yes, indeed this is something I'm planning to implement in psutil. =)
See: https://code.google.com/p/psutil/issues/detail?id=376

Original comment by g.rodola on 15 Dec 2013 at 11:24

GoogleCodeExporter commented 9 years ago
Moved to https://code.google.com/p/psutil/issues/detail?id=376 in search for 
solution.

Original comment by techtonik@gmail.com on 15 Dec 2013 at 1:20

GoogleCodeExporter commented 9 years ago
Closing this out as won't fix as it's something which shouldn't be handled by 
pyftpdlib.

Original comment by g.rodola on 11 Apr 2014 at 4:34