View difference between Paste ID: FqfL1nTs and ZXTf8ZiR
SHOW: | | - or go back to the newest paste.
1
<?php
2
header('Content-Type: text/html; charset=UTF-8');
3
mb_internal_encoding("UTF-8");
4
set_time_limit(0);
5
error_reporting(E_ALL);
6
#------------------------------------------------------------------ШАБЛОН
7
echo '
8
<!DOCTYPE html>
9
<html lang="ru">
10
<head>
11
	<meta charset="utf-8" />
12
	<title>LiReg - массовый регистратор сайтов в статистике LiveInternet</title>
13
	 <link rel="shortcut icon" href="li.ico">
14
<style>
15
* { margin: 0; padding: 0; outline: 0; }
16
body {
17
    font-size: 12px;
18
    line-height: 22px;
19
    font-family: verdana, arial, sans-serif;
20
    color: #727272;
21
}
22
.fform {
23
padding-top: 10px;
24
width: 100%;
25
border-radius: 5px;
26
background: rgba(255,255,255,0.5);
27
-webkit-box-shadow: 0px -1px 47px -14px rgba(0,0,0,1);
28
-moz-box-shadow: 0px -1px 47px -14px rgba(0,0,0,1);
29
box-shadow: 0px -1px 47px -14px rgba(0,0,0,1);
30
}
31
32
.fform input[type="text"],select{
33
  padding-left: 3px;  
34
  border:1px gray solid;color:#39494a;
35
  height: 35px;
36
  margin: 0 0 10px 10px;
37
  font-size: 16px;
38
  width: 250px;
39
}
40
41
.fform input:focus {
42
outline: 0;
43
}
44
45
46
.fform input[type="submit"]{
47
  cursor: pointer;  
48
  width: 252px;
49
  padding: 0;
50
  height: 50px;
51
  background: #00BFF2;  
52
  color: #fff;
53
  font-size: 20px;
54
  border: none;
55
  border-bottom: 3px solid #0099CF;
56
  font-family: \'DinPro\';
57
  -webkit-box-shadow: 0px 12px 40px -11px rgba(0,0,0,0.75);
58
  -moz-box-shadow: 0px 12px 40px -11px rgba(0,0,0,0.75);
59
  box-shadow: 0px 12px 40px -11px rgba(0,0,0,0.75);
60
}
61
62
 
63
.fform textarea {
64
  
65
  height: 180px;
66
  width: 90%;
67
  margin: 0 0 10px 10px;
68
  font-size: 16px;
69
  padding:5px;
70
  background-color: #fff;
71
  background-position: 3% center;
72
  margin-top: 10px; 
73
  border: 1px solid #39494a;
74
}
75
.s_text 
76
77
78
	</style>
79
           
80
81
</head>
82
<body>
83
<center><a href="index.php"><img src="img/logo.jpg" /></a></center>
84
<p><br /></p>
85
86
<div class="fform"  style="margin:0 auto; width:800px;padding:10px 10px 10px 30px;">
87
';
88
89
#------------------------------------------------------------------РЕГИСТРАЦИЯ
90
if (isset($_POST['submit'])) {
91
    if (empty($_POST['sites']))
92
        die('<h1>Так пусто внутри</h1>
93
            <h2>Не принят список сайтов</h2>
94
            </div><center>(c) 2015 <a href="http://sanchopancho.ru" target="_blank">SanchoPancho.ru</a></center></body></html>');
95
    $sites = explode("\n", $_POST['sites']);
96
    foreach ($sites as $value) {
97
        $e = explode(';', trim($value));
98
        if (empty($e[0]))
99
            break;
100
        $domen = urlencode($e[0]);
101
102
        #е-мэйл и пароль по умолчанию
103
        $email = 'mail%40' . $domen;
104
        $pass = '123';
105
106
        #общий пароль и мыло
107
        if (!empty($_POST['pass']))
108
            $pass = urlencode($_POST['pass']);
109
        if (!empty($_POST['email']))
110
            $email = urlencode($_POST['email']);
111
112
        #частный случай
113
        if (!empty($e[1]))
114
            $pass = urlencode($e[1]);
115
        if (!empty($e[2]))
116
            $email = urlencode($e[2]);
117
118
119
        #сначала берем рандомное число
120
        $ch = curl_init();
121
        curl_setopt($ch, CURLOPT_URL, 'https://www.liveinternet.ru/add');
122
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
123
        curl_setopt($ch, CURLOPT_HEADER, 1);
124
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
125
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.47 Safari/534.13');
126
        $content = curl_exec($ch);
127
        curl_close($ch);
128
        if (!preg_match('#random value="(\d+)"#Ui', $content, $random)) {
129
        #вдруг не получили страницу, пробуем еще разок
130
            $ch = curl_init();
131
            curl_setopt($ch, CURLOPT_URL, 'https://www.liveinternet.ru/add');
132
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
133
            curl_setopt($ch, CURLOPT_HEADER, 1);
134
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
135
            curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.47 Safari/534.13');
136
            $content = curl_exec($ch);
137
            curl_close($ch);
138
        }
139
        if (!preg_match('#random value="(\d+)"#Ui', $content, $random)) {
140
            die('<font color="?\#990000"?><b>Ошибка: нет Интернета или что-то сломалось в скрипте</b></font><br>Ваш список сайтов: <Br><textarea>' . $_POST['sites'] . '</textarea>');
141
        }
142
143
        $postdata = 'random=' . $random[1] . '&rules=agreed&type=site&nick=' . $domen . '&url=http%3A%2F%2F' . $domen . '%2F&name=' . $domen . '&email=' . $email . '&password=' . $pass . '&check=' . $pass . '&keywords=&aliases=&language=ru&group=&private=on&subscribe=off&www=&confirmed=+%D0%B7%D0%B0%D1%80%D0%B5%D0%B3%D0%B8%D1%81%D1%82%D1%80%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D1%82%D1%8C+%3E%3E+';
144
145
        $ch = curl_init();
146
        curl_setopt($ch, CURLOPT_URL, 'https://www.liveinternet.ru/add');
147
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
148
        curl_setopt($ch, CURLOPT_HEADER, 1);
149
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
150
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.47 Safari/534.13');
151
        curl_setopt($ch, CURLOPT_POST, 1);
152
        curl_setopt($ch, CURLOPT_REFERER, 'https://www.liveinternet.ru/add');
153
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
154
        $content = curl_exec($ch);
155
        curl_close($ch);
156
        
157
///2018-06-27
158
        $success = false;
159
        $is_captcha = false;
160
        if (strstr($content, 'captcha_img')) { //Есть капча
161
            $content = uncap($content);
162
            $success = ! (!$content);
163
            $is_captcha = true;
164
        }
165
166
        echo "<b><u>$e[0]</u></b>";
167
        $data = ' (pass: ' . urldecode($pass) . ' e-mail: ' . urldecode($email) . ')';
168
        if ($success || substr_count($content, 'успешно зарегистрирован') > 0) {
169
            echo ' - <font color=green>успешно</font>';
170
            if ($is_captcha) {
171
                echo "\n<br/>Captcha recognized<br/>";
172
            }
173
        }
174
        elseif (!$success || preg_match('#<font color="?\#990000"?><b>Ошибка: (.*)</b></font>#uiUs', $content, $err)) {
175
            echo ' - ' . $err[0];
176
            if ($is_captcha) {
177
                echo "\n<br/>Captcha NOT recognized";
178
            }
179
        }
180
        echo $data . '<br>';
181
        flush();
182
        sleep(2);
183
    }
184
}
185
#------------------------------------------------------------------ГЛАВНАЯ
186
else {
187
188
    echo <<<EOF
189
<form action='' method='post'>
190
<p>При желании можно задать общий e-mail и пароль (можно оставить пустым).</p>
191
192
<input type=text name=pass value='' style=';' placeholder='Общий пароль' /> <br>
193
<input type=text name=email value=''  placeholder='Общий e-mail' /> 
194
<p>* Обязательным является только указание домена (без "HTTP" и "www") по одному на строчку. <br />
195
* Пароль по умолчанию - <i>123</i> E-mail - <i>[email protected]</i>.</p>
196
<textarea placeholder="domen.ru;pass;[email protected]" name="sites"></textarea>
197
<br /><br />
198
199
<input type="submit" value="Регистрировать &rarr;" name="submit">
200
</form>
201
EOF;
202
}
203
echo '</div><center>(c) 2015 <a href="http://sanchopancho.ru" target="_blank">SanchoPancho.ru</a></center></body></html>';
204
205
206
function uncap($content) {
207
    if (!preg_match('#<img src=[\'\"]\/\/captcha\.li\.ru\/image\?id=(.*)\;#iS', $content, $a)) {
208
        return false;
209
    }
210
    $id = $a[1];
211
    $url = 'http://captcha.li.ru/image?id=' . $id . ';lang=dig;reload=' . mt_rand(1000,9999);
212
    $img_cap = file_get_contents($url);
213
    $fname = date('YmdHis_') . mt_rand(10,99) . '.png';
214
    file_put_contents($fname, $img_cap);
215
    
216
    if (!preg_match_all('#input type\=hidden name\=(.*)\svalue\=(.*)>#iS', $content, $a)) {
217
        unlink($fname);
218
        return false;
219
    }
220
    $param = array();
221
    foreach ($a[1] as $k => $v) {
222
        $param[$v] = trim($a[2][$k], ' "');
223
    }
224
    
225
    $param['confirmed'] = " зарегистрировать &gt;&gt; ";
226
//    $rname = dirname(__FILE__) . '/' . $fname;
227
    $rname = realpath($fname);
228
    $param['captcha'] = recognize($rname);
229
    
230
    if (!$param['captcha']) {
231
        unlink($fname);
232
        return false;
233
    }
234
235
        $ch = curl_init();
236
        curl_setopt($ch, CURLOPT_URL, 'https://www.liveinternet.ru/add');
237
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
238
        curl_setopt($ch, CURLOPT_HEADER, 1);
239
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
240
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.47 Safari/534.13');
241
        curl_setopt($ch, CURLOPT_POST, 1);
242
        curl_setopt($ch, CURLOPT_REFERER, 'https://www.liveinternet.ru/add');
243
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($param));
244
        $content = curl_exec($ch);
245
        curl_close($ch);
246
    
247
        unlink($fname);
248
        return $content;
249
}
250
251
function recognize(
252
            $filename,
253
            $apikey = '',
254
            $is_verbose = true,
255
            $domain="rucaptcha.com",
256
            $rtimeout = 5,
257
            $mtimeout = 120,
258
            $is_phrase = 0,
259
            $is_regsense = 0,
260
            $is_numeric = 1,
261
            $min_len = 6,
262
            $max_len = 8,
263
            $language = 0
264
            )
265
{
266
	if (!file_exists($filename))
267
	{
268
		if ($is_verbose) echo "file $filename not found\n";
269
		return false;
270
	}
271
    $postdata = array(
272
        'method'    => 'post', 
273
        'key'       => $apikey, 
274
        'file'      => '@'.$filename,
275
        'body'      => '@'.$filename,
276
        'phrase'	=> $is_phrase,
277
        'regsense'	=> $is_regsense,
278
        'numeric'	=> $is_numeric,
279
        'min_len'	=> $min_len,
280
        'max_len'	=> $max_len,
281
		'language'	=> $language
282
        
283
    );
284
    $ch = curl_init();
285
///    curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false); ///!!!New PHP!!!
286
    curl_setopt($ch, CURLOPT_URL,             "http://$domain/in.php");
287
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,     1);
288
    curl_setopt($ch, CURLOPT_TIMEOUT,             60);
289
    curl_setopt($ch, CURLOPT_POST,                 1);
290
    curl_setopt($ch, CURLOPT_POSTFIELDS,         $postdata);
291
//    curl_setopt($ch, CURLOPT_POSTFIELDS,       http_build_query($postdata));
292
    $result = curl_exec($ch);
293
    if (curl_errno($ch)) 
294
    {
295
    	if ($is_verbose) echo "CURL returned error: ".curl_error($ch)."\n";
296
        return false;
297
    }
298
    curl_close($ch);
299
    if (strpos($result, "ERROR")!==false)
300
    {
301
    	if ($is_verbose) echo "server returned error1: $result\n";
302
        return false;
303
    }
304
    else
305
    {
306
        $ex = explode("|", $result);
307
        $captcha_id = $ex[1];
308
    	if ($is_verbose) echo "captcha sent, got captcha ID $captcha_id\n";
309
        $waittime = 0;
310
        if ($is_verbose) echo "waiting for $rtimeout seconds1\n";
311
        sleep($rtimeout);
312
        while(true)
313
        {
314
            $result = file_get_contents("http://$domain/res.php?key=".$apikey.'&action=get&id='.$captcha_id);
315
            if (strpos($result, 'ERROR')!==false)
316
            {
317
            	if ($is_verbose) echo "server returned error2: $result\n";
318
                return false;
319
            }
320
            if ($result=="CAPCHA_NOT_READY")
321
            {
322
            	if ($is_verbose) echo "captcha is not ready yet\n";
323
            	$waittime += $rtimeout;
324
            	if ($waittime>$mtimeout) 
325
            	{
326
            		if ($is_verbose) echo "timelimit ($mtimeout) hit\n";
327
            		break;
328
            	}
329
        		if ($is_verbose) echo "waiting for $rtimeout seconds2\n";
330
            	sleep($rtimeout);
331
            }
332
            else
333
            {
334
            	$ex = explode('|', $result);
335
            	if (trim($ex[0])=='OK') return trim($ex[1]);
336
            }
337
        }
338
        
339
        return false;
340
    }
341
}