How to detect OS version of a web server

核能气质少年 提交于 2019-12-24 17:33:04

问题


Is there a way to detect the Operating System version of a web server using its IP address (with knowledge that the web server is running php).

I haven't attempted to code it yet, as i am a beginner. Is it easy? Is it possible or not possible at all?


回答1:


There's no official way to detect OS on a remote server across all operating systems and configurations. It's often considered a security risk to expose such information, since it can be used to research directed attacks based on the version of the OS and any services it runs.

However, you can fingerprint systems to "guess" the OS, depending on the services it exposes. Many services will reveal the OS that is currently running, some will hint at it or provide broad information about the system.

I certainly wouldn't suggest anyone inexperienced in PHP attempt such a project, but here are some links to get you started:

  • Finger Protocol: http://en.wikipedia.org/wiki/Finger_protocol
  • nmap security scanner (includes OS fingerprinting): http://nmap.org/
  • nmap's book on remote OS detection: http://nmap.org/book/osdetect.html

If you're just trying to find out the OS of the user viewing your website, you should look into the User-Agent HTTP header: http://en.wikipedia.org/wiki/User_agent




回答2:


your question is kind a unclear but I asume you want to display the OS of the system your website is running on? You can try:

<?php
echo (string)(PHP_OS);
?>

or

<?php
echo $_SERVER['SERVER_SOFTWARE'];
?>

But this will never return a precise version of your OS as it will only indicating the platform(windows, linux, macos, etc) and the latter script also displays 32/64 bit under windows.



来源:https://stackoverflow.com/questions/9164161/how-to-detect-os-version-of-a-web-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!