Skip to content

Commit 36ef58e

Browse files
author
津崎
committed
ビルドツールを追加
1 parent 964e023 commit 36ef58e

23 files changed

+93
-103
lines changed

MANIFEST.MF

-9
This file was deleted.

README.md

+10-12
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,35 @@ JavaBytecodeChange
55

66
==================
77

8-
手順:
8+
[Usage]
99

10-
通常のコンパイルからデコンパイル
11-
12-
1.コンパイルしてクラスファイル生成
10+
$ mvn package
1311

1412
$ javac Test.java
1513

16-
2.実行結果確認
14+
$ java Test
15+
16+
生成されたclassファイルを難読化
17+
18+
$ java -jar target/JavaBytecodeChange-1.0-SNAPSHOT.jar Test.class Test.class
1719

1820
$ java Test
1921

20-
3.デコンパイラを使ってクラスファイルからソースコードを生成(デコンパイラはjadを使用)
22+
デコンパイラを使ってクラスファイルからソースコードを生成(デコンパイラはjadを使用)
2123

2224
$ ./jad -s java -d out/ -r Test.class
2325

24-
4.ソースコードを生成したディレクトリに移動し再びコンパイルして実行
26+
ソースコードを生成したディレクトリに移動し再びコンパイルして実行
2527

2628
実行結果がデコンパイル前と同じなら元のソースコードとデコンパイル後のソースコードは同じ
2729

2830
==================
31+
License MIT
2932

30-
作成したツールの使い方:
3133

32-
[使い方]
3334

34-
java -jar bytecodechange.jar [変換したいクラスファイル] [変換後のクラスファイル名]
3535

36-
これを手順2~3の間で行い、バイトコード書き換え後の実行結果が書き換え前と一致することを確認する
3736

38-
デコンパイルされたソースコードがコンパイルエラーを起こした場合、元のソースコードとデコンパイル後のソースコードは異なる
3937

4038

4139

Test.java

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
public class Test
44
{
5-
6-
75
public static void main(String args[])
86
{
97
int i;

asm-5.0.3.jar

-52 KB
Binary file not shown.

bytecodechange.jar

-3.47 KB
Binary file not shown.

cfr_0_97.jar

-1.33 MB
Binary file not shown.

pom.xml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>com.example.bytecodetransrator</groupId>
6+
<artifactId>JavaBytecodeChange</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
<packaging>jar</packaging>
9+
10+
<name>JavaBytecodeChange</name>
11+
<url>http://maven.apache.org</url>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>junit</groupId>
20+
<artifactId>junit</artifactId>
21+
<version>3.8.1</version>
22+
<scope>test</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.ow2.asm</groupId>
26+
<artifactId>asm</artifactId>
27+
<version>5.0.2</version>
28+
<scope>compile</scope>
29+
</dependency>
30+
</dependencies>
31+
32+
<build>
33+
<plugins>
34+
<plugin>
35+
<groupId>org.apache.maven.plugins</groupId>
36+
<artifactId>maven-compiler-plugin</artifactId>
37+
<version>3.0</version>
38+
<configuration>
39+
<source>1.8</source>
40+
<target>1.8</target>
41+
<encoding>utf-8</encoding>
42+
</configuration>
43+
</plugin>
44+
45+
<plugin>
46+
<groupId>org.apache.maven.plugins</groupId>
47+
<artifactId>maven-jar-plugin</artifactId>
48+
<version>2.3.1</version>
49+
<configuration>
50+
<archive>
51+
<manifest>
52+
<mainClass>com.example.bytecodetransrator.App</mainClass>
53+
<addClasspath>true</addClasspath>
54+
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
55+
</manifest>
56+
</archive>
57+
</configuration>
58+
</plugin>
59+
<plugin>
60+
<groupId>org.apache.maven.plugins</groupId>
61+
<artifactId>maven-dependency-plugin</artifactId>
62+
<executions>
63+
<execution>
64+
<id>copy-dependencies</id>
65+
<phase>compile</phase>
66+
<goals>
67+
<goal>copy-dependencies</goal>
68+
</goals>
69+
<configuration>
70+
<outputDirectory>${project.build.directory}</outputDirectory>
71+
</configuration>
72+
</execution>
73+
</executions>
74+
</plugin>
75+
</plugins>
76+
</build>
77+
78+
</project>

procyon-decompiler-0.5.25.jar

-1.72 MB
Binary file not shown.
Binary file not shown.

src/main/java/com/example/bytecodetransrator/App.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//classファイルの読み込み、または書き込み
22

3-
package src.main.java.com.example.bytecodetransrator;
3+
package com.example.bytecodetransrator;
44

55
/**
66
* Hello world!
@@ -18,7 +18,7 @@
1818
import org.objectweb.asm.ClassVisitor;
1919
import org.objectweb.asm.ClassWriter;
2020

21-
public class App extends Object{
21+
public class App {
2222
/**
2323
* コンストラクタ
2424
*/
Binary file not shown.

src/main/java/com/example/bytecodetransrator/MyClassVisitor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package src.main.java.com.example.bytecodetransrator;
1+
package com.example.bytecodetransrator;
22

33
import org.objectweb.asm.ClassVisitor;
44
import org.objectweb.asm.MethodVisitor;
Binary file not shown.

src/main/java/com/example/bytecodetransrator/MyMethodVisitor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//命令文の変更
2-
package src.main.java.com.example.bytecodetransrator;
2+
package com.example.bytecodetransrator;
33

44
import org.objectweb.asm.MethodVisitor;
55
import org.objectweb.asm.Opcodes;
Binary file not shown.
Binary file not shown.
Binary file not shown.

target/junit-3.8.1.jar

-118 KB
Binary file not shown.

target/maven-archiver/pom.properties

-5
This file was deleted.

target/surefire-reports/TEST-com.example.bytecodetransrator.AppTest.xml

-66
This file was deleted.

target/surefire-reports/com.example.bytecodetransrator.AppTest.txt

-4
This file was deleted.
Binary file not shown.

usage.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[Usage]
2-
java -jar taget/bytecodeTransrator.jar [変換したいクラスファイル] [変換後のクラスファイル名]
2+
java -jar taget/target/JavaBytecodeChange-1.0-SNAPSHOT.jar [変換したいクラスファイル] [変換後のクラスファイル名]

0 commit comments

Comments
 (0)