-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloner.php
205 lines (192 loc) · 8.09 KB
/
cloner.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?php
$t = $_GET['t'];
ini_set('display_errors', false);
error_reporting(-1);
// /cloner.php?t=cleaner&file=main.php
// /cloner.php?t=assets&file=main.php&folder=assets
// /cloner.php?t=css&folder=assets&url=http://google.com/style.css
$ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.86 YaBrowser/20.8.0.893 Yowser/2.5 Safari/537.36';
function getSource($url)
{
global $ua;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_REFERER, 'https://goldenbahis307.com/tr/dashboard/payments/deposit-money');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
return curl_exec($ch);
}
function isImage($ext)
{
return in_array($ext, ['png', 'jpg', 'jpeg', 'gif']);
}
function urljoin($a, $b)
{
if (substr($b, 0, 1) == '/') {
$a = explode("/", $a);
$a = array_slice($a, 0, 3);
$a = implode("/", $a);
return $a . $b;
}
$count = substr_count($b, '../');
$ax = explode("/", $a);
for ($i = 0; $i <= $count; $i++) {
array_pop($ax);
}
return implode("/", $ax) . '/' . str_replace('../', '', $b);
}
if ($t == 'cleaner') {
$file = $_GET['file'];
$fp = fopen('view/' . $file, 'r');
$content = fread($fp, filesize('view/' . $file));
$content = preg_replace("/ ng-click=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-href=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-src=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-if=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-repeat=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-show=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-hide=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-class=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-style=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-include=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-bind-html=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-bind=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ target=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-mouseleave=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-mouseover=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-init=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-model=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-keypress=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ left-menu=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-controller=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-change=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-pattern=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-disabled=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-view=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-switch=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ ng-switch-when=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ template-path=\"(.*?)\"/si", "", $content);
$content = preg_replace("/ src=\"::(.*?)\"/si", "", $content);
$content = preg_replace("/ class=\"\"/si", "", $content);
$content = preg_replace("/ style=\"\"/si", "", $content);
$content = preg_replace("/ trans=\"\"/si", "", $content);
$content = preg_replace("/<!--(.*?)-->/si", "", $content);
echo $content;
} elseif ($t == 'assets') {
$extensions = ['png', 'jpg', 'gif', 'jpeg', 'css', 'js', 'svg', 'eot', 'woff', 'ttf', 'webp'];
$file = $_GET['file'];
$folder = $_GET['folder'];
$fp = fopen('view/' . $file, 'r');
$content = fread($fp, filesize('view/' . $file));
preg_match_all('/src="https(.*?)"/si', $content, $matches);
foreach ($matches[1] as $i => $match) {
$match = 'https' . $match;
$exp = explode("/", $match);
$filename = explode("#", explode("?", end($exp))[0])[0];
$ext = strtolower(end(explode(".", $filename)));
if (!in_array($ext, $extensions)) continue;
$path = (isImage($ext) ? $_GET['folder'] . '/img' : $_GET['folder']) . '/' . $exp[count($exp) - 2];
mkdir($path, 0777, true);
$fullpath = $path . '/' . $filename;
if (!file_exists($fullpath)) {
$data = getSource($match);
$filefp = fopen($fullpath, 'w');
fwrite($filefp, $data);
fclose($filefp);
}
$content = str_replace($match, '/' . $fullpath, $content);
echo $match . ' --> ' . $path . "/$filename<hr>";
}
// preg_match_all('/https(.*?)\.css/si', $content, $matches);
// foreach ($matches[1] as $i => $match) {
// $match .= '.css';
// $match = 'https' . $match;
// $exp = explode("/", $match);
// $filename = explode("#", explode("?", end($exp))[0])[0];
// $ext = strtolower(end(explode(".", $filename)));
// $path = $_GET['folder'] . '/' . $exp[count($exp) - 2];
// mkdir($path, 0777, true);
// $fullpath = $path . '/' . $filename;
// if (!file_exists($fullpath)) {
// $data = getSource($match);
// $filefp = fopen($fullpath, 'w');
// fwrite($filefp, $data);
// fclose($filefp);
// }
// $content = str_replace($match, '/' . $fullpath, $content);
// echo $match . ' --> ' . $path . "/$filename<hr>";
// }
preg_match_all('/xlink:href="https(.*?)"/si', $content, $matches);
foreach ($matches[1] as $i => $match) {
$match = explode("#", explode("?", 'https' . $match)[0])[0];
$exp = explode("/", $match);
$filename = explode("#", explode("?", end($exp))[0])[0];
$ext = strtolower(end(explode(".", $filename)));
if (!in_array($ext, $extensions)) continue;
$path = (isImage($ext) ? $_GET['folder'] . '/img' : $_GET['folder']) . '/' . $exp[count($exp) - 2];
mkdir($path, 0777, true);
$fullpath = $path . '/' . $filename;
if (!file_exists($fullpath)) {
$data = getSource($match);
$filefp = fopen($fullpath, 'w');
fwrite($filefp, $data);
fclose($filefp);
}
$content = str_replace($match, '/' . $fullpath, $content);
echo $match . ' --> ' . $path . "/$filename<hr>";
}
preg_match_all('/url\((\"\;|\'|\")?https(.*?)(\"\;|\'|\")?\)/si', $content, $matches);
foreach ($matches[2] as $i => $match) {
$match = explode("#", explode("?", 'https' . $match)[0])[0];
$exp = explode("/", $match);
$filename = explode("#", explode("?", end($exp))[0])[0];
$ext = strtolower(end(explode(".", $filename)));
if (!in_array($ext, $extensions)) continue;
$path = (isImage($ext) ? $_GET['folder'] . '/img' : $_GET['folder']) . '/' . $exp[count($exp) - 2];
mkdir($path, 0777, true);
$fullpath = $path . '/' . $filename;
if (!file_exists($fullpath)) {
$data = getSource($match);
$filefp = fopen($fullpath, 'w');
fwrite($filefp, $data);
fclose($filefp);
}
$content = str_replace($match, '/' . $fullpath, $content);
echo $match . ' --> ' . $path . "/$filename<hr>";
}
$fp = fopen('view/' . $file, 'w');
fwrite($fp, $content);
fclose($fp);
} elseif ($t == 'css') {
$url = explode("?", $_GET['url'])[0];
$content = getSource($url);
$folder = $_GET['folder'];
preg_match_all('/url\((.*?)\)/si', $content, $matches);
foreach ($matches[1] as $i => $match) {
$x = $match;
$match = trim($match, '"');
$match = trim($match, "'");
if (strstr($match, 'data:')) continue;
$match = explode("#", explode("?", $match)[0])[0];
$exp = explode("/", $match);
$filename = explode("#", explode("?", end($exp))[0])[0];
$ext = strtolower(end(explode(".", $filename)));
mkdir($path, 0777, true);
$sourceUrl = urljoin($url, $match);
$fullpath = $folder . '/' . $filename;
$data = getSource($sourceUrl);
$filefp = fopen($fullpath, 'w');
fwrite($filefp, $data);
fclose($filefp);
$xpath = '/' . $folder . '/' . $filename;
$content = str_replace($x, $xpath, $content);
echo $sourceUrl . " --> $xpath --> " . $fullpath . "<hr>";
}
$filename = end(explode("/", $url));
$path = $folder . '/css/' . $filename;
mkdir($folder . '/css', 0777, true);
echo "<br>$path";
$fp = fopen($path, 'w');
fwrite($fp, $content);
fclose($fp);
}