Skip to content

AnonAPI is a lightweight and modular FastAPI-based web service designed to scramble, encrypt, and decrypt text data securely and efficiently. Ideal for developers building anonymization, obfuscation, or text protection tools in applications ranging from testing to privacy-focused deployments.

Notifications You must be signed in to change notification settings

Phoenixcoder-6/AnonAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AnonAPI

AnonAPI is a lightweight and modular FastAPI-based web service designed to scramble, encrypt, and decrypt text data securely and efficiently. Ideal for developers building anonymization, obfuscation, or text protection tools in applications ranging from testing to privacy-focused deployments.

🕵️‍♂️ AnonAPI - Text Scrambler & Decryption Microservice

AnonAPI is a privacy-focused, FastAPI-powered microservice designed for scrambling and unscrambling text data. It allows developers and testers to anonymize sensitive information quickly and securely via a RESTful API. Perfect for use in data masking, testing pipelines, secure logging, or any situation where text obfuscation is required.


Go and Check this Out

http://127.0.0.1:8000/docs#/default/scramble_file_api_scramble_upload_post


🚀 Project Goals

  • ✅ Build a lightweight API to scramble and unscramble sensitive text.
  • ✅ Enable easy integration into any service using simple HTTP endpoints.
  • ✅ Ensure the application is containerized and production-ready using Docker.
  • ✅ Provide flexible text processing with features like: - Character-level scrambling - Word-level scrambling - Sentence-level permutation - Reversible unscrambling (optional, using deterministic methods)

💡 Why AnonAPI?

In many real-world applications, especially in testing or demo environments, exposing real user or sensitive data can violate compliance rules (like GDPR, HIPAA). AnonAPI is designed to:

  • 🛡 Protect real data by obfuscating it
  • 🔁 Reverse scrambling when needed
  • ⚙️ Easily deploy and integrate with other tools
  • 🐳 Run in isolated environments using Docker

🧠 Features

image

🏗 Folder Structure

image

🔠 Supported Scrambling Models

1. Basic Model:

  • Description: Returns the input text as-is, with no modification.

  • Example:

              Input:  Hello World
              Output: Hello World
    

2. Seeded Model:

  • Description: Produces a consistent random shuffling of characters based on a fixed seed value.

  • Example:

       Input:     Hello
       Seed:      42
       Output:    loHel  (consistent for seed=42)
    

3. Caesar Model:

  • Description: Applies a Caesar cipher by shifting each letter by a fixed number of positions in the alphabet.

  • Example:

      Input:     Hello
      Shift:     3
      Output:    Khoor
    

###4. Rot13 Model:

  • Description: A special case of Caesar cipher with a fixed shift of 13.

  • Example:

      Input:     Hello
      Output:    Uryyb
    

5. Reverse Model:

  • Description: Reverses the input string.

  • Example:

      Input:     Hello
      Output:    olleH
    

6. Piglatin Model:

  • Description: Converts English words into Pig Latin.

  • Example:

      Input:     Hello World
      Output:    elloHay orldWay
    

7. Vigenere Model:

  • Description: Applies the Vigenère cipher using a keyword.

  • Example:

      Input:     Hello
      Keyword:   key
      Output:    Rijvs
    

8. Base64 Model:

  • Description: Encodes the input text to Base64 format.

  • Example:

      Input:     Hello
      Output:    SGVsbG8=
    

9. Morse Code Model:

  • Description: Translates text to Morse code.

  • Example:

      Input:     Hello
      Output:    .... . .-.. .-.. ---
    

10. Binary Code Model:

  • Description: Converts each character to its binary (ASCII) representation.

  • Example:

      Input:     Hi
      Output:    01001000 01101001
    

11. leet Model:

  • Description: Converts text to "leet speak" (1337), replacing letters with look-alike numbers or symbols.

  • Example:

      Input:     Hello
      Output:    H3ll0
    

12. Synonym Model:

  • Description: Replaces words with their synonyms using an NLP library like WordNet.

  • Example:

      Input:     Fast runner
      Output:    Quick sprinter
    

13. Emoji Model:

  • Description: Translates words or concepts into emojis when possible.

  • Example:

      Input:     I love pizza
      Output:    I ❤️ 🍕
    

⚙️ Features

  • ✅ Scramble API

    Accepts plain text and scrambles predefined sensitive entities (names, locations, etc.). Returns scrambled version along with mapping key.

  • ✅ Descramble API

    Accepts scrambled text and a mapping key to return the original text. Helpful for reversible anonymization during debugging or controlled testing.

  • ✅ NLTK Support

    Uses NLTK models (e.g., named entity recognition) to identify PII.

  • ✅ Regex-based Fallback

    For cases where NLTK fails, regex-based matching ensures fallback anonymization.

  • ✅ Modular Design

    Code is cleanly separated into modules for app logic, routing, and utility functions.

  • ✅ Dockerized Deployment

    Container-ready for easy deployment using:

      docker build -t fastapi-scrambler .
      docker run -d -p 8000:8000 fastapi-scrambler
    
  • ✅ Test Files Support

    Includes test_files/ folder with sample inputs for local experiments.


🛠️ Installation and Setup

  • Clone the Repo

      git clone https://github.com/your-username/data-scrambler-api.git
      cd data-scrambler-api
    
  • Install Dependencies

      pip install -r requirements.txt
      python nltk_setup.py
    
  • Run Locally

      uvicorn app.main:app --reload
      Visit: http://localhost:8000/docs for Swagger UI.
    
  • 🐳 Run with Docker

      docker build -t fastapi-scrambler .
      docker run -d -p 8000:8000 fastapi-scrambler
    

🧪 Sample Files

Use files inside test_files/ for testing the API endpoints with real-world examples.

🔐 Security & Limitations

  • Only anonymizes named entities (persons, locations, dates).
  • You can extend it to support emails, phone numbers, or custom regex patterns.
  • Key mappings are stored in-memory or passed externally — ensure security in real deployments.

About

AnonAPI is a lightweight and modular FastAPI-based web service designed to scramble, encrypt, and decrypt text data securely and efficiently. Ideal for developers building anonymization, obfuscation, or text protection tools in applications ranging from testing to privacy-focused deployments.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published