Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

X-pack cracking

Shulou Source: shulou.com Published: 2022-06-03 05:14:33 10月04日 Update

1、cp /home/elk/elasticsearch-6.3.2/modules/x-pack/x-pack-core/x-pack-core-6.3.2.jar /home/tmp

2、jar -xf /home/tmp/x-pack-core-6.3.2.jar

3、vim LicenseVerifier.java

package org.elasticsearch.license;

import java.nio.; import java.util.;

import java.security.;

import org.elasticsearch.common.xcontent.;

import org.apache.lucene.util.;

import org.elasticsearch.common.io.;

import java.io.*;

public class LicenseVerifier {

public static boolean verifyLicense(final License license, final byte[] encryptedPublicKeyData) {

return true;

}

public static boolean verifyLicense(final License license) { return true; }

}

4、vim XPackBuild.java

package org.elasticsearch.xpack.core;

import org.elasticsearch.common.io.;

import java.net.;

import org.elasticsearch.common.;

import java.nio.file.;

import java.io.;

import java.util.jar.;

public class XPackBuild {

public static final XPackBuild CURRENT;

private String shortHash;

private String date;

@SuppressForbidden(reason = "looks up path of xpack.jar directly") static Path getElasticsearchCodebase() {

final URL url = XPackBuild.class.getProtectionDomain().getCodeSource().getLocation();

try { return PathUtils.get(url.toURI()); }

catch (URISyntaxException bogus) {

throw new RuntimeException(bogus); }

}

XPackBuild(final String shortHash, final String date) { this.shortHash = shortHash; this.date = date; } public String shortHash() { return this.shortHash; } public String date(){ return this.date; } static { final Path path = getElasticsearchCodebase(); String shortHash = null; String date = null; Label_0157: { shortHash = "Unknown"; date = "Unknown"; } CURRENT = new XPackBuild(shortHash, date); }

}

5、javac -cp "/home/elk/elasticsearch-6.3.2/lib/elasticsearch-6.3.2.jar:/home/elk/elasticsearch-6.3.2/lib/lucene-core-7.3.1.jar:/home/elk/elasticsearch-6.3.2/modules/x-pack/x-pack-core/x-pack-core-6.3.2.jar:/home/elk/elasticsearch-6.3.2/lib/elasticsearch-core-6.3.2.jar" XPackBuild.java

6、javac -cp "/home/elk/elasticsearch-6.3.2/lib/elasticsearch-6.3.2.jar:/home/elk/elasticsearch-6.3.2/lib/lucene-core-7.3.1.jar:/home/elk/elasticsearch-6.3.2/modules/x-pack/x-pack-core/x-pack-core-6.3.2.jar" LicenseVerifier.java

7、生成的 class文件 覆盖 /home/tmp/org/elasticsearch/license org/elasticsearch/xpack/core/

8、jar -cf x-pack-core-6.3.2.jar /home/tmp/* (注意不要把之前的多余文件打包进去了)

9、cp /home/tmp/x-pack-core-6.3.2.jar /home/elk/elasticsearch-6.3.2/modules/x-pack/x-pack-core/

10、重启elastic ; 在kibana上传授权文件 license.json

{"license":{"uid":"2e44e23c-7087-447b-9a0e-398b8b7a917c","type":"platinum","issue_date_in_millis":1532649600000,"expiry_date_in_millis":2544271999999,"max_nodes":100,"issued_to":"han jiang (www.zfcloud.com)","issuer":"Web Form","signature":"AAAAAwAAAA2elPtByKMPXHGshznoAAABmC9ZN0hjZDBGYnVyRXpCOW5Bb3FjZDAxOWpSbTVoMVZwUzRxVk1PSmkxaktJRVl5MUYvUWh4bHZVUTllbXNPbzBUemtnbWpBbmlWRmRZb25KNFlBR2x0TXc2K2p1Y1VtMG1UQU9TRGZVSGRwaEJGUjE3bXd3LzRqZ05iLzRteWFNekdxRGpIYlFwYkJiNUs0U1hTVlJKNVlXekMrSlVUdFIvV0FNeWdOYnlESDc3MWhlY3hSQmdKSjJ2ZTcvYlBFOHhPQlV3ZHdDQ0tHcG5uOElCaDJ4K1hob29xSG85N0kvTWV3THhlQk9NL01VMFRjNDZpZEVXeUtUMXIyMlIveFpJUkk2WUdveEZaME9XWitGUi9WNTZVQW1FMG1DenhZU0ZmeXlZakVEMjZFT2NvOWxpZGlqVmlHNC8rWVVUYzMwRGVySHpIdURzKzFiRDl4TmM1TUp2VTBOUlJZUlAyV0ZVL2kvVk10L0NsbXNFYVZwT3NSU082dFNNa2prQ0ZsclZ4NTltbU1CVE5lR09Bck93V2J1Y3c9PQAAAQCDbfLHMEJ/Bp4sIDNuTFk9IyxaUaxxxs3/EjU7urcHaU8X9tlxUICA2g4vnIcJ/nPcsZKxfq+j3wriz0DGtL0c4At2tzMEEuIdi1J7hLUxJz1GzQYCfaV84mIHeSeBObaTJF7ic03ef0t8kMztMk17/7/+mJWacqk9GES/wAQfaLzGxxX38sj6rpSG/jMlve7EIFHiGb22jGp8NDGuneooddESvrUth6lrm3tDTPWtM5Vf/RvTUJy4LX3PJsqrgZscx0n0cbXtjDHU4SAyvZ02govNAeZZFMKgmGXnLqpWXJGX3GOeN4I2xxky03NR4mPtPogsoA7EDALcIXFe+wr4","start_date_in_millis":1532649600000}}

11、执行命令: /home/elk/elasticsearch-6.3.2/bin/elasticsearch-setup-passwords interactive (设置密码)

12、修改 kibana.yml; elasticuser: elasticpasswd: (配置刚刚修改好的用户密码)

Tags: Files passwords commands users generation configuration Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker MariaDB macOS Redmi OPPO Reno