General Introduction
Humanify is an open source tool, hosted on GitHub and created by developer Jesse Luoto, designed to help programmers quickly decrypt and beautify obfuscated JavaScript code using artificial intelligence techniques. It integrates ChatGPT and native language models that can transform hard-to-read compressed code into a clear and understandable format for reverse engineering, code review, or learning analytics. The project supports multiple modes of operation, including through the OpenAI API, the Google Gemini or local models, providing a high degree of flexibility. With over 1,700 stars and 75 forks on GitHub since its launch, Humanify has an active community and is suitable for developers working with complex code.
Function List
- Code Anti-Obfuscation: Restore obfuscated JavaScript code to a readable format with AI technology.
- rename a variable: Automatically generate meaningful names for variables and functions in your code.
- Code beautification: Reformat the compressed code to add indentation and line breaks to improve readability.
- Multi-mode support: Support for OpenAI API, Google Gemini API or local model runs.
- command-line operation: Provides a convenient CLI interface for scripted batch processing.
- Open source and free: Fully open source, users are free to download, modify and contribute code.
Using Help
Installation process
Humanify is a Node.js-based tool that requires the relevant environment to be installed first. Here are the detailed installation steps:
1. Preparing the environment
- Installing Node.js: Make sure you have Node.js (recommended version 16 or higher) installed on your computer. You can download and install Node.js from the official Node.js website.
- Installing GitIf you want to clone a repository from GitHub, you need to install Git, which can be downloaded from the Git website.
- Checking the environment: Open a terminal and type
node -v
cap (a poem)npm -v
, confirm that the version number is displayed properly.
2. Download Humanify
- Install globally via npm(Recommended):
npm install -g humanifyjs
Direct end use after installation humanify
Command.
- Cloning source code from GitHub(for developers):
git clone https://github.com/jehna/humanify.git cd humanify npm install
After installing the dependencies, pass the
npm start
Run the project.
3. Configure the API key (optional)
Humanify supports OpenAI and Google Gemini models with configurable API keys:
- OpenAI key::
- Register for an OpenAI account and get an API key.
- Add parameters to the terminal runtime
--apiKey="your-token"
, or set environment variables:export OPENAI_API_KEY="your-token"
- Google Gemini key::
- interviews Google AI Studio Get the key.
- Similarly, the runtime uses
--apiKey="your-token"
, or set environment variables:export GEMINI_API_KEY="your-token"
4. Local model model (optional)
If you don't want to rely on cloud APIs, you can use a local language model:
- mounting
node-llama-cpp
Dependency (already inpackage.json
(listed in). - Add the
--local
Parameters.
How to use
The core function of Humanify is to decrypt and beautify JavaScript code via command line. Below is the detailed operation flow:
basic command
Run Humanify by entering the following command in the terminal:
humanify [mode] [options] input file.js -o output file.js
- paradigm::
openai
(using OpenAI),gemini
(using Google Gemini),local
(local model). - options (as in computer software settings)As
--apiKey
Specify the key.-o
Specifies the output file.
Example 1: Decrypting Code with OpenAI
Suppose you have an obfuscated file obfuscated.js
You want to output to the deobfuscated.js
::
humanify openai --apiKey="sk-xxx" obfuscated.js -o deobfuscated.js
- The program calls the OpenAI API to analyze the code and generate a readable version.
- The results are saved in the
deobfuscated.js
Center.
Example 2: Using a Local Model
If you don't have an API key, use local mode:
humanify local obfuscated.js -o deobfuscated.js
- Make sure that the local model has been configured correctly and the program will handle it automatically.
Example 3: Checking Help Information
Enter the following command to view all options:
humanify --help
- The output includes supported commands, parameters, and usage descriptions.
Main function operation flow
1. Code anti-obfuscation and beautification
- move::
- Prepare obfuscated JavaScript files (e.g.
test.js
). - Run commands, for example:
humanify openai --apiKey="your-token" test.js -o result.js
- Wait for processing to complete (takes seconds to minutes depending on file size and network conditions).
- show (a ticket)
result.js
, view the formatted code.
- Prepare obfuscated JavaScript files (e.g.
- effect: Obfuscated single lines of code are split into multiple lines with more readable variable names.
2. Variable renaming
- move::
- When entering commands, the AI automatically recognizes nonsensical variable names (such as
a
,b
). - Generate a new name based on the context (e.g.
userData
,calculateSum
). - Check the output file to make sure the variable names are logical.
- When entering commands, the AI automatically recognizes nonsensical variable names (such as
- take note of: If the results are not satisfactory, try to adjust the model parameters (e.g.
temperature
) or change modes.
3. Handling of large documents
- move::
- For large files, it is recommended to process them in segments to avoid API request overruns.
- Split the code into small files and run the commands separately.
- Merge the output results.
- finesse: Use
--verbose
parameter to view detailed logs for debugging purposes.
caveat
- network problem: When using OpenAI or Gemini mode, make sure the network is stable, otherwise you may get errors (e.g.
429 Too Many Requests
). - Dependency Updates: Regular operation
npm update
Update dependencies to avoid version compatibility issues. - Community SupportIf you have a problem, submit feedback on the GitHub Issues page, and the community developers will respond positively.
With the above steps, you can easily get started with Humanify, whether it's decrypting code or optimizing the code-reading experience, you can dramatically improve efficiency.