Classpy is a GUI tool for investigating Java class file, Lua binary chunk, Wasm binary code, and other binary file formats.

Overview

Classpy

Classpy is a GUI tool for investigating Java class file, Lua binary chunk, Wasm binary code, and other binary file formats.

Inspiration

This tool is mainly inspired by javap and JavaClassViewer. I reinvent the wheel for the following two reasons:

1. Learn Java class file format and bytecode through parsing it
2. Try JavaFX 8

Features

  • Understands class files described by JVMS9
  • Supports Lua 5.3 binary chunk format
  • Supports Wasm binary format
  • Supports Bitcoin raw block and transaction format
  • Displays parsed binary file as tree and hex text
  • The corresponding hex text is highlighted when you select a tree node

Quick Start

Just for macos with brew

  • Install
brew tap guxingke/repo && brew install classpy
  • Try
    • open default gui window
    classpy
    • open gui window with args
    HelloWorld.java $JAVA_HOME/bin/javac HelloWorld.java classpy HelloWorld.class">
    echo "public class HelloWorld { public static void main(String[] args) { System.out.println(\"Hello World\"); } }" > HelloWorld.java
    $JAVA_HOME/bin/javac HelloWorld.java
    
    classpy HelloWorld.class

Requirements

Java 15 (checkout branch java8 if you stuck on Java 8)

Build

cd path/to/classpy
./gradlew fatJar
# java -jar path/to/classpy/classpy-gui/build/libs/classpy-fat-jar-0.10.0.jar

Run

cd path/to/classpy
./gradlew run

Screenshots

Screenshot1 Screenshot2 Screenshot3 Screenshot4

Comments
  • brew安装报错

    brew安装报错

    执行 brew tap guxingke/repo && brew install classpy

    Error: classpy: /usr/local/Homebrew/Library/Taps/guxingke/homebrew-repo/Formula/classpy.rb:10:@8' is not allowed as an instance variable name /usr/local/Homebrew/Library/Taps/guxingke/homebrew-repo/Formula/classpy.rb:10: syntax error, unexpected end-of-input, expecting end depends_on :openjdk@8 `

    1. brew doctor 检查没有错误
    2. 系统版本11.5.1
    opened by zexho994 5
  • Not working on macOS

    Not working on macOS

    brew tap guxingke/repo && brew install classpy

    $ java --version
    java 15.0.1 2020-10-20
    Java(TM) SE Runtime Environment (build 15.0.1+9-18)
    Java HotSpot(TM) 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)
    
    $ classpy hello.class
    Error: Could not find or load main class com.github.zxh.classpy.gui.ClasspyApp
    Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
    
    opened by Stxr 3
  • 对Class文件中的Long类型解析错误

    对Class文件中的Long类型解析错误

    如题,Java源码如下所示:

    package jvmgo.book.ch03;
    
    public class ClassFileTest {
        
        public static final boolean FLAG = true;
        public static final byte BYTE = 123;
        public static final char X = 'X';
        public static final short SHORT = 12345;
        public static final int INT = 123456789;
        public static final long LONG = 12345678901L;
        public static final float PI = 3.14f;
        public static final double E = 2.71828;
        
        public static void main(String[] args) throws RuntimeException {
            System.out.println("Hello, World!");
        }
        
    }
    

    对于其中的public static final long LONG = 12345678901L;进行解析是,在常量池中,这个12345678901L解析出现错误。错误截图如下所示: Snipaste_2020-05-04_17-28-36 javap -v的结果如下所示: Snipaste_2020-05-04_17-30-20

    opened by MrBear2018 3
  • Can't read jar file when there are spaces in path

    Can't read jar file when there are spaces in path

    当读取的jar包的路径中包含空格时,会读取失败

    loading file:/C:/Program%20Files/Java/jre1.8.0_121/lib/rt.jar...
    java.nio.file.FileSystemNotFoundException: C:\Program%20Files\Java\jre1.8.0_121\lib\rt.jar
    	at com.sun.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:120)
    	at com.sun.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:117)
    	at java.nio.file.FileSystems.newFileSystem(FileSystems.java:326)
    	at java.nio.file.FileSystems.newFileSystem(FileSystems.java:276)
    	at com.github.zxh.classpy.gui.jar.JarTreeLoader.load(JarTreeLoader.java:15)
    

    改动后可以读取了,不确定是否是个bug,以下是java版本

    $ java -version
    java version "1.8.0_121"
    Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
    
    opened by hgaol 1
  • Parsing failure when the class file size is too large

    Parsing failure when the class file size is too large

    In my Mac(JDK 1.8.0_40), InputStream.read(byte[]) read 8192 bytes at most. When the class file size is greater than 8192 bytes, it will get parsing failure.

    opened by c19354837 1
  • compile failed

    compile failed

     ./gradlew fatJar
    Downloading https://services.gradle.org/distributions/gradle-6.7-bin.zip
    .........10%..........20%..........30%..........40%..........50%.........60%..........70%..........80%..........90%..........100%
    
    Welcome to Gradle 6.7!
    
    Here are the highlights of this release:
     - File system watching is ready for production use
     - Declare the version of Java your build requires
     - Java 15 support
    
    For more details see https://docs.gradle.org/6.7/release-notes.html
    
    Starting a Gradle Daemon (subsequent builds will be faster)
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    java.lang.UnsupportedClassVersionError: org/openjfx/gradle/JavaFXPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
    > org/openjfx/gradle/JavaFXPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 40s
    
    
    opened by lengyijun 0
  • Menu font displayed incorrectly built by source

    Menu font displayed incorrectly built by source

    Java Environment

    openjdk 15.0.2 2021-01-19
    OpenJDK Runtime Environment Corretto-15.0.2.7.1 (build 15.0.2+7)
    OpenJDK 64-Bit Server VM Corretto-15.0.2.7.1 (build 15.0.2+7, mixed mode, sharing)
    

    After following the command to build and run

    cd path/to/classpy
    ./gradlew fatJar
    
    ./gradlew run 
    

    The GUI menu font not displayed correctly. image

    Seems like the font style is not set, after I set the scene style in ClasspyApp.java, it works.

            scene.getRoot().setStyle("-fx-font-family: 'serif'");
    
    opened by YuanHao97 0
  • 修复打开 module-info.class 失败的问题

    修复打开 module-info.class 失败的问题

    根据 jvms §4.7.25 对于 requires_version_index 的描述,当不存在依赖项版本信息时,requires_version_index 的值为 0。 classpy 目前总是试图在常量池中以 requires_version_index 为索引获取版本信息,这导致打开绝大多数 module-info.class 文件时都会产生 NullPointerException,这个 pr 修复了这个问题。

    opened by Glavo 0
  • [fix bug] use '((long) high_bytes << 32) + low_bytes' to calculate bits

    [fix bug] use '((long) high_bytes << 32) + low_bytes' to calculate bits

    According tojvmS8 4.4.5. The CONSTANT_Long_info and CONSTANT_Double_info Structures

    We need to use '((long) high_bytes << 32) + low_bytes' to calculate 'bits'.

    But for right now, the project is using '((long) high_bytes << 32) | low_bytes':

    ConstantLongInfo.java:

        @Override
        protected String loadDesc(ConstantPool cp) {
            long high = super.getUInt("high_bytes");
            long low = super.getUInt("low_bytes") & 0xffffffffL;
            long l = high << 32 | low;
            return String.valueOf(l);
        }
    

    ConstantDoubleInfo.java:

        @Override
        protected String loadDesc(ConstantPool cp) {
            long high = super.getUInt("high_bytes");
            long low = super.getUInt("low_bytes") & 0xffffffffL;
            double d = Double.longBitsToDouble(high << 32 | low);
            return String.valueOf(d);
        }
    
    opened by ghost 0
  • Can't work on MacOS.

    Can't work on MacOS.

    When I try Command: brew tap guxingke/repo

    It shows:

    ==> Tapping guxingke/repo Cloning into '/usr/local/Homebrew/Library/Taps/guxingke/homebrew-repo'... remote: Enumerating objects: 44, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (3/3), done. remote: Total 44 (delta 0), reused 2 (delta 0), pack-reused 40 Unpacking objects: 100% (44/44), done. Error: Invalid formula: /usr/local/Homebrew/Library/Taps/guxingke/homebrew-repo/Formula/classpy.rb classpy: /usr/local/Homebrew/Library/Taps/guxingke/homebrew-repo/Formula/classpy.rb:10: `@8' is not allowed as an instance variable name /usr/local/Homebrew/Library/Taps/guxingke/homebrew-repo/Formula/classpy.rb:10: syntax error, unexpected end-of-input, expecting end depends_on :openjdk@8 ^ Error: Cannot tap guxingke/repo: invalid syntax in tap!

    opened by thtTNT 3
Releases(v0.7)
Owner
null
Ethylene is a open-source, lightweight, general-purpose compatibility layer standing between the developer and the chaotic world of configuration file formats.

Ethylene Ethylene is a open-source, lightweight, general-purpose compatibility layer standing between the developer and the chaotic world of configura

Steank 7 Aug 9, 2022
This project uses the artificial potential field method to realize the path planning of the robot, and completes the trajectory optimization through other settings. It can also be combined with laser SLAM, target recognition and other technologies for path planning.

FRCAutoDriver 项目说明 Project Instruction 本项目利用人工势场法,实现机器人的路径规划,并通过其他设置完成轨迹优化,还可以结合激光SLAM、目标识别等技术进行路径规划 This project uses the artificial potential field

ZhangzrJerry 2 Sep 9, 2022
A exploit to remotely check if a chunk is loaded.

InteractCordExploit (NoCom) A exploit to remotely check if a chunk is loaded which has been automated to create heatmaps and find chunks with active p

null 26 Aug 18, 2022
Drifty is an open-source interactive File Downloader system built with java. It is currently available in CLI mode and has the GUI version under active development.

Drifty Drifty is an open-source interactive File Downloader system built using Java. It takes the link to the file, the directory where it needs to be

Saptarshi Sarkar 60 Dec 24, 2022
Bank Statement Analyzer Application that currently runs in terminal with the commands: javac Application.java java Application [file-name].csv GUI coming soon...

Bank Statement Analyzer Application that currently runs in terminal with the commands: javac Application.java java Application [file-name].csv GUI coming soon...

Hayden Hanson 0 May 21, 2022
Java SQL (JDBC) code generator with GUI. SQL and OOP finally united.

jSQL-Gen Java SQL (JDBC) code generator with GUI. SQL and OOP finally united. Usage Install the latest release. Create a database, tables and their co

Osiris-Team 11 Nov 14, 2022
code to the rat i give to people if u want to change the webhook its in "src/main/java/github/quantizr/autogg/guis/gui" please just dont sell my rat :(

SkyblockRat My rats code join my discord! https://discord.gg/bbK6ndHqN6 i got tired of people asking "is it double hooked?!" so here is my rats code y

null 6 Dec 10, 2022
With react-native-update-in-app library you can easily implement in-app updates in your React Native app using CDN or any other file server

React Native In-App update With react-native-update-in-app library you can easily implement in-app updates in your React Native app using CDN or any o

Nepein Andrey 7 Dec 21, 2022
Java agent that enables class reloading in a running JVM

Welcome to Spring-Loaded What is Spring Loaded? Spring Loaded is a JVM agent for reloading class file changes whilst a JVM is running. It transforms c

Spring 2.7k Dec 26, 2022
A manager tool to categorize game assets such as images and sounds/music. The tool enables you to tag these files, so that finding them by tags allows fast searches.

BtAssetManager This application allows you to easily categorize large amounts of image and sound files. You can apply tags to each individual file to

null 21 Sep 15, 2022
Android application made during an introduction class to mobile application development.

Reflex Revolution Android application made during an introduction class to mobile application development. Contributors Hailey Savoie Carter Moore Fre

Frederic Verret 3 Aug 27, 2022
The MeterRegistryHolder class is designed to hold MeterRegistry as a static field.

MeterRegistryHolder The MeterRegistryHolder class is designed to hold MeterRegistry as a static field. Goal The goal is to simplify using MeterRegistr

Tomasz Fijałkowski 4 Sep 20, 2022
Translating texts via Youdao eco-freely in only one class

Youdao4J Translating texts via Youdao Translator by one class. Need GSON. Usage Youdao4J did lots of works in the background. DO NOT create morr Youda

iceBear 8 Dec 11, 2022
1.7 - 1.18 utility class that allows you to change blocks at blazing fast speeds

BlockChanger 1.7 - 1.18 utility class that allows you to change blocks at blazing fast speeds Setup Just import the class to your project. Usage Playe

null 25 Dec 23, 2022
Team 5468's 2022 FRC robot code. This code is written in Java and is based off of WPILib's Java control system and utilizes a command based system

FRC 2022 Team 5468's 2022 FRC robot code. This code is written in Java and is based off of WPILib's Java control system and utilizes a command based s

null 4 Oct 4, 2022
A simple and lightweight Minecraft GUI API for developers to use.

Current Version: 1.0.0 Requirements: - You must be using PaperMC or a fork of it (This will not work with just Spigot/Bukkit! - Curently this API only

Sammy Aknan 2 May 14, 2022
Java GUI Frontend for XCH Forks

ForkFarmer Java GUI Frontend for XCH Forks. Discord: https://discord.gg/Mx9ZNHta Requires JRE 1.8 or greater to run: https://www.java.com/en/download/

null 40 Nov 8, 2022
The Download Manager uses a simple yet effective GUI interface built with java’s Swing libraries

The Download Manager uses a simple yet effective GUI interface built with java’s Swing libraries.The use of Swing gives the interface a crisp, modern look and feel. The GUI maintains a list of downloads that are currently being managed.

Manish Kumar Mahawar 2 Jan 2, 2022
NeverScapeAlone! Instantly match with other players and take the hassle out of finding partners for bosses, minigames, skills, pking, and more!

NeverScapeAlone An Old School RuneScape Matchmaking Plugin on RuneLite! Tired of having to scour friend's chats, discords, and forums to find friends

null 14 Sep 2, 2022