tags:

views:

48

answers:

3

How can I get information about a user's PC connected to my socket

+1  A: 

Look here. See "# Echo server program" section.

conn, addr = s.accept()
print 'Connected by', addr

I am unsure if this is what you are looking for, hth.

nc3b
+2  A: 

a socket is a "virtual" channel established between to electronic devices through a network (a bunch of wires). the only informations available about a remote host are those published on the network.

the basic informations are those provided in the TCP/IP headers, namely the remote IP address, the size of the receive buffer, and a bunch of useless flags. for any other informations, you will have to request from other services.

a reverse DNS lookup will get you a name associated with the IP address. a traceroute will tell you what is the path to the remote computer (or at least to a machine acting as a gateway/proxy to the remote host). a Geolocation request can give you an approximate location of the remote computer. if the remote host is a server itself accessible to the internet through a registered domain name, a WHOIS request can give you the name of the person in charge of the domain. on a LAN (Local Area Network: a home or enterprise network), an ARP or RARP request will get you a MAC address and many more informations (as much as the network administrator put when they configured the network), possibly the exact location of the computer.

there are many many more informations available, but only if they were published. if you know what you are looking for and where to query those informations, you can be very successful. if the remote host is quite hidden and uses some simple stealth technics (anonymous proxy) you will get nothing relevant.

Adrien Plisson
A: 

You could try asking identd about the connection, but a lot of hosts don't run that or only put up info there that you can't use.

Donal Fellows
I'm not sure I've seen a response from an identd query since 1998. :)
Kylotan