Giter Site home page Giter Site logo

brainhub24 / proguard-assembler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from guardsquare/proguard-assembler

0.0 0.0 0.0 200 KB

Assembler and disassembler for Java class files

License: Apache License 2.0

Shell 0.29% Java 99.57% Batchfile 0.14%

proguard-assembler's Introduction

Assembler and Disassembler for Java class files

The ProGuard Assembler and Disassembler can assemble and disassemble Java class files.

The disassembler takes class files and converts them to readable jbc (Java ByteCode) files, following the ProGuard Assembly Language specification.

The assembler does the opposite; it takes readable jbc files and converts them to class files.

Usage

The program is distributed as a single executable jar file that serves both as an assembler and as a disassembler. When the program detects a jbc file as input, it assembles it. Vice versa, when it detects a class file, it disassembles it. It can handle any combination of both; a jar file containing both jbc files and class files will have its jbc files assembled in the output and its class files disassembled in the output.

bin/assembler [<classpath>] <input> <output>

The input and the output can be .class/.jbc/.jar/.jmod files or directories, where .jbc files contain disassembled Java bytecode.

The classpath (with runtime classes and library classes) is only necessary for preverifying assembled code.

Example

As a small test, you can let the program disassemble itself:

bin/assembler lib/assembler.jar disassembled

The program will create a disassembled directory with readable files disassembled from the input jar. You can then let the program assemble the assembly files again:

bin/assembler /usr/lib/jvm/java-12-oracle/jmods/java.base.jmod disassembled assembled.jar

The program will now create an assembled.jar file with reassembled class files. It will use the jmod file as a run-time library to properly preverify the code.

Preverification

The ProGuard Assembly Language contains some syntactic sugar, notably for the StackMap and StackMapTable attributes. As of Java version 7, each Code attribute must contain a StackMapTable attribute. Since it would be very cumbersome to write these attributes by hand, the assembler automatically preverifies every method using the ProGuard preverifier, and creates the StackMapTable using the preverification info. As a consequence, the assembler needs to know the location of any library jars when assembling class files.

Downloads

The code is written in Java, so it requires a Java Runtime Environment (JRE 1.8 or higher).

You can download the assembler and disassembler in various forms:

Building

If you've downloaded the source code, you can build it with Gradle:

./gradlew clean assemble

Once built, you can run the assembler and disassembler with the script bin/assembler.sh or bin/assembler.bat.

Contributing

The ProGuard Assembler and Disassembler are build on the ProGuardCORE library.

Contributions, issues and feature requests are welcome in both projects. Feel free to check the issues page and the contributing guide if you would like to contribute.

License

The ProGuard Assembler and Disassembler are distributed under the terms of the Apache License Version 2.0.

Enjoy!

Copyright (c) 2002-2020 Guardsquare NV

proguard-assembler's People

Contributors

ericlafortune avatar mrjameshamilton avatar ericsalemi-gs avatar ericsalemi avatar rover12421 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.