Skip to content
/ anot Public

Filter strings from a file - prepared for bb hunting scoping syntax

Notifications You must be signed in to change notification settings

hasshido/anot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

anot

Add Not - Anew but not. Remove lines from files, with a little bit of extra logic for your comfort. Perfect for bug bounty scope management and data filtering.

Tool inspired by anew from @tomnomnom.

🚀 Features

  • 🎯 Exact string matching: Remove specific lines from files
  • 🌐 Wildcard domain support: *.example.com removes subdomains but preserves base domains
  • 📍 IP address filtering: Remove specific IP addresses
  • 🌍 CIDR range support: Remove entire IP ranges with CIDR notation
  • ⚡ High performance: Optimized for large files with pre-compiled patterns

📖 Quick Examples

Basic Usage

# Remove lines from scope.txt that match patterns in oos.txt
cat oos.txt | anot scope.txt

# Alternative: using anot in the pipeline
cat out-of-scope.txt | anot tool_unfiltered_results.txt | anew aggregate_filtered_results.txt

Domain Wildcards

# Input file (scope.txt)
cloudways.com
test1.customer.cloudways.com
test2.customer.cloudways.com
api.cloudways.com
www.cloudways.com
css-tricks.com

# Patterns to remove (oos.txt)
*.customer.cloudways.com
css-tricks.com

# Result
cloudways.com
api.cloudways.com
www.cloudways.com

IP and CIDR Range Filtering

# Remove specific IP and entire ranges
echo -e "10.0.0.1\n192.168.1.0/24\n*.internal.com" | anot targets.txt

🛠️ Installation

Download Binary

Download the latest release for your platform from GitHub Releases.

Build from Source

git clone https://github.com/hasshido/anot
cd anot
go build -o anot .

Go Install

go install github.com/hasshido/anot@latest

📋 Usage

Command Line Options

anot [options] <filename>

Options:

  • -d : Dry-run mode - Show filtered output without modifying the file
  • -q : Quiet mode - Update file silently (no stdout output)
  • -t : Trim mode - Trim whitespace before comparison

Pattern Types

1. Exact Matches

Remove lines that exactly match the input:

echo "example.com" | anot targets.txt

2. Wildcard Domains

Use *.domain.com to remove subdomains but preserve the base domain:

# *.example.com removes:
# - sub.example.com ✅
# - deep.sub.example.com ✅  
# - example.com ❌ (preserved)
echo "*.example.com" | anot scope.txt

3. IP Addresses

Remove specific IP addresses:

echo "192.168.1.100" | anot targets.txt

4. CIDR Ranges

Remove entire IP ranges using CIDR notation:

# Remove all IPs in the 10.0.0.0/8 range
echo "10.0.0.0/8" | anot targets.txt

# IPv6 is also supported
echo "2001:db8::/32" | anot targets.txt

⚡ Performance

anot is optimized for large files:

  • Pre-compiled CIDR matchers for faster IP range checking
  • Single-pass IP parsing to minimize overhead
  • Smart pattern routing to avoid unnecessary comparisons
  • Efficient I/O buffering for large files

Benchmarks show processing of 20,000+ lines in under 100ms.

Pipeline Integration

# Chain with other tools
subfinder -d example.com | anot -d scope.txt | httpx

🤝 Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

📄 License

This project is licensed under the MIT License.

About

Filter strings from a file - prepared for bb hunting scoping syntax

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages