Advertisement
Guest User

Untitled

a guest
May 18th, 2021
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for SourceGuardian Encoder)
  6. *
  7. * @ Version : 4.1.0.1
  8. * @ Author : DeZender
  9. * @ Release on : 29.08.2020
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class LicenseLib
  15. {
  16. const FEATURES_ALL_CUSTOMERS = '00000000000000000000000000000000000000';
  17. const LICENSE_UNMATCHABLE_HASH = 'XXXXX';
  18. const LICENSE_EXPIRES_NEVER = 'never';
  19. const LICENSE_EXPIRES_NEVER_FREE_LCE = 'never (free)';
  20.  
  21. static public function licenseDetails($filename = NULL, $remoteHostname = NULL, $licenseCheckType = LICENSE_NORMAL_CHECK)
  22. {
  23. $root = $GLOBALS['root'];
  24. $licenseDetails = [];
  25.  
  26. if (empty($filename)) {
  27. $filename = '/opt/tenable/' . LICENSE_FILE;
  28.  
  29. if (!file_exists($filename)) {
  30. $filename = $root . '/daemons/' . LICENSE_FILE;
  31. }
  32. }
  33.  
  34. if (!file_exists($filename)) {
  35. ErrorHandler::setErrorHandler('License file \'' . $filename . '\' not found.', RESPONSE_NOT_FOUND);
  36. $errorMsg = MessageLib::createStaticMessage(SCMSG_STATIC_ERROR, ErrorHandler::getErrorMessage());
  37. SCLog::log($errorMsg, LOG_LEVEL_CRITICAL, LOG_TYPE_ALL);
  38. return ERROR;
  39. }
  40.  
  41. if (($licenseDetails = LicenseLib::licenseCheck($filename, $remoteHostname, $licenseCheckType)) === ERROR) {
  42. $msg = MessageLib::createStaticMessage(SCMSG_STATIC_ERROR, ErrorHandler::getLogMessage());
  43. SCLog::log($msg, LOG_LEVEL_CRITICAL, LOG_TYPE_ALL);
  44. return ERROR;
  45. }
  46.  
  47. return $licenseDetails;
  48. }
  49.  
  50. static public function getForeignRepositoriesForLicense($license, $context = CONTEXT_ALL, $repFormat = REPOSITORY_DATAFORMAT_BF_ALL)
  51. {
  52. $root = $GLOBALS['root'];
  53. $directory = $root . '/daemons';
  54. $repositories = [];
  55.  
  56. if (($reps = RepositoryLib::getRepositories(REPOSITORY_TYPE_ALL, RESULT_IDXANNOTATIONS, $context, $repFormat)) === ERROR) {
  57. return ERROR;
  58. }
  59.  
  60. if (($paramDigest = @md5_file($license)) === false) {
  61. ErrorHandler::setErrorHandler('Unable to digest license \'' . $license . '\'.', RESPONSE_FILE_READ_ERROR);
  62. return ERROR;
  63. }
  64.  
  65. if (($handle = @opendir($directory)) === false) {
  66. ErrorHandler::setErrorHandler('Unable to open the daemon directory.', RESPONSE_FILE_READ_ERROR);
  67. return ERROR;
  68. }
  69.  
  70. while (($file = readdir($handle)) !== false) {
  71. $match = [];
  72.  
  73. if (preg_match('/(?<repID>\\d+)\\.license\\.key/', $file, $match)) {
  74. if (($licenseDigest = @md5_file($directory . '/' . $file)) === false) {
  75. ErrorHandler::setErrorHandler('Unable to digest stored license \'' . $directory . '/' . $file . '\'.', RESPONSE_FILE_READ_ERROR);
  76. return ERROR;
  77. }
  78.  
  79. if ($paramDigest === $licenseDigest) {
  80. }
  81. }
  82. }
  83.  
  84. return $repositories;
  85. }
  86.  
  87. static public function store($filename)
  88. {
  89. if (!file_exists($filename)) {
  90. ErrorHandler::setErrorHandler('License file \'' . $filename . '\' not found.', RESPONSE_NOT_FOUND);
  91. $errorMsg = MessageLib::createStaticMessage(SCMSG_STATIC_ERROR, ErrorHandler::getLogMessage(), ErrorHandler::getErrorCode());
  92. SCLog::log($errorMsg, LOG_LEVEL_CRITICAL, LOG_TYPE_ALL);
  93. return ERROR;
  94. }
  95.  
  96. if (($currentLicenseDetails = LicenseLib::licenseDetails(NULL, NULL, LICENSE_UPGRADE_CHECK)) === ERROR) {
  97. $currentLicenseDetails = [];
  98. $currentLicenseDetails['type'] = LICENSE_MODE_NONE;
  99. }
  100. else {
  101. switch ($currentLicenseDetails['status']) {
  102. case RESPONSE_DENIED:
  103. $currentLicenseDetails = [];
  104. $currentLicenseDetails['type'] = LICENSE_MODE_SC;
  105. ..................................................................
  106. .......................................
  107. .................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement