mirror of
https://github.com/Encryptshell/Pritunl-API-crack.git
synced 2025-11-29 08:33:10 +00:00
A little bit of cleanup
This commit is contained in:
161
www/index.php
161
www/index.php
@@ -6,101 +6,95 @@ $code = 200;
|
|||||||
$body = json_decode(file_get_contents('php://input'));
|
$body = json_decode(file_get_contents('php://input'));
|
||||||
|
|
||||||
//Fake API
|
//Fake API
|
||||||
$result = 'UNDEFINED';
|
$result = null;
|
||||||
if(isset($_GET['path'])) {
|
if(isset($_GET['path'])) {
|
||||||
|
//Any notification/[version] will be answered here
|
||||||
if(preg_match('/notification.*/', $_GET['path'])) {
|
if(preg_match('/notification.*/', $_GET['path'])) {
|
||||||
$result = new stdClass;
|
$result = new stdClass;
|
||||||
$result->message = 'Fake API endpoint active and reachable under ' . $_SERVER['HTTP_HOST'] . ' (checked at ' . date('r') . ').';
|
$result->message = 'Fake API endpoint active and reachable under ' . $_SERVER['HTTP_HOST'] . ' (contacted at ' . date('r') . ').';
|
||||||
$result->vpn = false;
|
$result->vpn = false; //Idk
|
||||||
$result->www = false;
|
$result->www = false; //Idk
|
||||||
} else if(preg_match('/subscription.*/', $_GET['path'])) {
|
} else if(isset($body->license) && preg_match('/subscription.*/', $_GET['path'])) {
|
||||||
|
//The following only works with the body containing the desired license
|
||||||
$result = new stdClass;
|
$result = new stdClass;
|
||||||
if(isset($body->license)) {
|
$license = null;
|
||||||
//premium
|
//The stylesheet determines what is shown on the dashboard (and by the plan). As default we change the colors of any text.
|
||||||
//enterprise
|
$stylesheet = '* { color: rgb(20, 150, 20); } .dark * { color: rgb(40, 180, 40); }';
|
||||||
//enterprise plus
|
if(preg_match('/.*premium/', $body->license)) {
|
||||||
$license = null;
|
$license = 'premium';
|
||||||
$stylesheet = '* { color: rgb(20, 150, 20); } .dark * { color: rgb(40, 180, 40); }';
|
} else if(preg_match('/.*enterprise[^\w]/', $body->license)) {
|
||||||
if(preg_match('/.*premium/', $body->license)) {
|
$license = 'enterprise';
|
||||||
$license = 'premium';
|
$stylesheet .= file_get_contents('enterprise.css');
|
||||||
} else if(preg_match('/.*enterprise[^\w]/', $body->license)) {
|
} else if(preg_match('/.*enterpriseplus/', $body->license)) {
|
||||||
$license = 'enterprise';
|
$license = 'enterprise_plus';
|
||||||
$stylesheet .= file_get_contents('enterprise.css');
|
//Load the new css file and change all invisible blocks to visible (this will show a little bit too much, but whatever...)
|
||||||
} else if(preg_match('/.*enterpriseplus/', $body->license)) {
|
$stylesheet .= file_get_contents('enterprise_plus.css');
|
||||||
$license = 'enterprise_plus';
|
$stylesheet = preg_replace('/(.*display:.?)none.*/', '$1inline-block', $stylesheet);
|
||||||
$stylesheet .= file_get_contents('enterprise_plus.css');
|
}
|
||||||
$stylesheet = preg_replace('/(.*display:.?)none.*/', '$1inline-block', $stylesheet);
|
$stylesheet .= '/* Generated for ' . $license . ' license */';
|
||||||
}
|
|
||||||
$stylesheet .= '/* Generated for ' . $license . ' license */';
|
|
||||||
|
|
||||||
$state = null;
|
$state = null;
|
||||||
if($license) { //The following only makes sense if you selected a license
|
if($license) { //The following only makes sense if you selected any license
|
||||||
if(strpos($body->license, 'bad') !== false) {
|
if(strpos($body->license, 'bad') !== false) {
|
||||||
$state = 'Bad';
|
$state = 'Bad';
|
||||||
} else if(strpos($body->license, 'canceled') !== false) {
|
} else if(strpos($body->license, 'canceled') !== false) {
|
||||||
$state = 'canceled';
|
$state = 'canceled';
|
||||||
} else if(strpos($body->license, 'active') !== false) {
|
} else if(strpos($body->license, 'active') !== false) {
|
||||||
$state = 'Active';
|
$state = 'Active';
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($state == 'Active') {
|
||||||
if($state == 'Active') {
|
$result->active = $license != 'premium'; //If true the stylesheet from below will be activated. This will also hide some elements, so don't use it on premium users (which will have the minimal stylesheet and so the subscription info will be empty)...
|
||||||
$result->active = $license != 'premium'; //if true the stylesheet ↓ will be activated. This will also hide some elements, so don't use it on premium users (which will have the minimal stylesheet)...
|
$result->status = $state;
|
||||||
$result->status = $state;
|
$result->plan = $license;
|
||||||
$result->plan = $license;
|
$result->quantity = 42;
|
||||||
$result->quantity = 42;
|
$result->amount = 42;
|
||||||
$result->amount = 42;
|
$result->period_end = false;
|
||||||
$result->period_end = false;
|
$result->trial_end = false;
|
||||||
$result->trial_end = false;
|
$result->cancel_at_period_end = false;
|
||||||
$result->cancel_at_period_end = false;
|
$result->styles = new stdClass;
|
||||||
$result->styles = new stdClass;
|
$result->styles->etag = 42;
|
||||||
$result->styles->etag = 42;
|
$result->styles->last_modified = time();
|
||||||
$result->styles->last_modified = time();
|
$result->styles->data = $stylesheet;
|
||||||
$result->styles->data = $stylesheet;
|
}
|
||||||
}
|
if($state == 'Canceled') {
|
||||||
if($state == 'Canceled') {
|
$result->active = false; //Here we can savely disable any styles
|
||||||
$result->active = false;
|
$result->status = $state;
|
||||||
$result->status = $state;
|
$result->plan = $license;
|
||||||
$result->plan = $license;
|
$result->quantity = 42;
|
||||||
$result->quantity = 42;
|
$result->amount = 42;
|
||||||
$result->amount = 42;
|
$result->period_end = false;
|
||||||
$result->period_end = false;
|
$result->trial_end = false;
|
||||||
$result->trial_end = false;
|
$result->cancel_at_period_end = false;
|
||||||
$result->cancel_at_period_end = false;
|
$result->styles = new stdClass;
|
||||||
$result->styles = new stdClass;
|
$result->styles->etag = 42;
|
||||||
$result->styles->etag = 42;
|
$result->styles->last_modified = time();
|
||||||
$result->styles->last_modified = time();
|
$result->styles->data = $stylesheet;
|
||||||
$result->styles->data = $stylesheet;
|
}
|
||||||
}
|
if($state == 'Bad' || $state == null) {
|
||||||
if($state == 'Bad' || $state == null) {
|
$code = 470; //-> bad license
|
||||||
$code = 470; //-> bad license
|
$result->error_msg = 'As you wish.';
|
||||||
$result->error_msg = 'As you wish.';
|
$result->error = 'license_invalid';
|
||||||
$result->error = 'license_invalid';
|
$result->active = false;
|
||||||
$result->active = false;
|
$result->status = false;
|
||||||
$result->status = false;
|
$result->plan = null;
|
||||||
$result->plan = null;
|
$result->quantity = 0;
|
||||||
$result->quantity = 0;
|
$result->amount = 0;
|
||||||
$result->amount = 0;
|
$result->period_end = true;
|
||||||
$result->period_end = true;
|
$result->trial_end = true;
|
||||||
$result->trial_end = true;
|
$result->cancel_at_period_end = null;
|
||||||
$result->cancel_at_period_end = null;
|
$result->styles = new stdClass;
|
||||||
$result->styles = new stdClass;
|
}
|
||||||
}
|
if($state == null) {
|
||||||
if($state == null) {
|
$result->error_msg = 'Unknown command. Use ["bad" | "canceled" | "active"] ["premium" | "enterprise" | "enterpriseplus"].';
|
||||||
$result->error_msg = 'Unknown command. Use ["bad" | "canceled" | "active"] ["premium" | "enterprise" | "enterpriseplus"].';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result = new stdClass;
|
|
||||||
$result->ERROR = 'BAD REQUEST';
|
|
||||||
$code = 400;
|
|
||||||
}
|
}
|
||||||
} else if(preg_match('/checkout.*/', $_GET['path'])) {
|
} else if(preg_match('/checkout.*/', $_GET['path'])) {
|
||||||
$result = array();
|
$result = array();
|
||||||
$result['zipCode'] = false;
|
$result['zipCode'] = false;
|
||||||
$result['allowRememberMe'] = false;
|
$result['allowRememberMe'] = false;
|
||||||
$result['image'] = 'https://objectstorage.us-ashburn-1.oraclecloud.com/n/pritunl8472/b/pritunl-static/o/logo_stripe.png';
|
$result['image'] = $_SERVER['HTTP_HOST'] . '/logo.png';
|
||||||
$result['key'] = 'pk_live_plmoOl3lS3k5dMNQViZWGfVR'; //Stolen store key from official API
|
$result['key'] = 'pk_live_*****l3lS******QViZ*****'; //Insert here a key to unlock the store. And buy the subsciption...
|
||||||
$result['plans'] = array();
|
$result['plans'] = array();
|
||||||
$result['plans']['premium'] = array();
|
$result['plans']['premium'] = array();
|
||||||
$result['plans']['premium']['amount'] = 42;
|
$result['plans']['premium']['amount'] = 42;
|
||||||
@@ -115,6 +109,7 @@ header('Content-Type: application/json');
|
|||||||
http_response_code($code);
|
http_response_code($code);
|
||||||
echo json_encode($result);
|
echo json_encode($result);
|
||||||
|
|
||||||
|
//Should we log any request? Used for the development and debugging of this API
|
||||||
if(false) {
|
if(false) {
|
||||||
//Log request
|
//Log request
|
||||||
file_put_contents('access.log', "\n" . date('r') . ":\t" . json_encode(array('head' => getallheaders(), 'body' => file_get_contents('php://input'), 'get' => $_GET, 'post' => $_POST, 'answer_code' => $code, 'answer' => $result)) . "\n", FILE_APPEND);
|
file_put_contents('access.log', "\n" . date('r') . ":\t" . json_encode(array('head' => getallheaders(), 'body' => file_get_contents('php://input'), 'get' => $_GET, 'post' => $_POST, 'answer_code' => $code, 'answer' => $result)) . "\n", FILE_APPEND);
|
||||||
|
|||||||
BIN
www/logo.png
Normal file
BIN
www/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Reference in New Issue
Block a user