-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqu.php
95 lines (87 loc) · 2.63 KB
/
qu.php
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
require_once('config.inc.php');
require('functions.inc.php');
$url = URL;
$url_info = parse_url($url);
$ar=array();
$msg = '';
if(!file_exists('url1.data')) {
$res = get_url($url);
$ar = $GLOBALS['ar'];
$msg = $GLOBALS['msg'];
sleep(5);
if($msg==='0 - ') file_put_contents('url1.data', $res);
}
else {
$res = file_get_contents('url1.data');
}
var_dump($msg);
var_dump($ar);
//preg_match('#<form[^>]+action="([^"]+)"[^>]*>(.*)</form>#is', $res, $matches);
preg_match_all('#<form(?:\s+(?:id=["\'](?P<id>[^"\'<>]*)["\']|action=["\'](?P<action>[^"\'<>]*)["\']|\w+=["\'][^"\'<>]*["\']|))+>(?P<content>.*)</form>#isU', $res, $matches);
if(count(array_filter($matches['action']))==0) {
preg_match('#<title>([^<]+)</title>#',$res, $matches2);
var_dump($matches2[1]);
copy('url1.data', 'url2.data');
die();
}
else
{
$challenge = cf_bypass_solve_challenge($res);
$id = array_search('/login/login',$matches['action']);
$content = $matches['content'][$id];
preg_match_all('#<input[^>]+name="([^"]+)"(\s*value="([^"]*)"|[^>])*>#is', $content, $matches2);
$postdata='';
foreach($matches2[1] as $k=>$v)
{
if(strlen($postdata)!=0) $postdata.='&';
$postdata.=$v.'=';
if($v!='jschl_answer') $postdata.=urlencode($matches2[3][$k]);
else $postdata.=$challenge;
}
$url2=substr($url, 0, -1).$matches[1];
if(!file_exists('url2.data')) {
$res=get_url($url2, $postdata);
$ar = $GLOBALS['ar'];
$msg = $GLOBALS['msg'];
sleep(5);
if($msg==='0 - ') file_put_contents('url2.data', $res);
}
else {
$res = file_get_contents('url2.data');
}
var_dump($msg);
var_dump($ar);
preg_match('#<title>([^<]+)</title>#',$res, $matches2);
var_dump($matches2[1]);
if(false) {
$challenge = cf_bypass_solve_challenge($res);
preg_match('#<form[^>]+action="([^"]+)"[^>]*>(.*)</form>#is', $res, $matches);
preg_match_all('#<input[^>]+name="([^"]+)"(\s*value="([^"]*)"|[^>])*>#is', $matches[2], $matches2);
$postdata='';
foreach($matches2[1] as $k=>$v)
{
if(strlen($postdata)!=0) $postdata.='&';
$postdata.=$v.'=';
if($v!='jschl_answer') $postdata.=urlencode($matches2[3][$k]);
else $postdata.=$challenge;
}
$url3=substr($url, 0, -1).$matches[1];
if(!file_exists('url3.data')) {
$res=get_url($url3, $postdata);
$ar = $GLOBALS['ar'];
$msg = $GLOBALS['msg'];
sleep(5);
if($msg==='0 - ') file_put_contents('url3.data', $res);
}
else {
$res = file_get_contents('url3.data');
}
var_dump($msg);
var_dump($ar);
preg_match('#<title>([^<]+)</title>#',$res, $matches2);
var_dump($matches2[1]);
}
}
echo '<br/>'.date('Y-m-d H:i:s');
?>