Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.1.0.0
- * @ Author : DeZender
- * @ Release on : 15.05.2020
- * @ Official site : http://DeZender.Net
- *
- */
- namespace JetBackup\Core\License;
- class License
- {
- const LICENSE_CHECK_URL = 'https://check.jetlicense.com';
- const LICENSE_LOCALKEY_DAYS = 259200;
- const LICENSE_LOCALKEY_CHECK_INTERVAL = 172800;
- const LICENSE_LOCALKEY_FAIL_INTERVAL = 3510;
- const LICENSE_NOTIFY_ERROR_INTERVAL = 86400;
- const LICENSE_PRODUCT_ID = '58ac64be19a4643cdf582727';
- const LICENSE_PUBLIC_KEY = '-----BEGIN PUBLIC KEY-----' . "\n" . 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2F105dMYw8kTC54ANpMt' . "\n" . 'WaVKEFEoRd+D0YDRDB/EGgFbEUdkDvub6FfHcDdgfmRgjUOWap0yX2MpOCy/QA/P' . "\n" . 'SrIuSYe4+jv5J+cW2O6WbnhVdlAQTLOiOgiUYMuFNt6+gx4DaitoxD/p39elThfa' . "\n" . 'KsAawrrxBR0mEdn0JeE1k0l/bbhekzUubR9LReOtveXdMoVygrAQ52mQ0saOSmuB' . "\n" . 'Un2oa4kaWeZfCA/fYW8jMEEjmrftcT3XVi7yA5Fk/xQQ3eNSLIAx2gZf8B2g0zqa' . "\n" . '/QSq9+6BDM/6OdG9o+cMvpSoOojx5ApcQxAwHfSiISfibJ/49kmnP7okCRI7pNvE' . "\n" . '3wIDAQAB' . "\n" . '-----END PUBLIC KEY-----';
- const STATUS_ACTIVE = 'Active';
- const STATUS_TRIAL = 'Trial';
- const STATUS_TRIAL_EXPIRED = 'TrialExpired';
- const STATUS_CANCELLED = 'Cancelled';
- const STATUS_INVALID = 'Invalid';
- /**
- * @return string
- */
- static private function _handshake()
- {
- if (file_exists('/sys/class/dmi/id/product_uuid')) {
- $code = \JetBackup\Core\IO\Shell::exec('/bin/cat /sys/class/dmi/id/product_uuid', $response);
- if (!$code && isset($response[0])) {
- return md5($response[0]);
- }
- }
- if (file_exists('/var/lib/dbus/machine-id')) {
- $code = \JetBackup\Core\IO\Shell::exec('/bin/cat /var/lib/dbus/machine-id', $response);
- if (!$code && isset($response[0])) {
- return md5($response[0]);
- }
- }
- $code = \JetBackup\Core\IO\Shell::exec('/sbin/ifconfig -a | /bin/grep -i \'hwaddr\' | /bin/awk \' { print $5 } \' | /usr/bin/head -n1', $response);
- if (!$code && isset($response[0])) {
- return md5($response[0]);
- }
- $code = \JetBackup\Core\IO\Shell::exec('/sbin/ip addr | /bin/grep -i \'ether\' | /bin/awk \' { print $2 } \' | /usr/bin/head -n1', $response);
- if (!$code && isset($response[0])) {
- return md5($response[0]);
- }
- $code = \JetBackup\Core\IO\Shell::exec('/sbin/ifconfig -a | /bin/grep -i \'ether\' | /bin/awk \' { print $2 } \' | /usr/bin/head -n1', $response);
- if (!$code && isset($response[0])) {
- return md5($response[0]);
- }
- if (file_exists('/etc/machine-id')) {
- $code = \JetBackup\Core\IO\Shell::exec('/bin/cat /etc/machine-id', $response);
- if (!$code && isset($response[0])) {
- return md5($response[0]);
- }
- }
- return '';
- }
- /**
- * @param $error
- * @param bool $force
- *
- * @throws JBException
- * @throws InvalidArgumentException
- * @throws MongoException
- */
- static private function _checkFailed($error, $force = false)
- {
- $license = \JetBackup\Core\Factory::getSettingsLicense();
- if ($force || ($license->getNotifyDate() < (time() - 21600))) {
- $license->setNotifyDate();
- $license->save();
- \JetBackup\Core\Alert\Alert::add('License check failed', 'There was a failed license check. Error: ' . $error, \JetBackup\Core\Alert\Alert::LEVEL_WARNING);
- }
- }
- /**
- * @param bool $reset
- * @param string $message
- * @throws JBException
- */
- static private function _handleNotify($reset = false, $message = '')
- {
- $license = \JetBackup\Core\Factory::getSettingsLicense();
- $update_time = NULL;
- if ($reset) {
- $update_time = 0;
- }
- else if (!$license->getNotifyDate()) {
- $update_time = time() + self::LICENSE_NOTIFY_ERROR_INTERVAL;
- }
- else if ($license->getNotifyDate() < time()) {
- self::_checkFailed($message, true);
- $update_time = 0;
- }
- if ($update_time != NULL) {
- $license->setNotifyDate($update_time);
- $license->save();
- }
- }
- /**
- * @throws LicenseException
- * @throws JBException
- */
- static public function retrieveLocalKey()
- {
- $license = \JetBackup\Core\Factory::getSettingsLicense();
- $localkey_details = new LicenseLocalKey();
- $handshake = self::_handshake();
- if (!$handshake) {
- $message = 'Unable to get server handshake key';
- self::_checkFailed($message);
- $license->setLocalKeyInvalid($message, $localkey_details);
- $license->save();
- return NULL;
- }
- $public_key = openssl_get_publickey(static::LICENSE_PUBLIC_KEY);
- $handshake_encrypted = '';
- if (!openssl_public_encrypt($handshake, $handshake_encrypted, $public_key)) {
- $message = 'Unable to prepare handshake key for validation';
- self::_checkFailed($message);
- $license->setLocalKeyInvalid($message, $localkey_details);
- $license->save();
- return NULL;
- }
- $panel_info = \JetBackup\Core\Entities\Util::getPanelInfo();
- $postfields = [
- 'output' => 'json',
- 'product_id' => static::LICENSE_PRODUCT_ID,
- 'handshake' => base64_encode($handshake_encrypted),
- 'info' => ['Hostname' => gethostname(), 'Panel_Name' => trim($panel_info['name']), 'Panel_Version' => trim($panel_info['version']), 'Product_Version' => trim(\JetBackup\Core\Entities\Util::getVersion()), 'Product_Tier' => trim($panel_info['tier']), 'Kernel_Release' => php_uname('r'), 'Kernel_Version' => php_uname('v')]
- ];
- try {
- $http = new \GuzzleHttp\Client();
- $response = $http->request('POST', self::LICENSE_CHECK_URL, ['form_params' => $postfields]);
- .........................................................................
- ........................................
- ....................
Add Comment
Please, Sign In to add comment