Skip to content

Commit 479f9e8

Browse files
committed
dbvisualizer-agent
0 parents  commit 479f9e8

File tree

9 files changed

+1124
-0
lines changed

9 files changed

+1124
-0
lines changed

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Compiled class file
2+
*.class
3+
4+
# Log file
5+
*.log
6+
7+
# BlueJ files
8+
*.ctxt
9+
10+
# Mobile Tools for Java (J2ME)
11+
.mtj.tmp/
12+
13+
# Package Files #
14+
*.jar
15+
*.war
16+
*.nar
17+
*.ear
18+
*.zip
19+
*.tar.gz
20+
*.rar
21+
22+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23+
hs_err_pid*

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# DbVisualizer Pro Agent
2+
3+
#### Support (more version need your feedback):
4+
DbVisualizer 10.0.22
5+
6+
## 使用说明
7+
8+
### 优势
9+
* 提供基于java的命令行 keygen,更方便在终端环境使用。
10+
* 开源项目,你知道破解时都做了什么。
11+
12+
### 直接下载
13+
* 直接下载本项目[release](https://github.com/xiaguliuxiang/dbvisualizer-agent/releases)包。
14+
15+
### 自行编译
16+
* Clone本项目源码,pom.xml同级目录执行`mvn package`后即可进行编译。
17+
* 使用`target`目录产出的`dbvisualizer-agent-1.0-SNAPSHOT-jar-with-dependencies.jar`,而非`dbvisualizer-agent-1.0-SNAPSHOT.jar`
18+
* *如果你不知道我在说什么,最好还是直接下载我编译好的包。*
19+
20+
### 使用帮助
21+
* 如果你已经获得`dbvisualizer-agent.jar`,可以试着执行`java -jar dbvisualizer-agent.jar -h`看看输出的帮助。
22+
23+
### 配置Agent
24+
1.`dbvisualizer-agent.jar`放在一个你不会随便删除的位置。
25+
2. 设置环境变量`VM options`(这其实是Java的环境变量,用来指定其启动java程序时附带的参数),把`-javaagent`参数附带上。具体可以这么做:
26+
* 你可以把:`-javaagent:/path/dbvisualizer-agent.jar`这样的命令直接放到`dbvis.vmoptions`这样的文件内。
27+
* 你还可以直接命令行执行:` sed -i '$a-javaagent:/path/dbvisualizer-agent.jar' ${DBVIS_HOME}/dbvis.vmoptions`来添加参数。
28+
* 或者你所知的其他修改环境变量的方法。
29+
* 总之你想办法把`-javaagent`参数附带到要启动的java进程上。
30+
3. 配置完成请重启你的`DbVisualizer`客户端。
31+
4. 如果你想验证是否配置成功,可以这么做:
32+
* 执行类似命令:`ps aux|grep java` 找到对应的进程看看`-javaagent`参数是否正确附上。
33+
*`Linux`用户目录类似:`${HOME}/.dbvis/logs`软件运行日志内应该能找到:`-javaagent:/path/dbvisualizer-agent.jar`的输出字样。
34+
*`Windows`用户目录类似:`%USERPROFILE%/.dbvis/logs`软件运行日志内应该能找到:`-javaagent:/path/dbvisualizer-agent.jar`的输出字样。
35+
36+
### 使用KeyGen
37+
* 你得确认已经配置好agent,参考上面说明。
38+
* 当你试着执行`java -jar dbvisualizer-agent.jar -h`时应该可以看到输出的KeyGen参数帮助。
39+
* 请仔细看看每个参数的作用。
40+
* 提供了正确的参数运行KeyGen会在终端输出计算好的激活码。
41+
* 将生成的激活码复制出来去激活你的DbVisualizer。
42+
* 举个栗子:`java -jar dbvisualizer-agent.jar -n xiaguliuxiang -o https://github.com/xiaguliuxiang/dbvisualizer-agent`
43+
44+
### 申明
45+
* 本项目只做个人学习研究之用,不得用于商业用途!
46+
* 商业使用请向 [DbVisualizer](https://www.dbvis.com) 购买正版,谢谢合作!
47+
* 本项目使用`GNU General Public License v3.0`开源许可!
48+
* 不允许说我代码写的糟糕。
49+
50+
### 交流
51+
* 给本项目发issue。
52+
* 欢迎你来一起完善这个项目,请发PR。
53+
* 你可以加入QQ群:`532944625` 和我实时交流。
54+
* 访问网站:[https://github.com/xiaguliuxiang/dbvisualizer-agent](https://github.com/xiaguliuxiang/dbvisualizer-agent) 给我留言。
55+
56+
### 热心网友教程(感谢原作者,侵删!)
57+
* [Google](https://www.google.com)
58+
59+
### 关于
60+
* [侠骨留香](https://github.com/xiaguliuxiang)
61+
* 2019年09月09日

pom.xml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>site.xiaguliuxiang.crack.dbvisualizer</groupId>
8+
<artifactId>dbvisualizer-agent</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<name>DbVisualizer Pro Agent</name>
12+
<url>https://github.com/xiaguliuxiang/dbvisualizer-agent</url>
13+
14+
<properties>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
<maven.compiler.source>1.8</maven.compiler.source>
17+
<maven.compiler.target>1.8</maven.compiler.target>
18+
<commons-cli.version>1.4</commons-cli.version>
19+
<jaxb-api-version>2.2.12</jaxb-api-version>
20+
<javassist.version>3.21.0-GA</javassist.version>
21+
</properties>
22+
23+
<dependencies>
24+
<!--
25+
The Apache Commons CLI library provides an API for parsing command line options passed to programs.
26+
It's also able to print help messages detailing the options available for a command line tool.
27+
-->
28+
<dependency>
29+
<groupId>commons-cli</groupId>
30+
<artifactId>commons-cli</artifactId>
31+
<version>${commons-cli.version}</version>
32+
</dependency>
33+
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
34+
<!-- https://docs.oracle.com/javase/8/docs/api/javax/xml/bind/DatatypeConverter.html#parseBase64Binary-java.lang.String- -->
35+
<dependency>
36+
<groupId>javax.xml.bind</groupId>
37+
<artifactId>jaxb-api</artifactId>
38+
<version>${jaxb-api-version}</version>
39+
</dependency>
40+
<!--
41+
Javassist (Java Programming Assistant) makes Java bytecode manipulation simple.
42+
It is a class library for editing bytecodes in Java; it enables Java programs to
43+
define a new class at runtime and to modify a class file when the JVM loads it.
44+
-->
45+
<dependency>
46+
<groupId>org.javassist</groupId>
47+
<artifactId>javassist</artifactId>
48+
<version>${javassist.version}</version>
49+
</dependency>
50+
</dependencies>
51+
52+
<build>
53+
<plugins>
54+
<!--
55+
Apache Maven JAR Plugin
56+
This plugin provides the capability to build jars.
57+
-->
58+
<plugin>
59+
<groupId>org.apache.maven.plugins</groupId>
60+
<artifactId>maven-jar-plugin</artifactId>
61+
<version>3.1.2</version>
62+
<configuration>
63+
<archive>
64+
<addMavenDescriptor>false</addMavenDescriptor>
65+
</archive>
66+
<excludes>xiaguliuxiang.keystore</excludes>
67+
</configuration>
68+
</plugin>
69+
<!--
70+
Apache Maven Assembly Plugin
71+
The Assembly Plugin for Maven is primarily intended to allow users to aggregate the project output
72+
along with its dependencies, modules, site documentation, and other files into a single distributable archive.
73+
-->
74+
<plugin>
75+
<groupId>org.apache.maven.plugins</groupId>
76+
<artifactId>maven-assembly-plugin</artifactId>
77+
<version>3.1.1</version>
78+
<configuration>
79+
<archive>
80+
<manifest>
81+
<addClasspath>false</addClasspath>
82+
</manifest>
83+
<manifestEntries>
84+
<Premain-Class>site.xiaguliuxiang.crack.dbvisualizer.agent.Agent</Premain-Class>
85+
<Main-Class>site.xiaguliuxiang.crack.dbvisualizer.Usage</Main-Class>
86+
<Can-Redefine-Classes>true</Can-Redefine-Classes>
87+
<Built-By>[email protected]</Built-By>
88+
<Created-By>[email protected]</Created-By>
89+
</manifestEntries>
90+
</archive>
91+
<descriptorRefs>
92+
<descriptorRef>jar-with-dependencies</descriptorRef>
93+
</descriptorRefs>
94+
</configuration>
95+
<executions>
96+
<execution>
97+
<id>make-assembly</id>
98+
<phase>package</phase>
99+
<goals>
100+
<goal>single</goal>
101+
</goals>
102+
</execution>
103+
</executions>
104+
</plugin>
105+
</plugins>
106+
</build>
107+
108+
</project>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package site.xiaguliuxiang.crack.dbvisualizer;
2+
3+
import org.apache.commons.cli.*;
4+
import site.xiaguliuxiang.crack.dbvisualizer.keygen.KeyGen;
5+
6+
/**
7+
8+
* @date 2019-09-09 20:00:00
9+
*/
10+
public class Usage {
11+
private static final Options OPTIONS = new Options();
12+
private static final String DEFAULT_LICENSE_NAME = "侠骨留香";
13+
private static final String DEFAULT_LICENSE_ORG = "ChinaPYG";
14+
15+
public static void main(String[] args) {
16+
String usage = "\n====================================================\n"
17+
+ "======= DbVisualizer Pro Crack Agent =======\n"
18+
+ "======= https://github.com/xiaguliuxiang =======\n"
19+
+ "======= QQ Group: 532944625 =======\n"
20+
+ "====================================================\n\n";
21+
22+
System.out.print(usage);
23+
System.out.flush();
24+
25+
OPTIONS.addOption("n", "name", true, "License name[default: 侠骨留香]");
26+
OPTIONS.addOption("o", "org", true, "License organization[default: ChinaPYG]");
27+
OPTIONS.addOption("h", "help", false, "Print help message");
28+
29+
try {
30+
CommandLine command = new DefaultParser().parse(OPTIONS, args);
31+
runCommand(command);
32+
} catch (ParseException e) {
33+
printUsage();
34+
}
35+
}
36+
37+
private static void printUsage() {
38+
String selfPath = Usage.class.getProtectionDomain().getCodeSource().getLocation().getPath();
39+
40+
System.out.print("KeyGen ");
41+
HelpFormatter formatter = new HelpFormatter();
42+
formatter.printHelp("java -jar " + selfPath, OPTIONS, true);
43+
44+
System.out.println("\n================================================================================");
45+
System.out.println("\n# Crack agent usage: append -javaagent arg to dbvis.vmoptions.");
46+
System.out.println("# Example(-javaagent arg): \n");
47+
System.out.println(" -javaagent:" + selfPath);
48+
System.out.println("\n# Then start your DbVisualizer.\n");
49+
50+
System.exit(1);
51+
}
52+
53+
private static void runCommand(CommandLine commandLine) {
54+
if (commandLine.hasOption("h")) {
55+
printUsage();
56+
return;
57+
}
58+
59+
String licenseName = commandLine.hasOption("n") ? commandLine.getOptionValue("n") : DEFAULT_LICENSE_NAME;
60+
String licenseOrg = commandLine.hasOption("o") ? commandLine.getOptionValue("o") : DEFAULT_LICENSE_ORG;
61+
62+
try {
63+
String license = KeyGen.generateLicense(licenseName, licenseOrg);
64+
65+
System.out.println("Your license key(Don't copy this line!!!): \n");
66+
System.out.println(license);
67+
System.out.println();
68+
} catch (Exception e) {
69+
e.printStackTrace();
70+
}
71+
72+
System.out.flush();
73+
}
74+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package site.xiaguliuxiang.crack.dbvisualizer.agent;
2+
3+
import java.lang.instrument.Instrumentation;
4+
5+
/**
6+
7+
* @date 2019-09-09 20:00:00
8+
*/
9+
public class Agent {
10+
public static void premain(String agentArgs, Instrumentation inst) {
11+
try {
12+
inst.addTransformer(new KeyTransformer());
13+
} catch (Exception e) {
14+
throw new RuntimeException(e);
15+
}
16+
}
17+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package site.xiaguliuxiang.crack.dbvisualizer.agent;
2+
3+
import javassist.ClassPool;
4+
import javassist.CtClass;
5+
import javassist.CtConstructor;
6+
import javassist.CtField;
7+
8+
import java.io.ByteArrayInputStream;
9+
import java.lang.instrument.ClassFileTransformer;
10+
import java.lang.instrument.IllegalClassFormatException;
11+
import java.security.ProtectionDomain;
12+
13+
/**
14+
15+
* @date 2019-09-09 20:00:00
16+
*/
17+
public class KeyTransformer implements ClassFileTransformer {
18+
private static final String ENCODED_KEY_SPEC = "java/security/spec/EncodedKeySpec";
19+
20+
private static final String RAW_KEY = "MIIBtzCCASwGByqGSM44BAEwggEfAoGBAP1/U4EddRIpUt9KnC7s5Of2EbdSPO9EAMMeP4C2USZpRV1AIlH7WT2NWPq/xfW6MPbLm1Vs14E7gB00b/JmYLdrmVClpJ+f6AR7ECLCT7up1/63xhv4O1fnxqimFQ8E+4P208UewwI1VBNaFpEy9nXzrith1yrv8iIDGZ3RSAHHAhUAl2BQjxUjC8yykrmCouuEC/BYHPUCgYEA9+GghdabPd7LvKtcNrhXuXmUr7v6OuqC+VdMCz0HgmdRWVeOutRZT+ZxBxCBgLRJFnEj6EwoFhO3zwkyjMim4TwWeotUfI0o4KOuHiuzpnWRbqN/C/ohNWLx+2J6ASQ7zKTxvqhRkImog9/hWuWfBpKLZl6Ae1UlZAFMO/7PSSoDgYQAAoGAJzCKYi3W8LGq0Dw10OB1H/ICqJ6MKs4KJYABa/rWus1wy4umHQn0s6Il764yTyFi34ft+kJau5NmG0pYw2hfCMS94TXnoruoxnovjstnpabpb9GIDOppAa7YxCxU5qZXW8gbrTz2EnTHXXv00WbYbClpOfda3T7rXlRlENqPtVo=";
21+
private static final String XIAGULIUXINAG_KEY = "MIIBtzCCASwGByqGSM44BAEwggEfAoGBAP1/U4EddRIpUt9KnC7s5Of2EbdSPO9EAMMeP4C2USZpRV1AIlH7WT2NWPq/xfW6MPbLm1Vs14E7gB00b/JmYLdrmVClpJ+f6AR7ECLCT7up1/63xhv4O1fnxqimFQ8E+4P208UewwI1VBNaFpEy9nXzrith1yrv8iIDGZ3RSAHHAhUAl2BQjxUjC8yykrmCouuEC/BYHPUCgYEA9+GghdabPd7LvKtcNrhXuXmUr7v6OuqC+VdMCz0HgmdRWVeOutRZT+ZxBxCBgLRJFnEj6EwoFhO3zwkyjMim4TwWeotUfI0o4KOuHiuzpnWRbqN/C/ohNWLx+2J6ASQ7zKTxvqhRkImog9/hWuWfBpKLZl6Ae1UlZAFMO/7PSSoDgYQAAoGAZkR/ADfOBvyfKSmpiMnjzd2xeSSIy5lUVp6DU5UPmdOJejc8wHsS8lBW2fBN5mJHxXDVI3DHe0WEyK7C3iqwNp13+NiXSJyTE1Ek5IuaQ7QjUd8oQ+epZ6HjgTmwaC5pePlDxDxDjsvcsPy32IzV2Nm7DHH03asV0lF0gqI+Ees=";
22+
23+
@Override
24+
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined,
25+
ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
26+
if (className == null) {
27+
return classfileBuffer;
28+
}
29+
30+
if (className.equals(ENCODED_KEY_SPEC)) {
31+
return handleKeySpec(classfileBuffer);
32+
}
33+
34+
return classfileBuffer;
35+
}
36+
37+
private byte[] handleKeySpec(byte[] classfileBuffer) throws IllegalClassFormatException {
38+
try {
39+
String b64f;
40+
ClassPool classPool = ClassPool.getDefault();
41+
CtClass ctClass = classPool.makeClass(new ByteArrayInputStream(classfileBuffer));
42+
43+
classPool.importPackage("java.util.Arrays");
44+
try {
45+
Class.forName("java.util.Base64");
46+
classPool.importPackage("java.util.Base64");
47+
b64f = "Base64.getDecoder().decode";
48+
} catch (ClassNotFoundException e) {
49+
try {
50+
Class.forName("javax.xml.bind.DatatypeConverter");
51+
classPool.importPackage("javax.xml.bind.DatatypeConverter");
52+
b64f = "DatatypeConverter.parseBase64Binary";
53+
} catch (ClassNotFoundException ex) {
54+
throw new RuntimeException(ex);
55+
}
56+
}
57+
58+
ctClass.addField(
59+
CtField.make("private static final byte[] __h_ok=" + b64f + "(\"" + RAW_KEY + "\");", ctClass));
60+
ctClass.addField(
61+
CtField.make("private static final byte[] __h_nk=" + b64f + "(\"" + XIAGULIUXINAG_KEY + "\");",
62+
ctClass));
63+
CtConstructor ctConstructor = ctClass.getConstructor("([B)V");
64+
ctConstructor.insertBefore("if(Arrays.equals($1,__h_ok)){$1=__h_nk;}");
65+
66+
return ctClass.toBytecode();
67+
} catch (Exception e) {
68+
throw new IllegalClassFormatException(e.getMessage());
69+
}
70+
}
71+
}

0 commit comments

Comments
 (0)