Advertisement
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 SourceGuardian Encoder)
- *
- * @ Version : 4.1.0.1
- * @ Author : DeZender
- * @ Release on : 29.08.2020
- * @ Official site : http://DeZender.Net
- *
- */
- class LicenseLib
- {
- const FEATURES_ALL_CUSTOMERS = '00000000000000000000000000000000000000';
- const LICENSE_UNMATCHABLE_HASH = 'XXXXX';
- const LICENSE_EXPIRES_NEVER = 'never';
- const LICENSE_EXPIRES_NEVER_FREE_LCE = 'never (free)';
- static public function licenseDetails($filename = NULL, $remoteHostname = NULL, $licenseCheckType = LICENSE_NORMAL_CHECK)
- {
- $root = $GLOBALS['root'];
- $licenseDetails = [];
- if (empty($filename)) {
- $filename = '/opt/tenable/' . LICENSE_FILE;
- if (!file_exists($filename)) {
- $filename = $root . '/daemons/' . LICENSE_FILE;
- }
- }
- if (!file_exists($filename)) {
- ErrorHandler::setErrorHandler('License file \'' . $filename . '\' not found.', RESPONSE_NOT_FOUND);
- $errorMsg = MessageLib::createStaticMessage(SCMSG_STATIC_ERROR, ErrorHandler::getErrorMessage());
- SCLog::log($errorMsg, LOG_LEVEL_CRITICAL, LOG_TYPE_ALL);
- return ERROR;
- }
- if (($licenseDetails = LicenseLib::licenseCheck($filename, $remoteHostname, $licenseCheckType)) === ERROR) {
- $msg = MessageLib::createStaticMessage(SCMSG_STATIC_ERROR, ErrorHandler::getLogMessage());
- SCLog::log($msg, LOG_LEVEL_CRITICAL, LOG_TYPE_ALL);
- return ERROR;
- }
- return $licenseDetails;
- }
- static public function getForeignRepositoriesForLicense($license, $context = CONTEXT_ALL, $repFormat = REPOSITORY_DATAFORMAT_BF_ALL)
- {
- $root = $GLOBALS['root'];
- $directory = $root . '/daemons';
- $repositories = [];
- if (($reps = RepositoryLib::getRepositories(REPOSITORY_TYPE_ALL, RESULT_IDXANNOTATIONS, $context, $repFormat)) === ERROR) {
- return ERROR;
- }
- if (($paramDigest = @md5_file($license)) === false) {
- ErrorHandler::setErrorHandler('Unable to digest license \'' . $license . '\'.', RESPONSE_FILE_READ_ERROR);
- return ERROR;
- }
- if (($handle = @opendir($directory)) === false) {
- ErrorHandler::setErrorHandler('Unable to open the daemon directory.', RESPONSE_FILE_READ_ERROR);
- return ERROR;
- }
- while (($file = readdir($handle)) !== false) {
- $match = [];
- if (preg_match('/(?<repID>\\d+)\\.license\\.key/', $file, $match)) {
- if (($licenseDigest = @md5_file($directory . '/' . $file)) === false) {
- ErrorHandler::setErrorHandler('Unable to digest stored license \'' . $directory . '/' . $file . '\'.', RESPONSE_FILE_READ_ERROR);
- return ERROR;
- }
- if ($paramDigest === $licenseDigest) {
- }
- }
- }
- return $repositories;
- }
- static public function store($filename)
- {
- if (!file_exists($filename)) {
- ErrorHandler::setErrorHandler('License file \'' . $filename . '\' not found.', RESPONSE_NOT_FOUND);
- $errorMsg = MessageLib::createStaticMessage(SCMSG_STATIC_ERROR, ErrorHandler::getLogMessage(), ErrorHandler::getErrorCode());
- SCLog::log($errorMsg, LOG_LEVEL_CRITICAL, LOG_TYPE_ALL);
- return ERROR;
- }
- if (($currentLicenseDetails = LicenseLib::licenseDetails(NULL, NULL, LICENSE_UPGRADE_CHECK)) === ERROR) {
- $currentLicenseDetails = [];
- $currentLicenseDetails['type'] = LICENSE_MODE_NONE;
- }
- else {
- switch ($currentLicenseDetails['status']) {
- case RESPONSE_DENIED:
- $currentLicenseDetails = [];
- $currentLicenseDetails['type'] = LICENSE_MODE_SC;
- ..................................................................
- .......................................
- .................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement