Support Navicat 12.0.24
This commit is contained in:
parent
50fbcc52c3
commit
ee22a9ed24
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1 @@
|
||||
*.DS_Store
|
||||
*navicat-keygen
|
||||
|
||||
71
README.md
71
README.md
@ -22,6 +22,10 @@
|
||||
|
||||
If you have the corresponding private key, please tell me. I would be very appreciated for your generous.
|
||||
|
||||
__NOTICE:__
|
||||
|
||||
Start from __Navicat Premuim 12.0.24 for Mac__, the public key is no longer stored in __Navicat Premium.app/Contents/Resources/rpk__. Instead, the public key is stored in Navicat executable file __Navicat Premium.app/Contents/MacOS/Navicat Premium__. You can see it by searching string `"-----BEGIN PUBLIC KEY----- "`.
|
||||
|
||||
* __Request Code__
|
||||
|
||||
It is a Base64 string that represents 256-bytes-long data, while the 256-bytes-long data is the cipher text of the __offline activation information__ encrypted by __Navicat Activation Public Key__.
|
||||
@ -183,15 +187,42 @@
|
||||
* Before you build keygen, you should make sure you have installed OpenSSL.
|
||||
If you have `brew`, you can install it by `brew install openssl`.
|
||||
|
||||
```bash
|
||||
$ cd navicat-keygen
|
||||
$ make release
|
||||
```
|
||||
```bash
|
||||
$ cd navicat-keygen
|
||||
$ make release
|
||||
```
|
||||
|
||||
* Build patcher if your Navicat version is or is after __12.0.24__.
|
||||
|
||||
```bash
|
||||
$ cd navicat-patcher
|
||||
$ make release
|
||||
```
|
||||
|
||||
__NOTICE:__
|
||||
|
||||
For Navicat whose version is or is after __12.0.24__, if you want to use your own RSA key, please replace the content in `/navicat-patcher/main.c`
|
||||
|
||||
```cpp
|
||||
const char pubkey[9][72] = {
|
||||
"-----BEGIN PUBLIC KEY-----",
|
||||
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxqkTcfbKw8ysVygePlcB",
|
||||
"oUAhCF6oniyP13iDtu85ZsHwqw8PnMyTp6n6FnMN9YinleIAy6NFveBu/vshTN8S",
|
||||
"oXbYyy5AqdZ8CQpfvuriO9UNfgV1l7SFdPPpruFAmOw+uzA3GawMsg3QNK/htqJe",
|
||||
"b4xKHFS04xC2AueE2RTmk6tJcL8TEBfRG7DEYOHPjebKl1NQ3ZIu15U97cCPYKO2",
|
||||
"pWHzsb+Fr4Wj0DChLoxlXxaBcJ2ozogaq0tW2t4Aopvt9kRSuSK9HcgxICJM5ct4",
|
||||
"naU91WFGWlw0+0JpiMIl5OnMbpak/5xQre9DL8zM8LjRy14I88txvXvhPEsWaYCO",
|
||||
"1QIDAQAB",
|
||||
"-----END PUBLIC KEY-----"
|
||||
};
|
||||
```
|
||||
|
||||
with your own RSA public key before you build patcher.
|
||||
|
||||
## 5. How to Use
|
||||
1. Build keygen.
|
||||
|
||||
2. Generate RSA-2048 private key and public key.
|
||||
2. Generate RSA-2048 private key and public key. __(Navicat Premium version < 12.0.24 ONLY)__
|
||||
|
||||
```bash
|
||||
$ openssl genrsa -out 2048key.pem 2048
|
||||
@ -200,9 +231,35 @@
|
||||
|
||||
You will get two file: `2048key.pem` and `rpk`.
|
||||
|
||||
3. Replace `Navicat Premium.app/Contents/Resources/rpk` file by `rpk` file you just generated.
|
||||
Now you do not need to generate RSA key. I've already prepared these two file:
|
||||
|
||||
4. In Terminal:
|
||||
* `rpk` file is in `navicat-patcher` folder.
|
||||
|
||||
* `2048key.pem` is in `navicat-keygen` folder.
|
||||
|
||||
3. For Navicat Premium version < 12.0.24:
|
||||
|
||||
* Replace `Navicat Premium.app/Contents/Resources/rpk` file by `rpk` file.
|
||||
|
||||
For Navicat Premium version >= 12.0.24:
|
||||
|
||||
* Backup your `Navicat Premium.app/Contents/MacOS/Navicat Premium`.
|
||||
|
||||
* Run patcher:
|
||||
|
||||
```bash
|
||||
$ cd navicat-patcher
|
||||
$ ./navicat-patcher <your navicat executable file path>
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
$ cd navicat-patcher
|
||||
$ ./navicat-patcher /Applications/Navicat\ Premium.app/Contents/MacOS/Navicat\ Premium
|
||||
```
|
||||
|
||||
4. Then goto `navicat-keygen` folder and in Terminal:
|
||||
|
||||
```bash
|
||||
$ ./navicat-keygen 2048key.pem
|
||||
|
||||
27
navicat-keygen/2048key.pem
Normal file
27
navicat-keygen/2048key.pem
Normal file
@ -0,0 +1,27 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpQIBAAKCAQEAxqkTcfbKw8ysVygePlcBoUAhCF6oniyP13iDtu85ZsHwqw8P
|
||||
nMyTp6n6FnMN9YinleIAy6NFveBu/vshTN8SoXbYyy5AqdZ8CQpfvuriO9UNfgV1
|
||||
l7SFdPPpruFAmOw+uzA3GawMsg3QNK/htqJeb4xKHFS04xC2AueE2RTmk6tJcL8T
|
||||
EBfRG7DEYOHPjebKl1NQ3ZIu15U97cCPYKO2pWHzsb+Fr4Wj0DChLoxlXxaBcJ2o
|
||||
zogaq0tW2t4Aopvt9kRSuSK9HcgxICJM5ct4naU91WFGWlw0+0JpiMIl5OnMbpak
|
||||
/5xQre9DL8zM8LjRy14I88txvXvhPEsWaYCO1QIDAQABAoIBAHsTYKKoPPKVKOhO
|
||||
SH5itPXLnytqSZjFDtB1L1T0XGGXIZ04lXmVHJ0xJ2klGq7VXM302H1Qx/JcyydZ
|
||||
OkY/pXE3ChTGsPUHloybSrojFsnuso8ynqnAAzZzroDTuIuFQVADDP/woWTmPemG
|
||||
VZYqfcsp5PgsWmyae8jM2ncLBdbRnSCtQ0FqMZPxHnazxoxh43fIisdZiHVretDR
|
||||
cHR0MKig8ggetpRCPv8prHvYjllmnp+vFPNbI8DD6LUho0gtsKnGG+4k5NCUArrH
|
||||
gfNK7ov/wsBe991XgC+tG/Xa8GgQJjSXr6qxwI6jPJ9d8EDHi31pqOWggJz0iPUL
|
||||
U/5uNoECgYEA9U+ykujylIn7WPDcoNuXXk+xb5J+7p0En1dnFPDWEqM21rHfYHpo
|
||||
X8ikfW63PSYp/472BLhum3TnjbgBQy8Uu80uGXWKCTCmnguMZVAw0yJn4bwCKmUM
|
||||
hI8eaB231O3pz0AeoKfjj3Y25c6EF+P0wixO95qNj3gZs8fRE1o2BoUCgYEAz1EE
|
||||
AHHqNus/2iGVS/OD0cGcZBzBgz790o1YHvaAZWTB8J4Q55Z8NnbxHKPk+1FRik2c
|
||||
3iqNhDtfee/9j9QkNookjP6JqliKLj6AHAzqmKAviMN/akQHO9vYrKVrgGXts9X4
|
||||
k5Rn3Wyb1R9xSg9timalZ6HXsG0fqMKlQimroBECgYEAvfCPnCCyc0DDVQJqUkK0
|
||||
2VlrUbBkh+0b/yR1tEkl+BhYBbSD+PfOiRuaAWUQjFBYhH/1DYKgYc4K3Dh1Acga
|
||||
ja842o2f66231PesJWYJ5/Dj7mzcYGcNYjZOnN8lz8DHIKnNDSfxkss9hoJ41Oa0
|
||||
RQR5wE3y/ftIK2O0Bv/6hOECgYEAhzh2fbvPYobKnQIumN16a0P3N60x4uMhN0YN
|
||||
5hQt5vRzMvhGWmdjGTs3RND5t5pwrt60pIvoxgjb23LXVgqunAw6juQu8rbRWhxV
|
||||
/vXFxksk9fVdk/hPJ5Hbn7A9j//rrNKxUcEIhfojIj1h7UZm0lDlLdT4FBD5B1/9
|
||||
3kvDr6ECgYEAu/OS+6ApNTH/LhSeeqw9jMtxJwu560WOzSsDk8LSlSDCZHwREwVU
|
||||
M+uBWShYTDlPn6Bpe15dNHghvxFnZi12pS57l5AgD4J8AW4FEveDuIjj7BOexNFa
|
||||
nB099pHr6MUM5s8zmw+9Z4Rc7gk8bwTyFAwMFf8ZYSyl4WIHQfTbhx0=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
6
navicat-patcher/Makefile
Normal file
6
navicat-patcher/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
release : main.c
|
||||
gcc main.c -o navicat-patcher
|
||||
|
||||
clean:
|
||||
rm navicat-patcher
|
||||
127
navicat-patcher/main.c
Normal file
127
navicat-patcher/main.c
Normal file
@ -0,0 +1,127 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <memory.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
const char pubkey[9][72] = {
|
||||
"-----BEGIN PUBLIC KEY-----",
|
||||
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxqkTcfbKw8ysVygePlcB",
|
||||
"oUAhCF6oniyP13iDtu85ZsHwqw8PnMyTp6n6FnMN9YinleIAy6NFveBu/vshTN8S",
|
||||
"oXbYyy5AqdZ8CQpfvuriO9UNfgV1l7SFdPPpruFAmOw+uzA3GawMsg3QNK/htqJe",
|
||||
"b4xKHFS04xC2AueE2RTmk6tJcL8TEBfRG7DEYOHPjebKl1NQ3ZIu15U97cCPYKO2",
|
||||
"pWHzsb+Fr4Wj0DChLoxlXxaBcJ2ozogaq0tW2t4Aopvt9kRSuSK9HcgxICJM5ct4",
|
||||
"naU91WFGWlw0+0JpiMIl5OnMbpak/5xQre9DL8zM8LjRy14I88txvXvhPEsWaYCO",
|
||||
"1QIDAQAB",
|
||||
"-----END PUBLIC KEY-----"
|
||||
};
|
||||
|
||||
void help() {
|
||||
printf("Usage:\n");
|
||||
printf(" ./navicat-patcher <navicat executable file>\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
size_t search_pubkey_location(uint8_t* pFileContent, size_t FileSize) {
|
||||
static const char search_str[] = "-----BEGIN PUBLIC KEY-----";
|
||||
|
||||
size_t i = 0;
|
||||
if (FileSize < sizeof(search_str) - 1) return (size_t)-1;
|
||||
FileSize -= sizeof(search_str);
|
||||
for (; i < FileSize; ++i) {
|
||||
if (pFileContent[i] == '-' && memcmp(pFileContent + i, search_str, sizeof(search_str) - 1) == 0)
|
||||
return i;
|
||||
}
|
||||
return (size_t)-1;
|
||||
}
|
||||
|
||||
void do_patch(uint8_t* pFileContent, size_t offset) {
|
||||
strcpy(pFileContent + offset, pubkey[0]);
|
||||
offset += strlen(pubkey[0]) + 1;
|
||||
|
||||
strcpy(pFileContent + offset, pubkey[1]);
|
||||
offset += strlen(pubkey[1]) + 1;
|
||||
|
||||
strcpy(pFileContent + offset, pubkey[2]);
|
||||
offset += strlen(pubkey[2]) + 1;
|
||||
|
||||
strcpy(pFileContent + offset, pubkey[3]);
|
||||
offset += strlen(pubkey[3]) + 1;
|
||||
|
||||
strcpy(pFileContent + offset, pubkey[4]);
|
||||
offset += strlen(pubkey[4]) + 1;
|
||||
|
||||
strcpy(pFileContent + offset, pubkey[5]);
|
||||
offset += strlen(pubkey[5]) + 1;
|
||||
|
||||
strcpy(pFileContent + offset, pubkey[6]);
|
||||
offset += strlen(pubkey[6]) + 1;
|
||||
|
||||
strcpy(pFileContent + offset, pubkey[7]);
|
||||
offset += strlen(pubkey[7]) + 1;
|
||||
|
||||
strcpy(pFileContent + offset, pubkey[8]);
|
||||
offset += strlen(pubkey[8]) + 1;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[], char* envp[]) {
|
||||
int status = 0;
|
||||
int fd = -1;
|
||||
struct stat fd_stat = {};
|
||||
uint8_t* file_content = 0;
|
||||
|
||||
if (argc != 2) {
|
||||
help();
|
||||
return 0;
|
||||
}
|
||||
|
||||
fd = open(argv[1], O_RDWR, S_IRUSR | S_IWUSR);
|
||||
if (fd == -1) {
|
||||
printf("Failed to open file. CODE: 0x%08x\n", errno);
|
||||
status = errno;
|
||||
goto main_fin;
|
||||
} else {
|
||||
printf("Open file successfully.\n");
|
||||
}
|
||||
|
||||
if (fstat(fd, &fd_stat) != 0) {
|
||||
printf("Failed to get file size. CODE: 0x%08x\n", errno);
|
||||
status = errno;
|
||||
goto main_fin;
|
||||
} else {
|
||||
printf("Get file size successfully: %zu\n", fd_stat.st_size);
|
||||
}
|
||||
|
||||
file_content = mmap(NULL, fd_stat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
|
||||
if (file_content == (void*)-1) {
|
||||
printf("Failed to map file. CODE: 0x%08x\n", errno);
|
||||
status = errno;
|
||||
goto main_fin;
|
||||
} else {
|
||||
printf("Map file successfully.\n");
|
||||
}
|
||||
|
||||
size_t offset = search_pubkey_location(file_content, fd_stat.st_size);
|
||||
if (offset == (size_t)-1) {
|
||||
printf("Failed to find pubkey location.\n");
|
||||
goto main_fin;
|
||||
}
|
||||
|
||||
printf("offset = 0x%016llx\n", offset);
|
||||
|
||||
do_patch(file_content, offset);
|
||||
printf("Success!\n");
|
||||
|
||||
main_fin:
|
||||
if (file_content != NULL) munmap(file_content, fd_stat.st_size);
|
||||
if (fd != -1) close(fd);
|
||||
return status;
|
||||
}
|
||||
|
||||
9
navicat-patcher/rpk
Normal file
9
navicat-patcher/rpk
Normal file
@ -0,0 +1,9 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxqkTcfbKw8ysVygePlcB
|
||||
oUAhCF6oniyP13iDtu85ZsHwqw8PnMyTp6n6FnMN9YinleIAy6NFveBu/vshTN8S
|
||||
oXbYyy5AqdZ8CQpfvuriO9UNfgV1l7SFdPPpruFAmOw+uzA3GawMsg3QNK/htqJe
|
||||
b4xKHFS04xC2AueE2RTmk6tJcL8TEBfRG7DEYOHPjebKl1NQ3ZIu15U97cCPYKO2
|
||||
pWHzsb+Fr4Wj0DChLoxlXxaBcJ2ozogaq0tW2t4Aopvt9kRSuSK9HcgxICJM5ct4
|
||||
naU91WFGWlw0+0JpiMIl5OnMbpak/5xQre9DL8zM8LjRy14I88txvXvhPEsWaYCO
|
||||
1QIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
Loading…
Reference in New Issue
Block a user