Git Product home page Git Product logo

artifactorykeygen's Introduction

ArtifactoryKeygen

As it's named, this project is a keygen of Artifactory from JFrog.

Tested on 7.59.11 (Latest version), 7.9.2 (Latest version on releases-docker)

If you think this project is useful to you please leave a star! Thanks!

ALERT!! YOU SHOULD NEVER USE THIS PROJECT TO CRACK / PATCH / ILLEGAL USE ANY SOFTWARE FROM JFROG

ALERT!! THIS PROJECT IS FOR EDUCATIONAL PURPOSES!

ALERT!! THE CONSEQUENCES CAUSED BY THE USE OF THIS SOFTWARE SHALL BE BORNE BY THE USER

996.icu LICENSE

Click for different languages of this file

Table of Contents

0x00 Installation

Download ArtifactoryKeygen and ArtifactoryAgent both from Github Releases

Run ArtifactoryKeygen with Java 11 or above.

$ java -jar /path/to/ArtifactoryKeygen-1.0-SNAPSHOT-all.jar [sub-command]

Leaving sub-command empty will eventually prompt you to enter a sub-command later

Use thegen sub-command to generate a license

Of course, the license generated by Keygen cannot be used directly. You'll need ArtifactoryAgent to patch some files.

Navigate to Artifactory's Tomcat folder then edit bin/setenv.sh (It should be named setenv.bat on Windows)

Add the following line to that file. Don't forget to change the path!

# Linux / macOS(But why macOS??)
CATALINA_OPTS=-javaagent:/path/to/ArtifactoryAgent-1.0-SNAPSHOT-all.jar
:: Windows
SET CATALINA_OPTS=-javaagent:path\to\ArtifactoryAgent-1.0-SNAPSHOT-all.jar

DON'T FORGET: YOU SHOULD NEVER USE Artifactory ILLEGALLY

0x01 Configuring the keygen

Currently, this is not supported. I may add this feature future.

0x02 Configuring the agent

Currently, override the default public key is the only configurable entry.

Override default public key

First, you need to generate a proper configuration using Keygen, although you can do it manually.

By using the keygen

Run the keygen with the sub-command 'mkconfig' and then enter your public key.

To be noticed that the public key should be a RSA Public Key in X509 Format and have at least 4096 bits of modulus of the key

Copy the generated text and put it in agent arguments like this:

# Linux
CATALINA_OPTS=-javaagent:/path/to/ArtifactoryAgent-1.0-SNAPSHOT-all.jar=<GeneratedConfigHere>
:: Windows
SET CATALINA_OPTS=-javaagent:/path/to/ArtifactoryAgent-1.0-SNAPSHOT-all.jar=<GeneratedConfigHere>

The configuration should be in hexadecimal format with all letters capitalized

By your hands

Edit the template below and use Base64 to encode it then convert the encoded result into a hexadecimal string with all letters capitalized.

<config>
    <publicKey>Your public key here</publicKey>
</config>

You can get any text hexadecimal-ized by passing your text into the agent (Yes the agent is executable!)

$ java -jar /path/to/ArtifactoryAgent-1.0-SNAPSHOT-all.jar <Text>

Also, you can generate a proper key pair(RSA 4096) with the genkey sub-command in Keygen

0x03 Other useful tools

Keygen

You can retrieve all available sub-commands by using the sub-command 'help'

I'm lazy to write a help again so I copied from the sub-command 'help'

println("""
    List of all sub-commands:
        obf <text>:
            Obfuscate text with JFrog's 'ObfuscatedString' class
        pub:
            Get the current public key (RSA)
        pri:
            Get the current private key (RSA)
        genkey:
            Generate a key pair
        gen:
            Generate a license with the current private key
        verify <license>:
            Verify a license with the current public key
        enc: [ NOT TESTED ]
            Encrypt a license (I guess this is used for the license of the old version)
        verifyAgent:
            You can verify ArtifactoryAgent by attaching the agent to ArtifactoryKeygen
        mkconfig:
            Create agent config but friendly!
    To inject into artifactory
        Open Artifactory's tomcat folder and add the following JVM options to tomcat.
        In case you don't know how to pass extra JVM args you can see the README of this project
        OR Google it by yourself!
        
        -javaagent:</path/to/this/jar/file>
        
        his will patch class 'org.jfrog.license.api.a'
                    
""".trimIndent())

0x04 Compilation

Compiling the code might be a little different compared to other gradle projects.

You will notice that I've used a library from JFrog which looks like not a public one. So I decided not to upload it. However, you can extract it from artifactory.war

I assume that you are familiar with web development with Java and SpringFramework. So there will be no tutorial here about how to extract it. If you meet any problem while extracting google first!

After extracting the necessary libraries you should put them into libs. If those libraries have changed their version don't forget to update in build.gradle.kts

To compile the code and pack a jar file with all dependencies use the following gradle task

# Root project (Keygen)
$ gradlew :shadowJar
# Agent
$ graldew :ArtifactoryAgent:shadowJar

PRs are always welcome! Thanks for your contributions to this project!

0x05 TODOs and Future updates

  • Code Cleanup
  • Add more configurables to both Keygen and Agent
  • Artifactory version detection
  • Migrate from artifactory-addons-manager to LicenseManager (Which is a de-obfuscated version of artifactory-addons-manager)
  • Chinese version of README.MD

artifactorykeygen's People

Contributors

lama3l9r avatar dalamudx avatar

Stargazers

 avatar  avatar xcrystalskyx avatar ww avatar  avatar Liang Chen avatar Marc Proux avatar Nguyen Khac Trieu avatar huangyong avatar Feng Chang avatar António Carlos Silva avatar Nelson avatar  avatar  avatar Pumpkin avatar SW-Luis-Palacios avatar Mikhail Merkulov avatar EldestBard avatar Evgenii Sviderskii avatar Hua An avatar Aleksey Dzyubalo avatar Kamnev Georgiy avatar Li Jie avatar  avatar  avatar Taha Amin Ghafuri [T@G] avatar zhw777 avatar david.wang avatar Shawn Chow avatar Brandon Lopez avatar  avatar

Watchers

 avatar  avatar

artifactorykeygen's Issues

How to run in docker (answer)

Who wondering how to run it in docker/compose, success:

Add to env with path to *** (just mount it or copy to some dir that mounting into container), also i added 777 permissions to this files, dont know is it necessary or not

  artifactory:
    image: ${DOCKER_REGISTRY}/jfrog/artifactory-pro:${ARTIFACTORY_VERSION}
    container_name: artifactory
    user: "${UID}:${GID}"
    environment:
      - JF_ROUTER_ENTRYPOINTS_EXTERNALPORT=${JF_ROUTER_ENTRYPOINTS_EXTERNALPORT}
      - EXTRA_JAVA_OPTIONS=-javaagent:/opt/jfrog/artifactory/var/bootstrap/ArtifactoryAgent-1.0-SNAPSHOT-all.jar

Using keygen inside container, java binary located in /opt/jfrog/artifactory/app/third-party/java/bin/java so for me command will be /opt/jfrog/artifactory/app/third-party/java/bin/java -jar /opt/jfrog/artifactory/var/bootstrap/ArtifactoryKeygen-1.0-SNAPSHOT-all.jar gen, important info - verifyAgent not working inside container.
Logs of container on success:

2024-06-05T02:15:28.734Z [shell] [INFO ] [] [installerCommon.sh:1292       ] [main] - Redirection is set to false. Skipping catalina log redirection
NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Artifactory Agent :: =====================================
Artifactory Agent ::   Artifactory Agent | by lamadaemon
Artifactory Agent ::   Is now LOADED!

View loaded params of java: docker container top artifactory

Working latest available version for current time: docker.jfrog.io/jfrog/artifactory-pro:7.84.12. I think it will work also for helm deploymentss. Hope it helps for someone 🤩

hook入口函数的改良建议

我自己也搞了个agent来实现这个功能,本来打算自用的
偶然搜索到了这个项目,简单看了看代码
目前hook的入口是几个license相关类,但是随着版本升级,代码重构的话,需要hook的类名,方法名,变量名是可能发生变化的,目前这种处理方式的兼容性略差
再研究研究代码就会发现几个license类关于公钥的处理都需要调用base64相关的类
所以可以将hook的入口修改为Base64的类,判断传入的字符串为原始公钥的时候,返回修改后公钥
这个操作基本上可以兼容后续大部分的版本变更

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.