Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. <?php
  2.  
  3. Class Keygen {
  4.  
  5. private $serial;
  6.  
  7. private function randChar($length = 8) {
  8. $characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  9. $string = '';
  10. for ($p = 0; $p < $length; $p++) {
  11. $string .= $characters[mt_rand(0, strlen($characters)-1)];
  12. }
  13. return $string;
  14. }
  15.  
  16. public function getHashKey($version)
  17. {
  18. $return = base64_decode('NEpVVjNIU1dJVDU1R1I2UjJGUVhaQkxaRVA3NzFETllDTThNQUs5OQ==');
  19. if (2 === $version) { // Webmail Pro
  20. $return = base64_decode('MkZRWDNIU1c0SlVWSVQ1NUdSNlJBSzk5WkJMWkVQNzcxRE5ZQ004TQ==');
  21. } else if (3 === $version) { // Aurora
  22. $return = base64_decode('M0hTVzJGUVhaQkxaQ004TUFLOTlJVDU1RVA3NzFETllHUjZSNEpVVg==');
  23. }
  24. return $return;
  25. }
  26.  
  27. public function divideByFour($version, $char)
  28. {
  29. $result = strpos($this->getHashKey($version), $char);
  30. return (false !== $result) ? (int) floor($result / 4) : false;
  31. }
  32.  
  33. public function generate($version = 2) {
  34.  
  35. if ($version == 2) {
  36. $this->serial .= "WM700-";
  37. } elseif ($version == 3) {
  38. $this->serial .= "AU700-";
  39. } else {
  40. return "Error version not found";
  41. }
  42.  
  43. $var = rand(0,9);
  44.  
  45. $var4 = $this->randChar(1);
  46. while($this->divideByFour($version,$var4) % 2 == 0)
  47. {
  48. $var4 = $this->randChar(1);
  49. }
  50.  
  51. $this->serial .= $this->randChar(27).$var4.'-'.$var;
  52.  
  53. $var2 = ($var * 7 + 7) % 10;
  54. $this->serial .= $var2.rand(0,9).rand(0,9);
  55.  
  56. $var3 = $this->randChar(1);
  57.  
  58. while($this->divideByFour($version,$var3) != 0)
  59. {
  60. $var3 = $this->randChar(1);
  61. }
  62.  
  63. $this->serial .= $var3.$this->randChar(4);
  64. return $this->serial;
  65. }
  66. }
  67.  
  68. $obj = new Keygen();
  69.  
  70. // 2 for webmailpro and 3 for aurora
  71. print_r($obj->generate(2));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement