-
-
Save ywh865/238bbb003196d320ce2ded6ed090fc7b to your computer and use it in GitHub Desktop.
Generate license for AppEX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <net/if.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/ioctl.h> | |
#include <sys/socket.h> | |
#include <unistd.h> | |
int main() { | |
int fd; | |
struct ifreq ifr; | |
char *iface = "eth0"; | |
unsigned char *mac; | |
unsigned char buff[16]; | |
unsigned char serial[8]; | |
unsigned char apxlic[0x98] = { | |
0xB2, 0x26, 0xBC, 0x27, 0x4E, 0x22, 0x0F, 0x53, 0xE2, 0x2D, 0x86, 0x3A, | |
0x1E, 0xC9, 0x13, 0xDE, 0xA6, 0x96, 0x1B, 0xD0, 0x46, 0xD0, 0x34, 0xE8, | |
0x88, 0x18, 0xE6, 0x8D, 0x26, 0x0D, 0x78, 0x13, 0x45, 0x29, 0x8B, 0x8D, | |
0x3B, 0x11, 0xE0, 0x0B, 0x50, 0x61, 0x04, 0x56, 0x67, 0xC1, 0x2A, 0xF4, | |
0x98, 0x29, 0x92, 0xAB, 0x86, 0xEE, 0x7A, 0x4F, 0x84, 0xC1, 0xEF, 0x83, | |
0x02, 0x0A, 0x1A, 0xDC, 0xD2, 0x3F, 0x1F, 0xFA, 0x69, 0x3E, 0x5D, 0xD4, | |
0xC3, 0x18, 0xA8, 0x8A, 0xA5, 0x3F, 0x1F, 0x18, 0xC8, 0x1C, 0xB3, 0xB4, | |
0x04, 0xEA, 0xB6, 0x9F, 0x59, 0x99, 0x3F, 0xBF, 0x62, 0xBD, 0x37, 0x3A, | |
0x67, 0x47, 0x06, 0x63, 0xCE, 0xA3, 0xF3, 0x26, 0x36, 0xC7, 0x43, 0xE3, | |
0xA3, 0x66, 0x44, 0x51, 0x13, 0xEC, 0xF7, 0x42, 0x05, 0xE4, 0x0A, 0xF3, | |
0x2C, 0xB3, 0x0C, 0x53, 0x42, 0xCC, 0x5E, 0xBD, 0x98, 0x1F, 0x7E, 0x02, | |
0xA9, 0x32, 0x6F, 0x38, 0x23, 0xE8, 0x30, 0x4E, 0x4D, 0x20, 0xF9, 0x42, | |
0xF2, 0x0B, 0xDF, 0xBE, 0xAE, 0xEF, 0xF8, 0x43}; | |
fd = socket(AF_INET, SOCK_DGRAM, 0); | |
ifr.ifr_addr.sa_family = AF_INET; | |
strncpy(ifr.ifr_name, iface, IFNAMSIZ - 1); | |
ioctl(fd, SIOCGIFHWADDR, &ifr); | |
close(fd); | |
memcpy(buff, ifr.ifr_hwaddr.sa_data, 6); | |
for (int i = 0; i < 16; ++i) { | |
buff[i] = buff[i % 6] + i; | |
} | |
for (int i = 0; i < 8; ++i) { | |
serial[i] = (buff[i] + buff[i + 8]) % 256; | |
printf("%X", serial[i]); | |
} | |
for (int i = 0; i < 8; ++i) { | |
buff[i * 2] = serial[i] / 16; | |
buff[i * 2 + 1] = serial[i] % 16; | |
} | |
for (int i = 0; i < 16; ++i) { | |
if (buff[i] > 9) { | |
buff[i] += 7; | |
} | |
apxlic[i + 0x40] += 0xff & buff[i]; | |
} | |
FILE *f = fopen("appex.lic", "wb"); | |
fwrite(apxlic, sizeof(unsigned char), sizeof(apxlic), f); | |
fclose(f); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment