Skip to content

Commit 7187c34

Browse files
committed
Create demo LicenceCrack
1 parent 5727d49 commit 7187c34

16 files changed

Lines changed: 316 additions & 0 deletions

File tree

6.JavaAgent/LicenceCrack/.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

6.JavaAgent/LicenceCrack/.idea/compiler.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

6.JavaAgent/LicenceCrack/.idea/inspectionProfiles/Project_Default.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

6.JavaAgent/LicenceCrack/.idea/jarRepositories.xml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

6.JavaAgent/LicenceCrack/.idea/libraries/BuyFlag.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

6.JavaAgent/LicenceCrack/.idea/libraries/BuyFlag__2_.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

6.JavaAgent/LicenceCrack/.idea/libraries/BuyFlag__3_.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

6.JavaAgent/LicenceCrack/.idea/misc.xml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

6.JavaAgent/LicenceCrack/pom.xml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>org.example</groupId>
8+
<artifactId>LicenceCrack</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<packaging>jar</packaging>
11+
12+
<properties>
13+
<maven.compiler.source>8</maven.compiler.source>
14+
<maven.compiler.target>8</maven.compiler.target>
15+
</properties>
16+
<dependencies>
17+
<dependency>
18+
<groupId>com.sunn</groupId>
19+
<artifactId>tools</artifactId>
20+
<version>1.8.0</version>
21+
<scope>system</scope>
22+
<systemPath>D:/JDKV/jdk8u301/lib/tools.jar</systemPath>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.javassist</groupId>
26+
<artifactId>javassist</artifactId>
27+
<version>3.21.0-GA</version>
28+
</dependency>
29+
30+
31+
</dependencies>
32+
<build>
33+
34+
<pluginManagement>
35+
<plugins>
36+
<plugin>
37+
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-jar-plugin</artifactId>
40+
<version>2.2</version>
41+
<configuration>
42+
<archive>
43+
<manifestEntries>
44+
<!--改这个为代理类-->
45+
<Main-Class>MyAgent</Main-Class>
46+
<Agent-Class>MyAgent</Agent-Class>
47+
<Can-Redefine-Classes>true</Can-Redefine-Classes>
48+
<Can-Retransform-Classes>true</Can-Retransform-Classes>
49+
</manifestEntries>
50+
</archive>
51+
<skip>true</skip>
52+
</configuration>
53+
</plugin>
54+
</plugins>
55+
</pluginManagement>
56+
</build>
57+
</project>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import java.text.ParseException;
2+
import java.text.SimpleDateFormat;
3+
import java.util.Date;
4+
import java.util.concurrent.TimeUnit;
5+
6+
7+
public class CrackLicenseTest {
8+
9+
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
10+
11+
private static boolean checkExpiry(String expireDate) {
12+
try {
13+
Date date = DATE_FORMAT.parse(expireDate);
14+
15+
if (new Date().before(date)) {
16+
return false;
17+
}
18+
} catch (ParseException e) {
19+
e.printStackTrace();
20+
}
21+
22+
return true;
23+
}
24+
25+
public static void main(String[] args) {
26+
final String expireDate = "2020-10-01 00:00:00";
27+
28+
new Thread(new Runnable() {
29+
@Override
30+
public void run() {
31+
while (true) {
32+
try {
33+
String time = "[" + DATE_FORMAT.format(new Date()) + "] ";
34+
35+
if (checkExpiry(expireDate)) {
36+
System.err.println(time + "Your license has expired, please purchase a new license!");
37+
} else {
38+
System.out.println(time + "Your authorization is normal and the deadline is:" + expireDate);
39+
System.out.println("Cracked successfully:flag{jvavAg1ent1sVe@r1zy}");
40+
}
41+
42+
TimeUnit.SECONDS.sleep(5);
43+
} catch (InterruptedException e) {
44+
e.printStackTrace();
45+
}
46+
}
47+
}
48+
}).start();
49+
}
50+
51+
}

0 commit comments

Comments
 (0)