Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP - Is possible to find if user is browsing from beind a Router and get Router Info

Hello guys.

I think it isn't possible just using PHP, but just to be sure.

  • Is it possible for PHP to know if the user is accessing the web from behind a Router?
  • And if yes, how can i get some information about that router, like:
    • Router Name, Brand, Serial Number, ...
    • Users connected in the same network.
  • Can PHP also find the Local IP Address for the visitor in that Network?

A few simple questions. To which i haven't found a solid answer, and i tough that some PHP genius could tell me. And teach me.

Thanks for your help.

EDIT: Motives for this privacy invasive question

I didn't thought that i had to say this... But i guess i do

I was writing a couple functions that would get the browser preferred languages and finding out from which Country the user comes based on the IP, to deliver my website content in the right language to the visitor.

Then i started to think, most people browse from behind the router, can i find out if they are indeed?


Then it just came to my mind to do one of those simple programs that display network details, people connected on your network. My idea was to do that, but Web App Based not Desktop App Based as all other programs of this kind.

I appreciate privacy above everything as most developers do, so i kind of understand the Down Votes, i would probably Down Vote myself.

I'm sorry if you misjudge me due to my weird question, i have nothing to do so.. These things just popped up on my head.

like image 526
Fábio Antunes Avatar asked Dec 18 '22 01:12

Fábio Antunes


2 Answers

First, are you talking about finding out information about users visiting your website? Keep in mind that this implies an intrusion into their privacy (you can try it with yourself though ;))

Is it possible for PHP to know if the user is accessing the web from behind a Router?

No you cannot. Only when you know that e.g. you have a lot visitors from one company and they all have the same IP address, they might be behind a router but it could also be a proxy.

And if yes, how can i get some information about that router, like:

  • Router Name, Brand, Serial Number, ...

If you have the IP you might be able to discover various things about a host with tools such as nmap. You might be able to find out the brand of a router and host system but definitely not serial number and such stuff. nmap is not PHP though.
Note: The use of such tools without permission to do so is illegal in some countries. In any way, the use of such tools without permission is morally questionable .

  • Users connected in the same network.

As I mentioned in the first question, if you have different users with the same IP address they might be in the same network. They could also be in different sub-networks. Anyway you cannot get their local IP addresses.

Can PHP also find the Local IP Address for the visitor in that Network?

See previous answer.


You see, everything is very vague and mostly based on assumptions. You cannot get reliable information and I am very glad that we are not totally transparent yet.

Once we all use IPv6, the whole story is a different one.

like image 121
Felix Kling Avatar answered Jan 19 '23 01:01

Felix Kling


I have no idea what you're trying to do, but it worries me a little.

So I'm glad that (as you suspected) it's not possible.

All the details you're asking about is information that there's no reason for anyone outside the local network to need, it would be a huge security problem if a router was broadcasting this to the world.

like image 33
Chad Birch Avatar answered Jan 18 '23 23:01

Chad Birch