cevreset 0.4.1
High-performance Instagram password reset sender - Sync (threading) & Async (aiohttp) versions with proxy/user-agent rotation
License: MIT
Requires Python: >=3.8
Keywords: aiohttp, async, high-performance, instagram, password, proxy, recovery, reset, threading

# Cevreset 🚀

**Instagram password reset request sender** - High-performance sync & async versions

[![PyPI version](https://img.shields.io/pypi/v/cevreset.svg)](https://pypi.org/project/cevreset/)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
[![GitHub](https://img.shields.io/badge/GitHub-cevreset-black)](https://github.com/cevpy/cevreset)

---

## ⚡ Features

### Sync Version (Threading)
- ✅ Multi-threaded concurrent requests (6 threads default)
- ✅ Thread isolation with separate session per thread
- ✅ Per-thread CSRF token management
- ✅ Context manager support (`with` statement)
- ✅ Proxy rotating support
- ✅ User-Agent rotation (5+ Android variants)
- ✅ Header diversification (13+ randomized fields)
- ✅ Logging system (DEBUG/INFO/WARNING/ERROR)
- ✅ Ninja mode (silent operation)
- ✅ Optimized timeout (per-request control)

### Async Version (New! ⚡ 3-4x Faster!)
- ✅ **50+ concurrent tasks** (default, configurable 100+)
- ✅ **CSRF token caching** (shared across all tasks)
- ✅ **Full parallel batch processing**
- ✅ aiohttp high-performance HTTP
- ✅ asyncio event loop
- ✅ Connection pooling optimization
- ✅ Semaphore-based concurrency control
- ✅ Same API as sync version (just `await` it!)

---

## 📊 Performance Comparison

| Metric | Sync (Threading) | Async (aiohttp) | Improvement |
|--------|-----------------|-----------------|-------------|
| Single request | 1-2s | 0.5-1s | **2x faster** |
| Batch (6 targets) | 12-15s | 2-4s | **4x faster** |
| Batch (100 targets) | ❌ Impossible | 5-15s | **New Capability** |
| Memory | Baseline | -50% | **Much Better** |
| CPU Usage | Baseline | -70% | **Much Better** |
| Max Concurrent | 6 | 100+ | **16x More** |

**Bottom line:** Use async version for everything! 🚀

---

## 📦 Installation

### Basic (Sync version only)
```bash
pip install cevreset
```

### With Async Support (Recommended ⭐)
```bash
pip install cevreset
```

aiohttp will be installed automatically. Or:
```bash
pip install cevreset aiohttp
```

---

## 🚀 Quick Start

### Async Version (Recommended!)

```python
import asyncio
from cevreset_async import AsyncInstagramResetClient

async def main():
    # Single request
    async with AsyncInstagramResetClient(concurrent=50) as client:
        email = await client.send_reset_request(
            "username",
            ninja=True,                # Silent mode
            extract="contact_point"    # Extract email
        )
        print(email)  # "user@gmail.com" or None
    
    # Batch - fully parallel!
    async with AsyncInstagramResetClient(concurrent=50) as client:
        results = await client.send_reset_requests(
            ["user1", "user2", "user3", ..., "user100"],
            ninja=True,
            extract="contact_point"
        )
        for username, email in results.items():
            print(f"{username}: {email}")

asyncio.run(main())
```

### Sync Version (Threading)

```python
from cevreset import InstagramResetClient

# Basic usage
with InstagramResetClient(threads=6) as client:
    email = client.send_reset_request(
        "username",
        ninja=True,              # Silent mode
        extract="contact_point"  # Extract email
    )
    print(email)  # "user@gmail.com" or None
```

---

## 📖 Common Examples

### Get Email Address

```python
import asyncio
from cevreset_async import AsyncInstagramResetClient

async def get_email():
    async with AsyncInstagramResetClient() as client:
        email = await client.send_reset_request(
            "target_username",
            extract="contact_point",  # Get the email
            ninja=True                # Silent
        )
        if email:
            print(f"Email: {email}")

asyncio.run(get_email())
```

### Process Multiple Targets

```python
import asyncio
from cevreset_async import AsyncInstagramResetClient

async def batch_process():
    targets = ["user1", "user2", "user3", "user4", "user5"]
    
    async with AsyncInstagramResetClient(concurrent=50) as client:
        results = await client.send_reset_requests(
            targets=targets,
            extract="contact_point",
            ninja=True,          # Silent
            verbose=False        # No progress
        )
        
        for username, email in results.items():
            if email:
                print(f"{username}: {email}")

asyncio.run(batch_process())
```

### High-Speed Batch (100+ targets)

```python
import asyncio
from cevreset_async import AsyncInstagramResetClient

async def high_speed():
    # 1000 targets processed concurrently!
    targets = [f"user_{i}" for i in range(1, 1001)]
    
    async with AsyncInstagramResetClient(concurrent=100) as client:
        results = await client.send_reset_requests(
            targets,
            extract="contact_point",
            ninja=True,
            verbose=False
        )
        
        success = sum(1 for v in results.values() if v and v is not False)
        print(f"Success: {success}/{len(targets)}")

asyncio.run(high_speed())
```

### With Proxies

```python
import asyncio
from cevreset_async import AsyncInstagramResetClient

async def with_proxies():
    proxies = [
        "http://proxy1.com:8080",
        "http://proxy2.com:8080",
        "http://proxy3.com:8080",
    ]
    
    async with AsyncInstagramResetClient(proxies=proxies) as client:
        email = await client.send_reset_request(
            "username",
            extract="contact_point"
        )

asyncio.run(with_proxies())
```

---

## 🔧 API Reference

### AsyncInstagramResetClient

```python
from cevreset_async import AsyncInstagramResetClient

# Constructor
client = AsyncInstagramResetClient(
    concurrent=50,          # Concurrent tasks (default: 50, can be 100+)
    timeout=10,             # Overall timeout (default: 10s)
    proxies=None,           # List of proxy URLs
    use_random_agents=True, # Random User-Agents (default: True)
    request_timeout=3       # Per-request timeout (default: 3s)
)

# Use as context manager
async with client:
    pass
```

**Methods:**

```python
# Single request
result = await client.send_reset_request(
    target: str,                    # Username or email
    extract: str | list | None,     # Field to extract
    ninja: bool = False             # Silent mode
)

# Batch requests (fully parallel)
results = await client.send_reset_requests(
    targets: list[str],             # List of targets
    extract: str | list | None,     # Field to extract
    verbose: bool = True,           # Show progress
    ninja: bool = False             # Silent mode
)
```

### InstagramResetClient (Sync version)

```python
from cevreset import InstagramResetClient

# Constructor
client = InstagramResetClient(
    threads=6,              # Thread count (default: 6)
    timeout=12,             # Overall timeout (default: 12s)
    proxies=None,           # List of proxy URLs
    use_random_agents=True, # Random User-Agents
    request_timeout=5       # Per-request timeout (default: 5s)
)

# Use as context manager
with client:
    pass
```

**Methods:**

```python
# Single request
result = client.send_reset_request(
    target: str,                    # Username or email
    extract: str | list | None,     # Field to extract
    delay_before: float = 0,        # Pre-delay (seconds)
    ninja: bool = False             # Silent mode
)

# Batch requests
results = client.send_reset_requests(
    targets: list[str],             # List of targets
    extract: str | list | None,     # Field to extract
    delay_between: float = 5.0,     # Delay between targets
    verbose: bool = True,           # Show progress
    ninja: bool = False             # Silent mode
)
```

### Extract Parameter

Extract specific fields from the response:

```python
# Get email
email = await client.send_reset_request("user", extract="contact_point")
# Returns: "user@gmail.com"

# Get multiple fields
fields = await client.send_reset_request("user", extract=["contact_point", "status"])
# Returns: {"contact_point": "...", "status": "..."}

# Get full response
response = await client.send_reset_request("user", extract=None)
# Returns: {...full JSON...}
```

### Return Values

```python
# Success with extract
email = await client.send_reset_request("user", extract="contact_point", ninja=True)
# Returns: "user@example.com" (if found) or None (if not found)

# Success without extract
response = await client.send_reset_request("user", ninja=True)
# Returns: full response dict (if success) or False (if failed)

# Batch results
results = await client.send_reset_requests(["u1", "u2", "u3"], extract="contact_point")
# Returns: {"u1": "email@example.com", "u2": None, "u3": False}
```

---

## 🎯 Use Cases

### Security Researcher
```python
# Find email addresses for research
targets = ["target1", "target2", "target3"]
async with AsyncInstagramResetClient() as client:
    results = await client.send_reset_requests(targets, extract="contact_point")
```

### Account Recovery
```python
# Find your own account email
async with AsyncInstagramResetClient() as client:
    email = await client.send_reset_request("your_username", extract="contact_point")
```

### Large Scale Processing
```python
# Process thousands of usernames
async with AsyncInstagramResetClient(concurrent=100) as client:
    results = await client.send_reset_requests(huge_list, extract="contact_point")
```

---

## 🔐 Anti-Detection Features

### User-Agent Rotation
5+ different Android device profiles:
- Samsung Galaxy A54
- OnePlus 9 Pro
- Google Pixel 6
- HTC U12+
- Sony Xperia 1

### Header Diversification
13+ randomized headers per request:
- Device ID
- App ID
- Timezone
- Connection type
- Referer
- And more...

### Session Isolation (Sync)
Each thread has its own:
- HTTP session
- CSRF token
- User-Agent
- Headers

### CSRF Token Caching (Async)
All async tasks share same CSRF token (faster!)

---

## ⚠️ Legal Notice

**IMPORTANT**: This tool is for **educational and authorized testing only**.

- ❌ **DO NOT** use for unauthorized account access
- ❌ **DO NOT** violate Instagram's Terms of Service
- ❌ **DO NOT** use to harm others or gain unauthorized access
- ✅ **DO** use only on accounts you own or have permission to test
- ✅ **DO** respect Instagram's rate limits

**Using this tool illegally is a crime.**  
The maintainers are **not responsible** for any misuse.

---

## 🐛 Troubleshooting

### Getting None/False
- Instagram may have already processed the reset
- Email address might be private
- Target account may not exist
- Rate limited (429 responses)

### Connection Errors
- Check your internet connection
- Check if proxies are working
- Instagram might be blocking your IP

### Timeout Issues
- Increase `request_timeout`
- Increase `timeout`
- Check your connection speed

### Enable Logging
```python
import logging
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("cevreset").setLevel(logging.DEBUG)
```

---

## 📈 Version History

- **v0.4.0** - Async version (3-4x faster!) ⚡
- **v0.3.4** - Ninja mode completely silent
- **v0.3.3** - Ninja mode improvements
- **v0.3.2** - Optimized timeout
- **v0.3.0** - Thread isolation + context manager
- **v0.2.1** - Initial stable release

---

## 🤝 Contributing

Contributions are welcome! Please:
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Submit a pull request

---

## 📄 License

MIT - See [LICENSE](LICENSE) for details

---

## 🔗 Links

- **GitHub**: https://github.com/cevpy/cevreset
- **PyPI**: https://pypi.org/project/cevreset/
- **Issues**: https://github.com/cevpy/cevreset/issues

---

**Made with ❤️ by Cev**

⭐ If you find this useful, please star the repository!