An application to show binary file internals visually & interactively for the meaning of every bit.
Supported Formats
Sample
- Here is a screen shot opening
java.lang.String.classfile
Download
- Download Application: https://github.com/amosshi/binaryinternals/releases
User guide
- We need the
javacommand to run this tooljava -jar BinaryInternalsViewer-3.7-timestamp.jar- Where
timestampis the auto-generated build timestamp
- Where
- Menu item:
File>Open... - Choose the binary file to view
Web Server and API
- The
BinaryInternalsWebmodule provides the same file view in a web page, and an HTTP API, using the same format plug-ins - Run with Docker, from the repository root
docker build -f BinaryInternalsWeb/Dockerfile -t binaryinternals-web .docker run --rm -p 8080:8080 --read-only --tmpfs /tmp --memory 512m --cpus 1 binaryinternals-web- Open http://localhost:8080
- Run with Docker Compose, from the repository root
docker compose -f BinaryInternalsWeb/docker-compose.yml up -d --build, settings in docker-compose.ymldocker compose -f BinaryInternalsWeb/docker-compose.yml downto stop
- Run without Docker, after
mvn installjava -jar BinaryInternalsWeb/target/BinaryInternalsWeb-3.7.jar- Or, as a Java module:
java -p BinaryInternalsWeb/target/libs:BinaryInternalsWeb/target/BinaryInternalsWeb-3.7.jar -m org.binaryinternals.web/org.binaryinternals.web.WebServer
- API
GET /api/v1/formats- the supported formats and file extensionsPOST /api/v1/parse?name=Foo.class- the request body is the file content, the response is the JSON tree of the filecurl --compressed --data-binary @Foo.class "http://localhost:8080/api/v1/parse?name=Foo.class"- Each node:
{"text": "magic: CAFEBABE", "start": 0, "length": 4, "icon": "Magic", "description": "...", "children": [...]} icon,descriptionandchildrenare left out when absent;descriptionis HTML- Errors:
{"status": 415, "error": "..."}with status400,405,413(too large),415(unsupported type),422(invalid file),503(busy),504(timeout)
GET /health- health check- Uploaded files are only kept in a temporary file during the parsing
- Settings, by environment variables
HOST(default127.0.0.1,0.0.0.0in Docker),PORT(default8080)MAX_UPLOAD_MB(default20),MAX_CONCURRENT_PARSES(default: number of processors),PARSE_TIMEOUT_SECONDS(default30)CORS_ORIGIN(default*, empty to disable)
Build the Source Code
- Prerequisite
- Java Version:
OpenJDK version 11or higher - Set
JAVA_HOMEenvironment variable- If not set use the export statements in the
build.shscript
- If not set use the export statements in the
- Build Tool:
Apache Maven 3.6or higher: because we are using the Maven CI Friendly Versions${revision}feature
- Java Version:
- MacOS need to install the Linux style commands
brew install coreutilsbrew install parallelbrew install graphviz
- Build
./build.sh(Linux/MacOS/Windows Git Bash)build.cmd(Windows CMD)
Structure
- This application does not have 3rd party dependency other than JDK, easy to add it to your existing project
Java Class Viewer
- The original
Java Class Viewerhas been renamed and merged intoBinary Internals Viewersince Apr 2021
The FormatXXXX.jar files can be used in your project when needed.
