Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

username computername from CGI

Tags:

cgi

perl

is there a way to get the remote client's username and computername through CGI in perl? I tried printing ENV hash in the CGI script but i couldnt get this information

like image 806
SAN Avatar asked Mar 22 '26 05:03

SAN


2 Answers

No. That information is not passed over HTTP, and may not exist at all (e.g. my phone doesn't require me to log in with a username, it is a single user device).

You can get the IP address of the machine the request came from (which might be a proxy server), and use that to get the DNS (or other network protocol) name, but that is about as close as you can get.

like image 53
Quentin Avatar answered Mar 23 '26 20:03

Quentin


Check out the remote_host and remote_addr methods. They are likely to get you as close as you will be able to get to a "computer name". Username is not likely passed at all via http headers (e.g. technically you may consider the authorization and/or email header to be close, however its unlikely either would be populated in most situations).

The remote_host method in particular performs a reverse DNS lookup. Should something be returned you will get the result, else you will simply get the remote address (e.g. ip).

like image 23
Rocky Madden Avatar answered Mar 23 '26 19:03

Rocky Madden



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!