New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

java-remapper

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

java-remapper

A JavaScript tool for remapping Java classes.

latest
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

🔖 java-remapper

A lightweight JavaScript/TypeScript tool for parsing and applying Java class mappings. It supports multiple mapping formats and allows remapping of Java .class files in the browser or Node.js.

Features

  • Supports multiple mapping formats:
    • SRG/XSRG
    • CSRG/TSRG
    • TSRG v2
    • ProGuard
    • Tiny v1
    • Tiny v2
  • Automatic format detection based on file content
  • Remap .class files from obfuscated to deobfuscated names using mappings
  • Works in Node.js and browser environments

Installation

npm install java-remapper

Usage

1. Detect mapping format

import { detectMappingFormat } from "java-remapper";

const content = `
tiny\t2\t0\tnamed
c\texample/ClassName\tcom/example/MyClass
`;
const format = detectMappingFormat(content);
console.log(format); // Output: MappingFormat.TINY2

2. Parse mappings

import { parseMappings, MappingFormat } from "java-remapper";

const mappingsContent = "..."; // Mapping file content
const mappings = parseMappings(MappingFormat.TINY2, mappingsContent);

3. Remap .class files

import { remap } from "java-remapper";
import fs from "fs";

const classBytes = fs.readFileSync("Example.class");
const newBytes = await remap(classBytes, mappings);
fs.writeFileSync("ExampleRemapped.class", newBytes);

4. Types

import { MappingSet } from "java-remapper";

🛠 API

detectMappingFormat(content: string): MappingFormat | null

Detects the mapping format from content.

parseMappings(format: MappingFormat, content: string): MappingSet

Parses a mapping file into a MappingSet.

remap(b: Uint8Array, mappings: MappingSet): Promise<Uint8Array>

Remaps a Java .class file byte array using the given mappings.

Notes

  • This library only remaps Java class files, not full JARs. To handle JARs, extract .class files, remap them individually, and repackage.
  • Ensure mappings and class files match the same version of obfuscation/deobfuscation.

License

This project is licensed under the MIT License.

Keywords

remapper

FAQs

Package last updated on 28 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts