Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eslamene/aab15e991cdb73794c79 to your computer and use it in GitHub Desktop.
Save eslamene/aab15e991cdb73794c79 to your computer and use it in GitHub Desktop.
<?php
Class Keygen {
private $serial;
private function randChar($length = 8) {
$characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$string = '';
for ($p = 0; $p < $length; $p++) {
$string .= $characters[mt_rand(0, strlen($characters)-1)];
}
return $string;
}
public function getHashKey($version)
{
$return = base64_decode('NEpVVjNIU1dJVDU1R1I2UjJGUVhaQkxaRVA3NzFETllDTThNQUs5OQ==');
if (2 === $version) { // Webmail Pro
$return = base64_decode('MkZRWDNIU1c0SlVWSVQ1NUdSNlJBSzk5WkJMWkVQNzcxRE5ZQ004TQ==');
} else if (3 === $version) { // Aurora
$return = base64_decode('M0hTVzJGUVhaQkxaQ004TUFLOTlJVDU1RVA3NzFETllHUjZSNEpVVg==');
}
return $return;
}
public function divideByFour($version, $char)
{
$result = strpos($this->getHashKey($version), $char);
return (false !== $result) ? (int) floor($result / 4) : false;
}
public function generate($version = 2) {
if ($version == 2) {
$this->serial .= "WM700-";
} elseif ($version == 3) {
$this->serial .= "AU700-";
} else {
return "Error version not found";
}
$var = rand(0,9);
$var4 = $this->randChar(1);
while($this->divideByFour($version,$var4) % 2 == 0)
{
$var4 = $this->randChar(1);
}
$this->serial .= $this->randChar(27).$var4.'-'.$var;
$var2 = ($var * 7 + 7) % 10;
$this->serial .= $var2.rand(0,9).rand(0,9);
$var3 = $this->randChar(1);
while($this->divideByFour($version,$var3) != 0)
{
$var3 = $this->randChar(1);
}
$this->serial .= $var3.$this->randChar(4);
return $this->serial;
}
}
$obj = new Keygen();
// 2 for webmailpro and 3 for aurora
print_r($obj->generate(2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment