8000 GitHub - SimonCalundan/CodeAnonymizer: A powerful command-line tool that anonymizes source code while preserving its structural integrity and logic. CodeAnonymizer automatically replaces variable and method names with generic alternatives, making it ideal for sharing code snippets without exposing sensitive information.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A powerful command-line tool that anonymizes source code while preserving its structural integrity and logic. CodeAnonymizer automatically replaces variable and method names with generic alternatives, making it ideal for sharing code snippets without exposing sensitive information.

License

Notifications You must be signed in to change notification settings

SimonCalundan/CodeAnonymizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeAnonymizer

A command-line tool that anonymizes source code while preserving its structural integrity and logic. CodeAnonymizer replaces variable and method names with generic alternatives, making it ideal for sharing code snippets without exposing sensitive information.

Key Features

  • Smart Variable Anonymization: Replaces variable and method names while maintaining code readability
  • Structure Preservation: Retains the original code structure and logic
  • Multi-Language Support: Compatible with multiple programming languages
  • Terminal Output: Displays anonymized code directly in your terminal
  • Configurable Settings: Flexible options for string literal preservation

Example

Input code:

public class UserService {
    private final DatabaseConnection dbConnection;
    
    public User findUserByEmail(String emailAddress) {
        return dbConnection.queryFirst("SELECT * FROM users WHERE email = ?", emailAddress);
    }
}

Output code:

public class var1 {
    private final var2 var3;

    public var4 var5(String var6) {
        return var3.queryFirst("SELECT * FROM users WHERE email = ?", var6);
    }
}

Installation

  1. Ensure Java 11+ is installed
  2. Install Maven from https://maven.apache.org/download.cgi
  3. Clone and build:
git clone https://github.com/SimonCalundan/CodeAnonymizer.git
cd CodeAnonymizer
mvn clean package

Usage

cd target
java -jar code-anonymizer.jar <file-path> [options]

Options

Option Description Default
--preserve-strings Maintain original string literals true
--preserve-comments Maintain original code comments true

Examples

# Basic usage
java -jar code-anonymizer.jar mycode.java

# Without string preservation
java -jar code-anonymizer.jar mycode.java --preserve-strings=false

# Save output to file
java -jar code-anonymizer.jar mycode.java > anonymized.java

Contributing

Contributions welcome! See Contributing Guidelines.

License

MIT License - see LICENSE.

About

A powerful command-line tool that anonymizes source code while preserving its structural integrity and logic. CodeAnonymizer automatically replaces variable and method names with generic alternatives, making it ideal for sharing code snippets without exposing sensitive information.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0