jhoja

The Java disassembler for Jasmin, Decompile protection tool for JD

Last update 24 Mar 2018



What is jhoja?


jhoja is a disassembler for Java class files.
It converts Java class files into Jasmin assembly source code.
It can also insert decompilation protection code using the -g option.
It is a command-line tool.
No graphical user interface is provided.
Based on SWAG javap2 Ver 1.02.
forked from SWAG javap2. http://www.swag.uwaterloo.ca/javap2/

Known limitations


Reassembly supports ASCII-only source files.
(Without comments.)
Other character encodings are not supported.
jhoja can output UTF-8 strings.
However, Jasmin does not support UTF-8.
Converting the UTF-8 source to a local character encoding may allow it to work on that system.
However, cross-platform compatibility may be lost.
The decompilation protection function is intended for the JD-GUI decompiler.
It does not support the Jad decompiler.

Download


Download jhoja Ver 1.01 for Windows. (including source patch.)
Download from GitHub. (including patched source.)

How does jhoja differ from javap and SWAG javap2?


jhoja supports Jasmin assembly source output.
It also provides a decompilation protection function.
These features are not supported by Oracle javap or SWAG javap2.
jhoja outputs UTF-8 text.
SWAG javap2 does not support UTF-8.

Decompilation protection


The decompilation protection function is intended for the JD-GUI decompiler.
It does not support the Jad decompiler.
The protection does not affect execution speed.
However, the resulting class file is larger than usual.
Additional protection code is inserted.
Requires Jasmin (Java assembler) and a JRE or JDK.
This protection is not strong.
The protection can be bypassed relatively easily with jhoja and Jasmin.

Examples: Decompile jhoja decompile protection class file by JD-GUI Decompiler.
Decompile jhoja decompile protection file by JD-GUI
Decompile jhoja decompile protection file by JD-GUI

Debug information


Debug information can be read in the source comments.
However, reassembling the file causes the debug information in the class file to be lost.

Supported operating systems


The provided binary runs on Microsoft Windows.
Compiled with C++ Builder XE8.
Written in C++, but mostly C-style code.
It may work on other operating systems if recompiled.
The Windows version may run on GNU/Linux (Intel/AMD) using Wine.

Binary License


Apache v2 license
(follow the SWAG's license.)

jhoja ver 1.01 Source patch License


Apache v2 license
(follow the SWAG's license.)
chenged 2-clause BSD license to Apache v2 licence.
(C) Masaki Oba
admin@nabeta.tk
http://www.nabeta.tk

Example: excerpt of disassembled code


.field hizuke_str Ljava/lang/String;
.field moto_gatsu I
.field moto_nen I
.field static properties Ljava/util/Properties;
.field static menubarheight I

.method private static resizeframe(II)V

    .limit stack 6
    .limit locals 20

    getstatic asucalendar/menubarheight I
    istore 18
    iload_0
    iconst_2
    iadd
    istore 16
    iload_0
    iload_1
    if_icmple Z18
    iload_1
    istore 16
    ;.line 101
Z18:
    iload 16
    i2f
    f2d
    ldc2_w 0.200000
    dmul
    d2i
    istore 17
    iload 17
    bipush 40
    if_icmplt Z43
    iload_0
    sipush 300
    if_icmpge Z47
    ;.line 103
Z43:
    bipush 40
    istore 17
    ;.line 106
Z47:
    getstatic asucalendar/bbb Ljavax/swing/JPanel;
    iconst_0
    iload 18
    iload_0
    iconst_1
    isub
    iload 17
    iload 18
    iadd
    iconst_1
    isub
    invokevirtual javax/swing/JPanel/setBounds(IIII)V
    getstatic asucalendar/tugi Ljavax/swing/JButton;
    iload_0
    iconst_1
    isub
    bipush 65
    isub
    iconst_1
    bipush 30
    bipush 19
    invokevirtual javax/swing/JButton/setBounds(IIII)V
    getstatic asucalendar/tugi_nen Ljavax/swing/JButton;
    iload_0
    iconst_1
    isub
    bipush 30
    isub
    iconst_1
    bipush 30
    bipush 19
    invokevirtual javax/swing/JButton/setBounds(IIII)V
    getstatic asucalendar/lb Ljavax/swing/JLabel;
    iconst_1
    bipush 12
    iload_0
    iconst_1
    isub
    iload 17
    iconst_1
    isub
    invokevirtual javax/swing/JLabel/setBounds(IIII)V
    getstatic asucalendar/dp Ljavax/swing/JPanel;
    iconst_0
    iload 18
    iload 17
    iadd
    iload_0
    iconst_1
    iadd
    iload_1
    iload 18
    isub
    iload 17
    isub
    iconst_1
    iadd
    invokevirtual javax/swing/JPanel/setBounds(IIII)V
    iload 17
    bipush 40
    if_icmpgt Z164
    iload 17
    bipush 20
    isub
    i2f
    f2d
    ldc2_w 0.700000
    dmul
    d2i
    istore 10
    goto Z178
    ;.line 115
Z164:
    iload 17
    bipush 20
    isub
    i2f
    f2d
    ldc2_w 0.600000
    dmul

Usage


Usage: jhoja [-g] [-h] xxx.class > xxx.j
-g: Insert decompile protection code.
-h: show help.

Examples:
jhoja -g xxx.class > xxx.j
jhoja xxx.class > xxx.j
jhoja xxx.class | more

Examples using Jasmin


Without decompilation protection:
jhoja xxx.class > xxx.j
java -jar jasmin.jar xxx.j

With decompilation protection:
jhoja -g xxx.class > xxx.j
java -jar jasmin.jar xxx.j

Example: batch file to protect multiple class files


Windows batch file.
Requires Jasmin (Java assembler) and a JRE or JDK.
C:\>zenbu *.class

zenbu.bat
@echo off
for %%f in (%*) do (
jhoja -g %%f > %%f.j
java -jar jasmin.jar %%f.j
)

History


12 Mar 2018 jhoja for Windows Ver 1.0 (binary and source patch)
13 Mar 2018 fixed a HTML file in ZIP file
14 Mar 2018 fixed HTML files in ZIP file
24 Mar 2018 ver 1.01

Online Dictionary site


Online NabetaJisho

Online Dictionary Quiz site


Online NabetaJisho Quiz

Contact


admin@nabeta.tk

Site top