Skip to content

Instantly share code, notes, and snippets.

@alpgul
Created November 9, 2023 10:22
Show Gist options
  • Save alpgul/b2984281ce098762fc3571af2dd664f5 to your computer and use it in GitHub Desktop.
Save alpgul/b2984281ce098762fc3571af2dd664f5 to your computer and use it in GitHub Desktop.
Proxifier Keygen
function createExpDate(year, month) {
const expDate = (year - 2000) * 12 + month - 1;
}
function createRndNumber(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function CompileString(str) {
result = new Uint32Array(1);
result[0] = 0
for (let i = str.length - 1; i >= 0; i--) {
result[0] *= 32;
c = str.charCodeAt(i);
if (str[i] == 'W') {
continue;
}
if (str[i] == 'X') {
result[0] += 24;
} else if (str[i] == 'Y') {
result[0] += 1;
} else if (str[i] == 'Z') {
result[0] += 18;
} else if (c <= 57) // '0' to '9'
{
result[0] += c - 48;
} else // 'A' to 'V'
{
result[0] += c - 55;
}
}
return result[0];
}
function CRC32LikeThingy(data) {
let result = -1;
for (let i = 0; i < 12; i++) {
result ^= data[i] << 24;
for (let j = 0; j < 8; j++) {
if (result < 0) {
result <<= 1;
result ^= 0x4C11DB7;
} else {
result <<= 1;
}
}
}
return result;
}
function DecompileString(value, length) {
let result = '';
for (let i = 0; i < length; i++) {
let tmp = value % 32 >>> 0;
value = Math.floor(value / 32) >>> 0;
if (tmp === 0) {
result += 'W';
} else if (tmp === 24) {
result += 'X';
} else if (tmp === 1) {
result += 'Y';
} else if (tmp === 18) {
result += 'Z';
} else if (tmp <= 9) {
result += String.fromCharCode(tmp + 48);
} else {
result += String.fromCharCode(tmp + 55);
}
}
return result;
}
String.prototype.Insert = function(index, string) {
if (index > 0) {
return this.substring(0, index) + string + this.substring(index, this.length);
}
return string + this;
};
function GenerateKey(product = 0, fourthKeyPart = null, expirationDate = 0) {
debugger;
let charset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
param1 = createRndNumber(0x2580, 0xFFFF) /* < 0x2580 ==> outdated key message */ + (product << 21),
param2 = createRndNumber(0, 0xFFFF) + (expirationDate << 16) /* 0 ==> no expiration */ ,
param3 = CompileString(fourthKeyPart);
let data = new Uint8Array(12);
const params = [param1, param2, param3];
for (let i = 0; i < params.length; i++) {
const param = params[i];
const buffer = new ArrayBuffer(4);
const view = new DataView(buffer);
view.setInt32(0, param, true);
const byteArray = new Uint8Array(buffer);
data.set(byteArray, i * 4);
}
var value1 = CRC32LikeThingy(data) & 0x1FFFFFF;
var value2 = value1 ^ (value1 << 7);
var value3 = param1 ^ value2 ^ 0x12345678;
var value4 = param2 ^ value2 ^ 0x87654321;
let key = DecompileString(value3 >>> 0, 7);
key += DecompileString(value4 >>> 0, 7);
key += key[2]; // 15th char becomes 3rd
key += fourthKeyPart;
key += DecompileString(value1 >>> 0, 5);
// 3rd char doesn't affect the key check, as long as it's not a 'Y' ==> Proxifier v2 key (outdated)
let rndChar = charset[createRndNumber(0, (charset.length - 1))];
if (rndChar == 'Y')
rndChar++;
key = key.slice(0, 2) + rndChar + key.slice(3);
key = key.Insert(20, "-").Insert(15, "-").Insert(10, "-").Insert(5, "-");
return key;
}
console.log(GenerateKey(0, "DR01D", createExpDate(2033, 1)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment