php 一个找二层目录的小东东
碰到个虚拟主机
,iis7.0.里边有上万个站,只有脚本权限,没命令行权限,但是可以跨目录写文件.
如果能得到目标站的物理目录
,能立马搞定.但是想尽一切办法,也没找到物理路径.所以只有
用脚本找了
.手工找会累死的.一个 php 是找的,一个 asp 是写的
php 版
代码如下
:
<?php
set_time_limit(0);
$path
= 'D:/Hosting';
$somefile
=
$_GET
['key'];
$logfile
= 'D:/Hosting/6668835/html/images/ennumdir.txt';
if
(!isset(
$_SERVER
['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo
'Text to send if user hits Cancel button';
exit
;
}
else
{
if
(
is_dir
(
$path
) &&
is_readable
(
$path
))
{
$path2
= '';
$handle
= opendir(
$path
);
while
(false !== (
$filename
= readdir(
$handle
)))
{
if
(
$filename
{0} !=
$_GET
['dir'])
{
continue
;
}
/*
if($filename{1} != $_GET['two'])
{
continue;
}
*/
//$path2 = $path.'/'.$filename.'/html';
$path2
=
$path
.'/'.
$filename
;
if
(
is_dir
(
$path2
) &&
is_readable
(
$path2
))
{
@
$handle2
= opendir(
$path2
);
while
(false !== (
$filename2
= readdir(
$handle2
)))