Guest User

Untitled

a guest
Jul 5th, 2020
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.1.0.0
  8. * @ Author : DeZender
  9. * @ Release on : 15.05.2020
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class HetznerCloudLicense
  15. {
  16. public function __construct($UWSKey = NULL)
  17. {
  18. $LRemKey = WHMCS\Database\Capsule::table('tbladdonmodules')->select('value')->where(['setting' => 'whmcsmodule_key', 'module' => 'HetznerCloud'])->first();
  19. $this->LicenseKey = $LRemKey->value;
  20. }
  21.  
  22. public function __destruct()
  23. {
  24. }
  25.  
  26. public function HetznerCloud_LicenseCheck()
  27. {
  28. $status = self::Get_HetznerCloudLicenseCheck();
  29. return $status['results']['status'];
  30. }
  31.  
  32. public function get_HetznerCloudLicenseInfo_config()
  33. {
  34. $HetznerCloudLicenseInfo_config = [];
  35. $llkey = WHMCS\Database\Capsule::table('tblconfiguration')->select('value')->where(['setting' => 'hetznercloud_localkey'])->first();
  36. $HetznerCloudLicenseInfo_config['RemoteKey'] = $this->LicenseKey;
  37. $HetznerCloudLicenseInfo_config['LocalKey'] = $llkey->value;
  38. return $HetznerCloudLicenseInfo_config;
  39. }
  40.  
  41. public function get_HetznerCloud_prekey()
  42. {
  43. return ['HetznerCloud-Owned', 'HetznerCloud-Yearly'];
  44. }
  45.  
  46. public function Get_HetznerCloudLicenseCheck()
  47. {
  48. $LicenseConfig = self::get_HetznerCloudLicenseInfo_config();
  49. $zlk = explode('-', $LicenseConfig['RemoteKey'], -1);
  50. $zlk = implode('-', $zlk);
  51. $HetznerCloudprekey = self::get_HetznerCloud_prekey();
  52. $RemoteKey = $LicenseConfig['RemoteKey'];
  53. $LocalKey = $LicenseConfig['LocalKey'];
  54. $name = 'HetznerCloud';
  55.  
  56. if (!preg_match('/^' . $name . '\\-(Yearly|Owned)\\-[a-zA-Z0-9]{10}$/', $RemoteKey)) {
  57. $License['results']['status'] = 'Invalid';
  58. $License['results']['message'] = 'Invalid License Key';
  59. }
  60. else if (in_array($zlk, $HetznerCloudprekey)) {
  61. $results = self::HetznerCloud_Lcheck($RemoteKey, $LocalKey);
  62.  
  63. switch ($results['status']) {
  64. case 'Active':
  65. if ($results['localkey']) {
  66. WHMCS\Database\Capsule::table('tblconfiguration')->where('setting', 'hetznercloud_localkey')->update(['value' => $results['localkey']]);
  67. }
  68. }
  69.  
  70. $License['results'] = $results;
  71. }
  72. else {
  73. $License['results']['status'] = 'Invalid';
  74. $License['results']['message'] = 'Invalid License Key';
  75. }
  76.  
  77. return $License;
  78. }
  79.  
  80. static public function HetznerCloud_Lcheck($licensekey, $localkey = '')
  81. {
  82. $whmcsurl = 'https://secure.whmcsmodule.net/';
  83. $licensing_secret_key = 'WHMCSBpWKwHvIm3iKDagpt6iPHetznerCloud';
  84. $check_token = time() . md5(mt_rand(1000000000, 9999999999.0) . $licensekey);
  85. $checkdate = date('Ymd');
  86. $usersip = (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR']);
  87. $localkeydays = 15;
  88. $allowcheckfaildays = 5;
  89. $localkeyvalid = false;
  90. $lkey = WHMCS\Database\Capsule::table('tblconfiguration')->select('value')->where(['setting' => 'hetznercloud_localkey'])->first();
  91.  
  92. if ($lkey) {
  93. $localkey = $lkey->value;
  94. }
  95.  
  96. if ($localkey) {
  97. $localkey = str_replace('', '', $localkey);
  98. $localdata = substr($localkey, 0, strlen($localkey) - 32);
  99. $md5hash = substr($localkey, strlen($localkey) - 32);
  100.  
  101. if ($md5hash == md5($localdata . $licensing_secret_key)) {
  102. $localdata = strrev($localdata);
  103. $md5hash = substr($localdata, 0, 32);
  104. $localdata = substr($localdata, 32);
  105. $localdata = base64_decode($localdata);
  106. $localkeyresults = unserialize($localdata);
  107. $originalcheckdate = $localkeyresults['checkdate'];
  108.  
  109. if ($md5hash == md5($originalcheckdate . $licensing_secret_key)) {
  110. .........................................................................
  111. .............................................
  112. .....................
Add Comment
Please, Sign In to add comment