gitlab ee激活授权

GitLab是什么不用我多介绍了吧,企业版需要授权,网上的授权方法需要执行rube脚本,我又懒得装rube,直接整一个python版的
直接贴码(需要安装crypto_plus):

import base64
import json
import os

from Crypto.Cipher import AES
from crypto_plus import CryptoPlus
from crypto_plus.encrypt import decrypt_by_key
from crypto_plus.encrypt import encrypt_by_key

from crack.base import KeyGen

template_license_data = {
    "version": 1,
    "licensee": {"Name": "null", "Company": "null", "Email": "[email protected]"},
    "issued_at": "2023-01-01",
    "expires_at": "2100-12-31",
    "notify_admins_at": "2100-12-01",
    "notify_users_at": "2100-12-01",
    "block_changes_at": "2100-12-10",
    "cloud_licensing_enabled": False,
    "offline_cloud_licensing_enabled": False,
    "auto_renew_enabled": False,
    "seat_reconciliation_enabled": False,
    "operational_metrics_enabled": False,
    "generated_from_customers_dot": False,
    "restrictions": {"active_user_count": 99999},
}


class GitlabKeyGen(KeyGen):
    def __init__(self):
        self.license_data = template_license_data
        try:
            rsa = CryptoPlus.load()
        except Exception:
            rsa = CryptoPlus.generate_rsa(2048)
            rsa.dump(pub_key_path=".license_encryption_key.pub")
        self.crypto_plus = rsa

    def generate(self):
        aes_key = os.urandom(16)
        aes_iv = os.urandom(16)
        license_plaintext = json.dumps(self.license_data).encode()
        if len(license_plaintext) % 16 > 0:
            pad = 16 - len(license_plaintext) % 16
            license_plaintext = license_plaintext + pad.to_bytes(1) * pad
        encrypt_data = AES.new(aes_key, AES.MODE_CBC, aes_iv).encrypt(
            license_plaintext
        )
        # 原则上不应该使用私钥加密,CryptoPlus不直接支持私钥加密
        # encrypt_key = self.crypto_plus.encrypt(aes_key)
        encrypt_key = encrypt_by_key(self.crypto_plus.private_key, aes_key)
        encrypt_license = {
            "data": base64.b64encode(encrypt_data).decode(),
            "key": base64.b64encode(encrypt_key).decode(),
            "iv": base64.b64encode(aes_iv).decode(),
        }
        encrypt_license = json.dumps(encrypt_license).encode()
        encrypt_license = base64.b64encode(encrypt_license)
        with open("GitLabEE.gitlab-license", "wb") as f:
            f.write(encrypt_license)
        return encrypt_license.decode()

    def parse(self, licenses):
        encrypt_license = base64.b64decode(licenses)
        encrypt_license = json.loads(encrypt_license.decode())
        encrypt_data = base64.b64decode(
            encrypt_license["data"].replace("\n", "")
        )
        encrypt_key = base64.b64decode(encrypt_license["key"].replace("\n", ""))
        iv = base64.b64decode(encrypt_license["iv"])
        # 原则上不应该使用公钥解密,CryptoPlus不直接支持公钥解密
        # key = self.crypto_plus.decrypt(encrypt_key)
        key = decrypt_by_key(self.crypto_plus.public_key, encrypt_key)
        data = AES.new(key, AES.MODE_CBC, iv).decrypt(encrypt_data)
        if data[-1] != 125:
            # 不以}结尾
            data = data[: -data[-1]]
        # print(json.dumps(json.loads(data.decode()), indent=2))
        return json.dumps(json.loads(data.decode()), indent=2)

    def patch(self):
        return ""


if __name__ == "__main__":
    GitlabKeyGen().run()

如果是用docker搭建的gitlab,那我向你推荐这个项目
老规矩,求个免费的赞 :palm_up_hand: :palm_up_hand: :palm_up_hand:

63 个赞

这个也行,厉害了

2 个赞

我也献上我的java版本: GitHub - nannanStrawberry314/license :face_with_peeking_eye:

7 个赞

软件分享软件开发

感谢两位大佬的分享

2 个赞

一下全炸出来了

4 个赞

666,互star一下

2 个赞

我让gpt改写为 php,却报 403 ,发不出来

2 个赞

站在巨人的肩膀上啦,我只会CV :crazy_face:

2 个赞

已点,嘿嘿 :grinning:

2 个赞

复议,等级可以直接写入到restrictions.plan 这个属性里面,可以少去一步改rb文件的过程

{
    "version": 1,
    "licensee": {
        "Name": "null",
        "Company": "null",
        "Email": "[email protected]"
    },
    "issued_at": "2023-01-01",
    "expires_at": "2100-12-31",
    "notify_admins_at": "2100-12-01",
    "notify_users_at": "2100-12-01",
    "block_changes_at": "2100-12-10",
    "cloud_licensing_enabled": false,
    "offline_cloud_licensing_enabled": false,
    "auto_renew_enabled": false,
    "seat_reconciliation_enabled": false,
    "operational_metrics_enabled": false,
    "generated_from_customers_dot": false,
    "restrictions": {
        "active_user_count": 99999,
        "plan": "ultimate"
    }
}
4 个赞

注册不能用中国手机号码怎么弄?

1 个赞

马克两下

1 个赞

好物,mark

1 个赞

有什么好说的,直接mark收藏

1 个赞

有特殊标签被waf拦截了吧

1 个赞

学到了

1 个赞

注册啥啊

1 个赞

gitlab ee 注册需要 手机号

1 个赞

直接docker一键部署,省事

2 个赞