├── Dockerfile ├── README.md ├── build_crack_jar.sh └── crack.sh /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VERSION 2 | 3 | FROM elasticsearch:${VERSION} AS Baseline 4 | 5 | FROM eclipse-temurin:20.0.1_9-jdk 6 | 7 | 8 | ARG VERSION 9 | ARG HTTP_PROXY 10 | ARG HTTPS_PROXY 11 | ENV VERSION=${VERSION} 12 | 13 | WORKDIR /crack 14 | 15 | COPY --from=Baseline /usr/share/elasticsearch/lib /usr/share/elasticsearch/lib 16 | COPY --from=Baseline /usr/share/elasticsearch/modules/x-pack-core /usr/share/elasticsearch/modules/x-pack-core 17 | COPY build_crack_jar.sh /crack 18 | 19 | RUN apt update && apt install -y zip 20 | 21 | CMD [ "bash", "build_crack_jar.sh" ] 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # crack-elasticsearch-by-docker 2 | 3 | Crack elasticsearch 7.x / 8.x by docker 4 | 5 | 适用于破解elasticsearch 7.x / 8.x的自动脚本 6 | 7 | 已测试版本 8 | * elasticsearch 8.2.0 9 | * elasticsearch 8.5.0 10 | * elasticsearch 8.7.0 11 | 12 | 13 | # 注意事项 14 | 15 | JDK版本,必须与ES使用的版本完全一致,即使是小版本。 16 | curl拉取github文件,网络不好会导致失败,建议全局代理。 17 | 18 | ## Usage 19 | 20 | Get srcipt 21 | 22 | 获取脚本源码 23 | 24 | ```shell 25 | git clone https://github.com/wolfbolin/crack-elasticsearch-by-docker.git 26 | ``` 27 | 28 | Run srcipt with version 29 | 30 | 运行脚本并指定完整版本(例如: 8.2.0) 31 | 32 | ```shell 33 | cd crack-elasticsearch-by-docker 34 | version=8.2.0 35 | bash crack.sh $version 36 | ``` 37 | 38 | Get cracked x-pack-core-$version.jar 39 | 40 | 编译产物和编译中间件保存在output文件夹中 41 | 42 | ```shell 43 | cp output/x-pack-core-$version.crack.jar x-pack-core-$version.jar 44 | ``` 45 | ### 覆盖路径 46 | 47 | RPM包安装默认路径 48 | 49 | ```shell 50 | /usr/share/elasticsearch/modules/x-pack-core/ 51 | 52 | ``` 53 | 54 | 55 | 56 | ## Others 57 | You can change `crack.sh` shell with http_proxy / https_proxy url 58 | 59 | 你可以修改`crack.sh`以使用代理访问网络,避免网络访问故障 60 | 61 | ```shell 62 | docker build --no-cache -f Dockerfile \ 63 | --build-arg VERSION="${version}" \ 64 | --build-arg HTTP_PROXY="http://1.2.3.4:8080" \ 65 | --build-arg HTTPS_PROXY="http://1.2.3.4:8080" \ 66 | --tag ${service_name}:${version} . 67 | 68 | docker run -it --rm \ 69 | -v $(pwd)/output:/crack/output \ 70 | -e HTTP_PROXY="http://1.2.3.4:8080" \ 71 | -e HTTPS_PROXY="http://1.2.3.4:8080" \ 72 | ${service_name}:${version} 73 | ``` 74 | 75 | 76 | -------------------------------------------------------------------------------- /build_crack_jar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | v=( ${VERSION//./ } ) 3 | branch="${v[0]}.${v[1]}" 4 | version="${v[0]}.${v[1]}.${v[2]}" 5 | 6 | echo "Runtime environment" 7 | echo -e "branch: \t\t$branch" 8 | echo -e "version: \t\t$version" 9 | echo -e "http_proxy: \t\t$HTTP_PROXY" 10 | echo -e "https_proxy: \t\t$HTTPS_PROXY" 11 | 12 | 13 | # Download source code 14 | curl -o LicenseVerifier.java -s https://raw.githubusercontent.com/elastic/elasticsearch/$branch/x-pack/plugin/core/src/main/java/org/elasticsearch/license/LicenseVerifier.java 15 | curl -o XPackBuild.java -s https://raw.githubusercontent.com/elastic/elasticsearch/$branch/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackBuild.java 16 | 17 | # Edit LicenseVerifier.java 18 | sed -i '/.*PublicKey PUBLIC_KEY.*/i END\nCODE' LicenseVerifier.java 19 | sed -i '/.*signedContent = null.*/i BEG' LicenseVerifier.java 20 | sed -i '/BEG/,/END/d' LicenseVerifier.java 21 | sed -i 's/CODE/ return true;\n }\n/g' LicenseVerifier.java 22 | 23 | # Edit XPackBuild.java 24 | sed -i 's/path.toString().endsWith(".jar")/false/g' XPackBuild.java 25 | 26 | # Build calss file 27 | javac -cp "/usr/share/elasticsearch/lib/*:/usr/share/elasticsearch/modules/x-pack-core/*" LicenseVerifier.java 28 | javac -cp "/usr/share/elasticsearch/lib/*:/usr/share/elasticsearch/modules/x-pack-core/*" XPackBuild.java 29 | 30 | # Build jar file 31 | cp /usr/share/elasticsearch/modules/x-pack-core/x-pack-core-$version.jar x-pack-core-$version.jar 32 | unzip x-pack-core-$version.jar -d ./x-pack-core-$version 33 | cp LicenseVerifier.class ./x-pack-core-$version/org/elasticsearch/license/ 34 | cp XPackBuild.class ./x-pack-core-$version/org/elasticsearch/xpack/core/ 35 | jar -cvf x-pack-core-$version.crack.jar -C x-pack-core-$version/ . 36 | rm -rf x-pack-core-$version 37 | 38 | # Copy output 39 | cp LicenseVerifier.* ./output 40 | cp XPackBuild.* ./output 41 | cp x-pack-core* ./output 42 | -------------------------------------------------------------------------------- /crack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ ! "$1" ] ;then 3 | echo "You have not entered a version" 4 | exit 5 | fi 6 | version=$1 7 | echo -e "\033[36mRun for version: ${version}\033[0m" 8 | mkdir output 9 | service_name="elastic-crack" 10 | docker stop ${service_name} 11 | docker rm ${service_name} 12 | 13 | 14 | docker build --no-cache -f Dockerfile \ 15 | --build-arg VERSION="${version}" \ 16 | --tag ${service_name}:${version} . 17 | 18 | docker run -it --rm \ 19 | -v $(pwd)/output:/crack/output \ 20 | ${service_name}:${version} 21 | --------------------------------------------------------------------------------