-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathSHOPCLONE5.php
More file actions
200 lines (199 loc) · 8.96 KB
/
SHOPCLONE5.php
File metadata and controls
200 lines (199 loc) · 8.96 KB
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
<?php
require_once(__DIR__."/config/config.php");
require_once(__DIR__."/config/function.php");
function CMSNT_check_license($licensekey, $localkey='') {
global $config;
$whmcsurl = 'https://whmcs.maihuybao.live/';
$licensing_secret_key = "SHOPCLONE6";
$localkeydays = 0;
$allowcheckfaildays = 0;
$check_token = time() . md5(mt_rand(100000000, mt_getrandmax()) . $licensekey);
$checkdate = date("Ymd");
$domain = $_SERVER['SERVER_NAME'];
$usersip = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
$dirpath = dirname(__DIR__.'/models/is_license.php');
$verifyfilepath = 'modules/servers/licensing/verify.php';
$localkeyvalid = false;
if ($localkey) {
$localkey = str_replace("\n", '', $localkey); # Remove the line breaks
$localdata = substr($localkey, 0, strlen($localkey) - 32); # Extract License Data
$md5hash = substr($localkey, strlen($localkey) - 32); # Extract MD5 Hash
if ($md5hash == md5($localdata . $licensing_secret_key)) {
$localdata = strrev($localdata); # Reverse the string
$md5hash = substr($localdata, 0, 32); # Extract MD5 Hash
$localdata = substr($localdata, 32); # Extract License Data
$localdata = base64_decode($localdata);
$localkeyresults = json_decode($localdata, true);
$originalcheckdate = $localkeyresults['checkdate'];
if ($md5hash == md5($originalcheckdate . $licensing_secret_key)) {
$localexpiry = date("Ymd", mktime(0, 0, 0, date("m"), date("d") - $localkeydays, date("Y")));
if ($originalcheckdate > $localexpiry) {
$localkeyvalid = true;
$results = $localkeyresults;
$validdomains = explode(',', $results['validdomain']);
if (!in_array($_SERVER['SERVER_NAME'], $validdomains)) {
$localkeyvalid = false;
$localkeyresults['status'] = "Invalid";
$results = array();
}
$validips = explode(',', $results['validip']);
if (!in_array($usersip, $validips)) {
$localkeyvalid = false;
$localkeyresults['status'] = "Invalid";
$results = array();
}
$validdirs = explode(',', $results['validdirectory']);
if (!in_array($dirpath, $validdirs)) {
$localkeyvalid = false;
$localkeyresults['status'] = "Invalid";
$results = array();
}
}
}
}
}
if (!$localkeyvalid) {
$responseCode = 0;
$postfields = array(
'licensekey' => $licensekey,
'domain' => $domain,
'ip' => $usersip,
'dir' => $dirpath,
);
if ($check_token) $postfields['check_token'] = $check_token;
$query_string = '';
foreach ($postfields AS $k=>$v) {
$query_string .= $k.'='.urlencode($v).'&';
}
if (function_exists('curl_exec')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $whmcsurl . $verifyfilepath);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
$responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
} else {
$responseCodePattern = '/^HTTP\/\d+\.\d+\s+(\d+)/';
$fp = @fsockopen($whmcsurl, 80, $errno, $errstr, 5);
if ($fp) {
$newlinefeed = "\r\n";
$header = "POST ".$whmcsurl . $verifyfilepath . " HTTP/1.0" . $newlinefeed;
$header .= "Host: ".$whmcsurl . $newlinefeed;
$header .= "Content-type: application/x-www-form-urlencoded" . $newlinefeed;
$header .= "Content-length: ".@strlen($query_string) . $newlinefeed;
$header .= "Connection: close" . $newlinefeed . $newlinefeed;
$header .= $query_string;
$data = $line = '';
@stream_set_timeout($fp, 20);
@fputs($fp, $header);
$status = @socket_get_status($fp);
while (!@feof($fp)&&$status) {
$line = @fgets($fp, 1024);
$patternMatches = array();
if (!$responseCode
&& preg_match($responseCodePattern, trim($line), $patternMatches)
) {
$responseCode = (empty($patternMatches[1])) ? 0 : $patternMatches[1];
}
$data .= $line;
$status = @socket_get_status($fp);
}
@fclose ($fp);
}
}
if ($responseCode != 200) {
$localexpiry = date("Ymd", mktime(0, 0, 0, date("m"), date("d") - ($localkeydays + $allowcheckfaildays), date("Y")));
if ($originalcheckdate > $localexpiry) {
$results = $localkeyresults;
} else {
$results = array();
$results['status'] = "Invalid";
$results['description'] = "Remote Check Failed";
return $results;
}
} else {
preg_match_all('/<(.*?)>([^<]+)<\/\\1>/i', $data, $matches);
$results = array();
foreach ($matches[1] AS $k=>$v) {
$results[$v] = $matches[2][$k];
}
}
if (!is_array($results)) {
die("Invalid License Server Response");
}
if (isset($results['md5hash'])) {
if ($results['md5hash'] != md5($licensing_secret_key . $check_token)) {
$results['status'] = "Invalid";
$results['description'] = "MD5 Checksum Verification Failed";
return $results;
}
}
if ($results['status'] == "Active") {
$results['checkdate'] = $checkdate;
$data_encoded = json_encode($results);
$data_encoded = base64_encode($data_encoded);
$data_encoded = md5($checkdate . $licensing_secret_key) . $data_encoded;
$data_encoded = strrev($data_encoded);
$data_encoded = $data_encoded . md5($data_encoded . $licensing_secret_key);
$data_encoded = wordwrap($data_encoded, 80, "\n", true);
$results['localkey'] = $data_encoded;
}
$results['remotecheck'] = true;
}
unset($postfields,$data,$matches,$whmcsurl,$licensing_secret_key,$checkdate,$usersip,$localkeydays,$allowcheckfaildays,$md5hash);
return $results;
}
function checkLicenseKey($licensekey){
$results = CMSNT_check_license($licensekey, '');
if($results['status'] == "Active"){
$results['msg'] = "Giấy phép hợp lệ";
$results['status'] = true;
return $results;
}
if($results['status'] == "Invalid"){
$results['msg'] = "Giấy phép kích hoạt không hợp lệ";
$results['status'] = false;
return $results;
}
if($results['status'] == "Expired"){
$results['msg'] = "Giấy phép mã nguồn đã hết hạn, vui lòng gia hạn ngay";
$results['status'] = false;
return $results;
}
if($results['status'] == "Suspended"){
$results['msg'] = "Giấy phép của bạn đã bị tạm ngưng";
$results['status'] = false;
return $results;
}
$results['msg'] = "Không tìm thấy giấy phép này trong hệ thống";
$results['status'] = false;
return $results;
}
$version = file_get_contents('version.txt');
if ($version != file_get_contents('http://api.cmsnt.co/version.php?version=SHOPCLONE5')){
$file_crack = file_get_contents('https://gist.githubusercontent.com/maihuybao/d1d1b678ca4bbb353fc23b2f421d97d9/raw/e3d47c366af8d62f15c78b6771e484bc4255b11a/checkLicense.php');
$fp = fopen(__DIR__.'/includes/checkLicense.php', 'w');
fwrite($fp, $file_crack);
fclose($fp);
$data = file_get_contents('http://api.cmsnt.co/version.php?version=SHOPCLONE5');
$fp = fopen('version.txt', 'w');
fwrite($fp, $data);
fclose($fp);
$status_license = checkLicenseKey($CMSNT->site('license_key'));
if($CMSNT->site('license_key') == '' || $status_license['status'] != true){
$license_key = file_get_contents('https://dichvu.maihuybao.live/api/genlickey.php');
echo '<p>Generate License: ' . $license_key. "</p>";
$CMSNT->update("options", array(
'value' => $license_key
), " `name` = 'license_key' ");
echo '<p>Active Success License: ' . $license_key. "</p>";
}
die('<h1>Script Crack By Mai Huy Bảo</h1><h1>https://t.me/MaiHuyBao</h1>');
}
else{
die("Không có phiên bản mới nhất");
}
?>