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.
- Supports multiple mapping formats:
SRG/XSRGCSRG/TSRGTSRG v2ProGuardTiny v1Tiny v2
- Automatic format detection based on file content
- Remap
.classfiles from obfuscated to deobfuscated names using mappings - Works in Node.js and browser environments
npm install java-remapperimport { 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.TINY2import { parseMappings, MappingFormat } from "java-remapper";
const mappingsContent = "..."; // Mapping file content
const mappings = parseMappings(MappingFormat.TINY2, mappingsContent);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);import { MappingSet } from "java-remapper";Detects the mapping format from content.
Parses a mapping file into a MappingSet.
Remaps a Java .class file byte array using the given mappings.
- This library only remaps Java class files, not full JARs. To handle JARs, extract
.classfiles, remap them individually, and repackage. - Ensure mappings and class files match the same version of obfuscation/deobfuscation.
This project is licensed under the MIT License.