How to determine whether client and server are on the same host

Malte Forkel malte.forkel at berlin.de
Tue Nov 26 07:13:40 EST 2013


Am 26.11.2013 12:38, schrieb Chris Angelico:
> There is another way you might be able to do this. The server could
> simply create a cookie in the file system - say, a file in /tmp with a
> randomly-generated name - and it can announce that to the client. If
> the client sees the same file in what it sees as /tmp, then it can
> assume that it's running on the server. Obviously there's a miniscule
> probability of an accidental collision, and someone could deliberately
> fool it, but for a simple check, that might work.
> 
That is a clever idea. While I can't modify the server, I could look at
the files on the host running the application and try to determine if
they fit to information from the server about its files. If both match,
I could then conclude that application host and server host probably are
the same. But, I still couldn't be sure.

Isn't there anything in telnetlib that can differentiate between a local
connection and a remote connection? Or may be some unique property of
each host that I could use?

Malte






More information about the Python-list mailing list