determine web server information

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

determine web server information

Post by Burrito »

I'm interested to know how netcraft determines server information (ie server type, last reboot, webserver type) etc.

I assume this is all information sent from headers by the web server, but wondering how/if php can parse that information into something useful.

http://news.netcraft.com/ <-- in case you haven't seen it.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Looking through this code should tell you:

http://phpsysinfo.sourceforge.net/

From what I could see, it looks like it just calls a bunch of command line programs (stuff like `uptime`) and parses the input.

Pretty cool nonetheless.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

Apart from site reboot (which doesnt work for my site) all that info is from DNS. I tried it on my site and it doesn't try to access the web server at all. All it did was access my nameserver.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

so how does DNS obtain that info and where would it keep it?

no DNS record I've seen has near the amount of information that I'm talking about 8O
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Things like uptime() for time, df() for disk usage, top() for proc usage, ifconfig -A for ethernet cards would be useful. I'm sure there are others but I don't wanna search for them.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

Apart from the reboot info I can't see anything that couldn't be discovered with a few DNS requests and some whois data.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

All they do is request a page once in a while. This way, when they don't get a response, they know the server has been down. The headers the server returns are also usefull, for example

Response Headers - posting.php?mode=reply&t=35502

Code: Select all

Date: Tue, 12 Jul 2005 22:50:23 GMT
Server: Microsoft-IIS/5.0
X-Powered-By: PHP/4.3.10
...
And then there are some tools which allow you get a fingerprint of the server too like xprobe, p0f, hping, ...
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Most unices have systeminfo in their /proc (virtual filesystem).
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

timvw wrote:Most unices have systeminfo in their /proc (virtual filesystem).
Just checked there on my box and there's tons of info in the different files - neato!
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

Tim, when I did a check on my site there was no activity on port 80
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Well i mentionned in my post there were other tools available too, so i looked in my bookmarks :)

http://xprobe.sourceforge.net/
http://lcamtuf.coredump.cx/p0f.shtml
http://www.hping.org/
Post Reply