DBeaver是什么不用我多介绍了吧,在zhile上也能找到激活的法子,刚好前些天研究了一下ja-netfilter以及power插件,我寻思这个DBeaver的授权也是rsa,何不直接使用ja-netfilter呢?这样就不用始皇的dbeaver-agent了,说干就干。
懒得写分析过程了,直接贴码(用到了我自己写的第三方库crypto_plus,求个star ):
from abc import ABCMeta
from abc import abstractmethod
import base64
from time import time
from crypto_plus import CryptoPlus
from crypto_plus.encrypt import decrypt_by_key, encrypt_by_key
# power[Args] 模板
power_args_template = 'EQUAL,65537,{old_n}->65537,{new_n}'
class KeyGen(metaclass=ABCMeta):
@abstractmethod
def generate(self):
pass
@abstractmethod
def parse(self, licenses):
pass
@abstractmethod
def patch(self):
return ""
def run(self, patch=True):
ciphertext_licenses = self.generate()
print(f"ciphertext_licenses: \n{ciphertext_licenses}")
if patch:
patch_info = self.patch()
if patch_info:
print(f"patch: \n{patch_info}")
plaintext_licenses = self.parse(ciphertext_licenses)
print(f'plaintext_licenses: \n{plaintext_licenses}')
class LicenseItem:
def __init__(self, value, size):
self.value = value
self.size = size
def __bytes__(self):
if isinstance(self.value, str):
return self.value.encode() + b'\x20' * (self.size - len(self.value))
if isinstance(self.value, int):
return self.value.to_bytes(self.size)
if isinstance(self.value, bytes):
return self.value
def __or__(self, other):
if isinstance(other, LicenseItem):
return LicenseItem(bytes(self) + bytes(other), self.size + other.size)
class License:
def __init__(self):
self.format = LicenseItem(1, 1)
self.license_id = LicenseItem('DB-1Y1MTZFU-ZHGR', 16)
self.license_type = LicenseItem(b'U'[0], 1)
self.license_issue_time = LicenseItem(int(time() * 1000), 8)
self.license_start_time = LicenseItem(int(time() * 1000), 8)
self.license_end_time = LicenseItem(0, 8)
self.flags = LicenseItem(1024, 8)
self.product_id = LicenseItem("dbeaver-ue", 16)
self.product_version = LicenseItem("24.0", 8)
self.owner_id = LicenseItem("10000", 16)
self.owner_company = LicenseItem("void", 64)
self.owner_name = LicenseItem("wmymz", 32)
self.owner_email = LicenseItem("[email protected]", 48)
self.years_number = LicenseItem(1, 1)
self.reserved1 = LicenseItem(0, 1)
self.users_number = LicenseItem(1, 2)
def __bytes__(self):
return bytes(
self.format | \
self.license_id | \
self.license_type | \
self.license_issue_time | \
self.license_start_time | \
self.license_end_time | \
self.flags | \
self.product_id | \
self.product_version | \
self.owner_id | \
self.owner_company | \
self.owner_name | \
self.owner_email | \
self.years_number | \
self.reserved1 | \
self.users_number
)
class DBeaverKeyGen(KeyGen):
def __init__(self):
try:
obj = CryptoPlus.load()
except Exception:
obj = CryptoPlus.generate_rsa(2048)
obj.dump()
self.crypto_plus = obj
def generate(self):
license_info = bytes(License())
return base64.b64encode(encrypt_by_key(self.crypto_plus.private_key, license_info)).decode()
def parse(self, licenses):
return decrypt_by_key(self.crypto_plus.public_key, base64.b64decode(licenses))
def patch(self):
with open("dbeaver-ue-public.key", 'r') as f:
old_n = CryptoPlus.loads(''.join(f.readlines()[1:])).public_key.n
return power_args_template.format(old_n=old_n, new_n=self.crypto_plus.public_key.n)
if __name__ == '__main__':
DBeaverKeyGen().run()
dbeaver版本更新后,修改license中的product即可,默认会生成ue激活码,ue&ee均可使用,将打印的patch内容粘贴到power.conf的[Args]标签下,由于ue,ee的公钥相同,所以只需要粘贴一行即可通杀。
dbeaver.ini末尾增加:
-Dlm.debug.mode=true
--add-opens=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED
--add-opens=java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED
-javaagent:/path/to/ja-netfilter.jar=jetbrains
顺便贴一个dbeaver ue/ee的公钥 (1022 字节),也可以自行提取,需要解压后放到python脚本同级目录,这样就可以自由的修改授权信息了
最后求个免费的赞