如何在无法访问命令行的情况下找到运行的 Apache 版本? [英] How do I find the version of Apache running without access to the command line?
问题描述
我需要找到一个在其中编码了版本的文件,或者找到一种在网络上对其进行轮询以显示其版本的方法.尽管我可以通过 FTP 浏览安装位置,但服务器运行的主机不提供命令行访问权限.
I need to either find a file in which the version is encoded or a way of polling it across the web so it reveals its version. The server is running at a host who will not provide me command line access, although I can browse the install location via FTP.
我尝试了 HEAD,但没有报告版本号.
I have tried HEAD and do not get a version number reported.
如果我尝试一个缺失的页面来获取 404,它会被拦截,并返回一个没有服务器信息的股票页面.我猜这表明服务器被强化了.
If I try a missing page to get a 404 it is intercepted, and a stock page is returned which has no server information on it. I guess that points to the server being hardened.
仍然没有接近...
我按照建议放置了一个 PHP 文件,但我无法浏览它,也无法确定加载它的 URL 路径.在任何情况下,我都会收到大量拒绝访问的消息和相同的 404 页面.知道服务器受到了相当强大的保护,我感到有些欣慰.
I put a PHP file up as suggested, but I can't browse to it and can't quite figure out the URL path that would load it. In any case I am getting plenty of access denied messages and the same stock 404 page. I am taking some comfort from knowing that the server is quite robustly protected.
推荐答案
方法
连接到主机上的80端口并发送
The method
Connect to port 80 on the host and send it
HEAD / HTTP/1.0
这需要跟回车+换行两次
This needs to be followed by carriage-return + line-feed twice
你会得到这样的东西
HTTP/1.1 200 OK
Date: Fri, 03 Oct 2008 12:39:43 GMT
Server: Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.0 PHP/5.2.6-1ubuntu4 with Suhosin-Patch mod_perl/2.0.4 Perl/v5.10.0
Last-Modified: Thu, 02 Aug 2007 20:50:09 GMT
ETag: "438118-197-436bd96872240"
Accept-Ranges: bytes
Content-Length: 407
Connection: close
Content-Type: text/html; charset=UTF-8
然后您可以从 Server: header 中提取 apache 版本
You can then extract the apache version from the Server: header
您可以使用完整安装 Perl 的 LWP 库,例如
You could use the HEAD utility which comes with a full install of Perl's LWP library, e.g.
HEAD http://your.webserver.com/
或者,使用 curl 实用程序,例如
Or, use the curl utility, e.g.
curl --head http://your.webserver.com/
您还可以使用浏览器扩展程序来查看服务器标头,例如 实时 HTTP 标头 或 Firebug 用于 Firefox,或
You could also use a browser extension which lets you view server headers, such as Live HTTP Headers or Firebug for Firefox, or Fiddler for IE
最后.如果您使用的是 Windows,并且没有其他可用的东西,请打开命令提示符(开始"菜单->运行",输入cmd"并按回车键),然后输入这个
Finally. if you're on Windows, and have nothing else at your disposal, open a command prompt (Start Menu->Run, type "cmd" and press return), and then type this
telnet your.webserver.com 80
然后输入(小心,你的字符不会被回显)
Then type (carefully, your characters won't be echoed back)
HEAD / HTTP/1.0
按回车两次,您将看到服务器标题.
Press return twice and you'll see the server headers.
正如 cfeduke 和 Veynom 所提到的,服务器可能被设置为在 Server: 标头中返回有限的信息.尝试将 PHP 脚本上传到您的主机
As mentioned by cfeduke and Veynom, the server may be set to return limited information in the Server: header. Try and upload a PHP script to your host with this in it
<?php phpinfo() ?>
使用网络浏览器请求页面,您应该会看到那里报告的 Apache 版本.
Request the page with a web browser and you should see the Apache version reported there.
你也可以尝试使用 PHPShell 来看看,试试像
You could also try and use PHPShell to have a poke around, try a command like
/usr/sbin/apache2 -V
这篇关于如何在无法访问命令行的情况下找到运行的 Apache 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!