Skip to content

Instantly share code, notes, and snippets.

@trandaison
Last active November 14, 2024 00:05
Show Gist options
  • Save trandaison/40b1d83618ae8e3d2da59df8c395093a to your computer and use it in GitHub Desktop.
Save trandaison/40b1d83618ae8e3d2da59df8c395093a to your computer and use it in GitHub Desktop.
Get full version of StarUML

Note: This is the guide for v 2.x.

For the v3, please follow this url: https://blog.csdn.net/sam_shan/article/details/80585240 Thanks @liy-cn for contributing.

For the v6, please follow the comment below: https://gist.github.com/trandaison/40b1d83618ae8e3d2da59df8c395093a?permalink_comment_id=5079514#gistcomment-5079514

StarUML

Download: StarUML.io

Crack

Source: jorgeancal

After installing StartUML successfully, modify LicenseManagerDomain.js as follow:

/**
 * File name: LicenseManagerDomain.js
 * Mac OS: /Applications/StarUML.app/Contents/www/license/node/
 * Linux: /opt/staruml/www/license/node/
 */

(function () {
    "use strict";
 
    var NodeRSA = require('node-rsa');
 
    function validate(PK, name, product, licenseKey) {
        return{
           name: "sontd",
           product: "StarUML",
           licenseType: "vip",
           quantity: "unlimited",
           licenseKey: "no, thanks!"
        };
    }
 
    function init(domainManager) {
        if (!domainManager.hasDomain("LicenseManager")) {
            domainManager.registerDomain("LicenseManager", {major: 0, minor: 1});
        }
        domainManager.registerCommand(
            "LicenseManager", // domain name
            "validate",       // command name
            validate,         // command handler function
            false,            // this command is synchronous in Node ("false" means synchronous")
            "Validate License",
            [
                {
                    name: "PK",
                    type: "string",
                    description: "PK"
                },
                {
                    name: "name",
                    type: "string",
                    description: "name of license owner"
                },
                {
                    name: "product",
                    type: "string",
                    description: "product name"
                },
                {
                    name: "licenseKey",
                    type: "string",
                    description: "license key"
                }
            ],
            [
                {
                    name: "result", // return values
                    type: "object",
                    description: "result"
                }
            ]
        );
    }
 
    exports.init = init;
 
}());

Now, open it and go to Help > Enter License and you have to write the name and the licence key which you have written on LicenseManagerDomain.js. In this example would be the next:

name: "sontd"
License Key: "no, thanks!"

Enjoy it!

@MinskThD
Copy link

MinskThD commented Jun 5, 2024

Hello, my language is not English, so I will use a translator.
I also had this problem and I was able to solve it.
This worked for me in Start UML v6.1.1
What you have to do is to enter src/engine/diagram-export.js.

change this in the PNG and JPEG section

// Draw watermark if application is not registered
  if (app.licenseManager.getStatus() !== true) {
    diagram.drawWatermark(
      canvas,
      canvasElement.width,
      canvasElement.height,
      70,
      12,
      "UNREGISTERED",
    );
  } else if (app.licenseManager.getLicenseInfo().licenseType === "STD") {
    const dgmType = diagram.constructor.name;
    if (app.licenseManager.isProDiagram(dgmType)) {
      diagram.drawWatermark(
        canvas,
        canvasElement.width,
        canvasElement.height,
        45,
        12,
        "PRO ONLY",
      );
    }
  }

to

// Draw watermark if application is not registered
  if (app.licenseManager.getStatus() !== true) {
    diagram.drawWatermark(
      canvas,
      canvasElement.width,
      canvasElement.height,
      45,
      12,
      "PRO ONLY",
    );
  } 

This also needs to be changed in the SVG part

// Draw watermark if application is not registered
  if (app.licenseManager.getStatus() !== true) {
    diagram.drawWatermark(
      canvas,
      boundingBox.getWidth(),
      boundingBox.getHeight(),
      70,
      12,
      "UNREGISTERED",
    );
  } else if (app.licenseManager.getLicenseInfo().licenseType === "STD") {
    const dgmType = diagram.constructor.name;
    if (app.licenseManager.isProDiagram(dgmType)) {
      diagram.drawWatermark(
        canvas,
        boundingBox.getWidth(),
        boundingBox.getHeight(),
        45,
        12,
        "PRO ONLY",
      );
    }
  }

to

// Draw watermark if application is not registered
  if (app.licenseManager.getStatus() !== true) {
    diagram.drawWatermark(
      canvas,
      boundingBox.getWidth(),
      boundingBox.getHeight(),
      45,
      12,
      "PRO ONLY",
    );
  }

And you also need to change the PDF part

// Draw watermark if application is not registered
    if (app.licenseManager.getStatus() !== true) {
      drawWatermarkPDF(doc, 70, 12, "UNREGISTERED");
    } else if (app.licenseManager.getLicenseInfo().licenseType === "STD") {
      const dgmType = diagram.constructor.name;
      if (app.licenseManager.isProDiagram(dgmType)) {
        drawWatermarkPDF(doc, 45, 12, "PRO ONLY");
      }
    }

to

    // Draw watermark if application is not registered
    if (app.licenseManager.getStatus() !== true) {
        drawWatermarkPDF(doc, 45, 12, "PRO ONLY");
      }

I'm new to GitHub

@ImZeera
Copy link

ImZeera commented Sep 18, 2024

Thank u @MinskThD . It Worked, i appreciated bro.

@RDreamStudios
Copy link

RDreamStudios commented Sep 29, 2024

It worked for me in StarUML 6.2.2 with these codes, it also solved the problem to export diagram as a PRO User: https://gist.github.com/RodyDesigner/394c00db555119ea50eea7eb158312ad

have a good day!!

@Pipoo13
Copy link

Pipoo13 commented Oct 15, 2024

Thank u @MinskThD . It Worked, i appreciated bro.

hahah its work too

@MadisonJames2
Copy link

Thank you

@LorenBregant
Copy link

Hello, my language is not English, so I will use a translator.
I did the following and it worked for me on Linux (StarUML v6.2.2).
Modify the entire contents of src/engine/license-manager.js
(to find the file I followed the instructions in one of the previous comments)

const { EventEmitter } = require("events");
const fs = require("fs");
const path = require("path");
const UnregisteredDialog = require("../dialogs/unregistered-dialog");
const packageJSON = require("../../package.json");

const PRO_DIAGRAM_TYPES = [
  "SysMLRequirementDiagram",
  "SysMLBlockDefinitionDiagram",
  "SysMLInternalBlockDiagram",
  "SysMLParametricDiagram",
  "BPMNDiagram",
  "WFWireframeDiagram",
  "AWSDiagram",
  "GCPDiagram",
];

var status = true;
var licenseInfo = {
  product: packageJSON.config.product_id,
  licenseType: "free", 
  quantity: 1,
};

/**
 * @private
 */
class LicenseManager extends EventEmitter {
  constructor() {
    super();
    this.projectManager = null;
  }

  isProDiagram(diagramType) {
    return PRO_DIAGRAM_TYPES.includes(diagramType);
  }

  /**
   * Get Registration Status
   * @return {string}
   */
  getStatus() {
    return status;
  }

  /**
   * Get License Information
   * @return {Object}
   */
  getLicenseInfo() {
    return licenseInfo;
  }

  /**
   */
  validate() {
    return Promise.resolve(licenseInfo);
  }

  /**
   */
  async checkLicenseValidity() {
    setStatus(this, true); 
  }

  /**
   *
   * @param {string} licenseKey
   */
  register(licenseKey) {
    return Promise.resolve(licenseInfo);
  }

  htmlReady() {}

  appReady() {
    this.checkLicenseValidity();
  }
}

module.exports = LicenseManager;

It worked for me so far, I hope it works for someone else too.

@Medsalemabdi
Copy link

Hello, my language is not English, so I will use a translator. I did the following and it worked for me on Linux (StarUML v6.2.2). Modify the entire contents of src/engine/license-manager.js (to find the file I followed the instructions in one of the previous comments)

const { EventEmitter } = require("events");
const fs = require("fs");
const path = require("path");
const UnregisteredDialog = require("../dialogs/unregistered-dialog");
const packageJSON = require("../../package.json");

const PRO_DIAGRAM_TYPES = [
  "SysMLRequirementDiagram",
  "SysMLBlockDefinitionDiagram",
  "SysMLInternalBlockDiagram",
  "SysMLParametricDiagram",
  "BPMNDiagram",
  "WFWireframeDiagram",
  "AWSDiagram",
  "GCPDiagram",
];

var status = true;
var licenseInfo = {
  product: packageJSON.config.product_id,
  licenseType: "free", 
  quantity: 1,
};

/**
 * @private
 */
class LicenseManager extends EventEmitter {
  constructor() {
    super();
    this.projectManager = null;
  }

  isProDiagram(diagramType) {
    return PRO_DIAGRAM_TYPES.includes(diagramType);
  }

  /**
   * Get Registration Status
   * @return {string}
   */
  getStatus() {
    return status;
  }

  /**
   * Get License Information
   * @return {Object}
   */
  getLicenseInfo() {
    return licenseInfo;
  }

  /**
   */
  validate() {
    return Promise.resolve(licenseInfo);
  }

  /**
   */
  async checkLicenseValidity() {
    setStatus(this, true); 
  }

  /**
   *
   * @param {string} licenseKey
   */
  register(licenseKey) {
    return Promise.resolve(licenseInfo);
  }

  htmlReady() {}

  appReady() {
    this.checkLicenseValidity();
  }
}

module.exports = LicenseManager;

It worked for me so far, I hope it works for someone else too.

Works perfectly thanks :)

@Nother01
Copy link

Nother01 commented Oct 25, 2024

For ease of use, I took the license and watermark management logic and put it into a bash script, if that helps people code

@SebaG20xx
Copy link

For ease of use, I took the license and watermark management logic and put it into a bash script, if that helps people

https://github.com/Nother01/Crack_StarUML 

I ported the bash script to PowerShell
Repo

@aouniR
Copy link

aouniR commented Nov 7, 2024

Instructions:

  1. Copy and paste this updated code into the app/src/engine/license-manager.js file.
  2. Run the following command to repackage the app: asar pack app app.asar

Updated Code:

const { EventEmitter } = require("events");
const fs = require("fs");
const path = require("path");
const crypto = require("crypto");
const UnregisteredDialog = require("../dialogs/unregistered-dialog");
const packageJSON = require("../../package.json");

const SK = "DF9B72CC966FBE3A46F99858C5AEE";

// Check License When File Save
const LICENSE_CHECK_PROBABILITY = 0.3;

const PRO_DIAGRAM_TYPES = [
  "SysMLRequirementDiagram",
  "SysMLBlockDefinitionDiagram",
  "SysMLInternalBlockDiagram",
  "SysMLParametricDiagram",
  "BPMNDiagram",
  "WFWireframeDiagram",
  "AWSDiagram",
  "GCPDiagram",
];

var status = false;
var licenseInfo = null;

/**
 * Set Registration Status
 * This function is out of LicenseManager class for the security reason
 * (To disable changing License status by API)
 * @Private
 * @param {boolean} newStat
 * @return {string}
 */
function setStatus(licenseManager, newStat) {
  if (status !== newStat) {
    status = newStat;
    licenseManager.emit("statusChanged", status);
  }
}

/**
 * @Private
 */
class LicenseManager extends EventEmitter {
  constructor() {
    super();
    this.projectManager = null;
  }

  isProDiagram(diagramType) {
    return PRO_DIAGRAM_TYPES.includes(diagramType);
  }

  /**
   * Get Registration Status
   * @return {string}
   */
  getStatus() {
    return status;
  }

  /**
   * Get License Information
   * @return {Object}
   */
  getLicenseInfo() {
    return licenseInfo;
  }

  findLicense() {
    var licensePath = path.join(app.getUserPath(), "/license.key");
    if (!fs.existsSync(licensePath)) {
      licensePath = path.join(app.getAppPath(), "../license.key");
    }
    if (fs.existsSync(licensePath)) {
      return licensePath;
    } else {
      return null;
    }
  }

  /**
   * Check license validity
   * @return {Promise}
   */
  validate() {
    return new Promise((resolve, reject) => {
      // Skip all validation and assume license is valid
      resolve('License is valid');  // Directly resolve the promise
    });
  }

  /**
   * Return evaluation period status
   * @Private
   * @return {number} Remaining days
   */
  checkEvaluationPeriod() {
    return 30;  // Always return a valid evaluation period (30 days remaining)
  }

  async checkLicenseValidity() {
    if (packageJSON.config.setappBuild) {
      setStatus(this, true);
    } else {
      try {
        // Always consider the license valid without validation
        const result = await this.validate();
        setStatus(this, true);
      } catch (err) {
        const remains = this.checkEvaluationPeriod();
        const isExpired = remains < 0;
        const result = await UnregisteredDialog.showDialog(remains);
        setStatus(this, false);
        if (isExpired) {
          app.quit();
        }
      }
    }
  }

  /**
   * Check the license key in server and store it as license.key file in local
   *
   * @param {string} licenseKey
   */
  register(licenseKey) {
    return new Promise((resolve, reject) => {
      // Skip the server-side validation and assume success
      var data = { product: packageJSON.config.product_id, licenseKey: licenseKey };
      var file = path.join(app.getUserPath(), "/license.key");
      fs.writeFileSync(file, JSON.stringify(data, null, 2));
      licenseInfo = data;
      setStatus(this, true);
      resolve(data); // Always resolve as successful
    });
  }

  htmlReady() {}

  appReady() {
    this.checkLicenseValidity();
  }
}

module.exports = LicenseManager; 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment