Skip to main content

URL deduplication and normalization tool based on domain and parameter names

Project description

URLF - URL Filter Tool v2.4

 █    █ ██████  █       █████
 █    █ █    █  █       █    
 █    █ █████   █       █████
 █    █ █    █  █       █    
 ██████ █    █  ██████  █    

A powerful Python tool for filtering and deduplicating URLs based on domain and query parameter names.

Python License Version

Created by 0xBobby

🚀 Features

  • Smart Deduplication: Removes duplicate URLs based on domain + parameter names (not values)
  • Parameter Order Agnostic: ?id=1&name=test = ?name=test&id=1
  • Value Independent: ?id=1 = ?id=2 = ?id=999 (all treated as duplicates)
  • High Performance: Multithreaded processing with configurable worker count
  • Memory Efficient: Chunk-based processing for large files
  • Progress Tracking: Real-time progress bar with processing statistics
  • Multiple Output Formats: Plain text, JSON, and detailed reports
  • Comprehensive Statistics: Domain analysis, parameter frequency, and filtering accuracy
  • Colored Output: Beautiful colored terminal output for better readability

📋 Requirements

  • Python 3.8 or higher
  • Required packages (install via pip install -r requirements.txt):
    art
    colorlog
    tqdm
    colorama
    

🛠️ Installation

  1. Clone the repository:

    git clone https://github.com/Boopath1/urlF.git
    cd urlf
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Make it executable:

    chmod +x urlf.py
    

📖 Usage

Basic Usage

python3 urlf.py input.txt output.txt

Advanced Usage

# With verbose output and JSON export
python3 urlf.py input.txt output.txt -v -j

# Generate detailed report with custom thread count
python3 urlf.py input.txt output.txt -r -w 20

# Sequential processing (no multithreading)
python3 urlf.py input.txt output.txt -s

# Full featured run with all options
python3 urlf.py input.txt output.txt -v -j -r -w 15 --debug

Command Line Options

Option Description
-v, --verbose Enable verbose output showing duplicate parameter sets
-j, --json Save output as JSON without prompting
-r, --report Generate a detailed statistics report
-s, --sequential Disable multithreading for sequential processing
-d, --debug Enable debug logging
-w, --workers Number of worker threads (default: 10)
--version Show version information
-h, --help Show help message with usage examples

🔧 How It Works

Deduplication Logic

The tool uses a sophisticated deduplication algorithm:

  1. URL Parsing: Each URL is parsed to extract domain and query parameters
  2. Parameter Name Extraction: Only parameter names are considered, values are ignored
  3. Unique Key Generation: Creates a unique key using (domain, frozenset(parameter_names))
  4. Duplicate Detection: URLs with identical keys are marked as duplicates
  5. First Occurrence Wins: The first URL encountered with a unique key is kept

Example Processing

Input URLs:

https://example.com/page?id=1&name=test
https://example.com/page?name=test&id=1
https://example.com/page?id=2&name=demo
https://google.com/search?q=python
https://google.com/search?q=java
https://google.com/search?query=different
https://facebook.com/profile
https://facebook.com/profile?tab=about

Processing Steps:

✅ https://example.com/page?id=1&name=test     → UNIQUE (domain: example.com, params: {id, name})
❌ https://example.com/page?name=test&id=1     → DUPLICATE (same domain + same params)
❌ https://example.com/page?id=2&name=demo     → DUPLICATE (same domain + same params)
✅ https://google.com/search?q=python          → UNIQUE (domain: google.com, params: {q})
❌ https://google.com/search?q=java            → DUPLICATE (same domain + same params)
✅ https://google.com/search?query=different   → UNIQUE (domain: google.com, params: {query})
✅ https://facebook.com/profile                → UNIQUE (domain: facebook.com, params: {})
✅ https://facebook.com/profile?tab=about      → UNIQUE (domain: facebook.com, params: {tab})

Output:

https://example.com/page?id=1&name=test
https://google.com/search?q=python
https://google.com/search?query=different
https://facebook.com/profile
https://facebook.com/profile?tab=about

📊 Output Files

1. Main Output File (output.txt)

Plain text file containing unique URLs, one per line.

2. JSON Export (output.json)

Structured data with URLs and statistics:

{
    "unique_urls": [
        "https://example.com/page?id=1&name=test",
        "https://google.com/search?q=python"
    ],
    "statistics": {
        "total": 8,
        "unique": 5,
        "duplicates": 2,
        "invalid": 1
    }
}

3. Detailed Report (output_report.txt)

Comprehensive analysis including:

  • Processing statistics
  • Top domains by frequency
  • Most common parameters
  • Filtering accuracy percentage

🔍 Performance

  • Memory Efficient: Processes files in 1000-URL chunks
  • Multithreaded: Uses ThreadPoolExecutor for parallel processing
  • Scalable: Handles files with millions of URLs
  • Progress Tracking: Real-time progress updates with ETA

Benchmarks

File Size URLs Processing Time Memory Usage
1 MB 10K URLs ~2 seconds <50 MB
10 MB 100K URLs ~15 seconds <100 MB
100 MB 1M URLs ~2 minutes <200 MB

🚨 Error Handling

The tool gracefully handles:

  • Invalid URLs: Skipped and counted in statistics
  • Empty files: Warning message with graceful exit
  • Large files: Chunk-based processing prevents memory issues
  • Network interruptions: Ctrl+C handling for clean exit
  • File permissions: Clear error messages for access issues

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

🎉 Acknowledgments

  • Built with ❤️ for the bug bounty and security testing community

Happy Hacking! \(^-^)/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

urlf-2.4.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

urlf-2.4-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file urlf-2.4.tar.gz.

File metadata

  • Download URL: urlf-2.4.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for urlf-2.4.tar.gz
Algorithm Hash digest
SHA256 2a75a68e6b88c56e00ed6c153b7de310d1d30ba918e431b105cfe3b899275719
MD5 a0b230180edefa38751e6e5ae4e235d4
BLAKE2b-256 51aa9efbbee0451a136cc3f7404ad6c83b7536dacb734476d32d35cd2e1999d1

See more details on using hashes here.

File details

Details for the file urlf-2.4-py3-none-any.whl.

File metadata

  • Download URL: urlf-2.4-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for urlf-2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3adbaadfb76da1a8e9c07d1704af589890a8d7d26a7a61c19cd2bbfa8aadaa9a
MD5 ddb735254db5cfabf293141abe1d4092
BLAKE2b-256 74fbb4cd77f584cc07ca1239086a80f19138e7f14f3ba6331c931b8ea5d032b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page