stxp 1.2.0
A tool to capture selected text and send via email
Requires Python: >=3.6

# STXP - Stealth Text Capture and Email Tool

A privacy-focused tool for capturing selected text and sending it via email with enhanced stealth capabilities.

## Features

- **Stealth Operation**: Runs silently in the background with no visible traces
- **Dual Sending Methods**: Support for both direct SMTP and Web POST methods
- **Automatic Cleanup**: Removes all temporary files when exiting
- **Privacy Enhanced**: Uses temporary directories to avoid detection
- **Clipboard Monitoring**: Automatically captures Ctrl+C operations
- **Secure Authentication**: Supports API keys and Bearer tokens

## Installation

```bash
pip install stxp
```

## Quick Start

### 1. Setup Configuration
```bash
stxp --config
```

### 2. Start Monitoring
```bash
stxp
```

### 3. Usage
- Press `Ctrl+C` to capture text from clipboard
- Press `Ctrl+Z` to exit the program

## Configuration Options

### Method 1: Direct SMTP (Traditional)
Configure your email settings directly:
- SMTP Server
- Port
- Email credentials
- Recipient email

### Method 2: Web POST (Recommended)
Configure web service settings:
- Web service URL
- API Key (optional)
- Recipient email

## Web POST Method

The Web POST method provides enhanced security by not storing SMTP credentials on the client side.

### Data Format
```json
{
    "text": "clipboard content",
    "timestamp": "0115_1430",
    "recipient": "user@example.com"
}
```

### Authentication Headers
```http
Authorization: Bearer your-api-key-here
X-API-Key: your-api-key-here
```

## Web Service Requirements

Your web service needs to:

1. **Handle POST requests**: Process JSON formatted data
2. **SMTP Configuration**: Handle SMTP settings on the server side
3. **Authentication**: Validate API keys
4. **Response Format**: Return HTTP 200 for success

### Example Web Service Endpoint
```python
# Flask Example
@app.route('/api/send-email', methods=['POST'])
def send_email():
    data = request.get_json()
    
    # Validate API key
    api_key = request.headers.get('Authorization', '').replace('Bearer ', '')
    if api_key != 'your-api-key-here':
        return jsonify({'error': 'Unauthorized'}), 401
    
    # Send email
    try:
        # Use server-side SMTP settings to send email
        send_email_via_smtp(data['text'], data['recipient'])
        return jsonify({'status': 'success'}), 200
    except Exception as e:
        return jsonify({'error': str(e)}), 500
```

## Command Line Options

```bash
stxp                    # Start listening (stealth mode)
stxp --config          # Setup email configuration
stxp --debug           # Enable debug mode
stxp --help            # Show help information
```

## Security Benefits

### Web POST Method
- No SMTP passwords stored on client
- API keys can be revoked anytime
- Server-side can implement additional security measures
- Supports HTTPS encrypted transmission

### Traditional SMTP
- Maintains original functionality
- Suitable for internal network use
- Direct SMTP connection

## Technical Details

### Dependencies
- `pynput>=1.7.0` - Keyboard monitoring
- `pyperclip>=1.8.0` - Clipboard access
- `requests>=2.25.0` - HTTP requests for Web POST

### Privacy Features
- Uses temporary directories for configuration
- Automatic cleanup of all temporary files
- No persistent file traces
- Silent operation mode

## Development

### Project Structure
```
stxp/
├── __init__.py        # Package initialization
├── main.py           # Main application logic
├── install.py        # Installation utilities
└── test_stxp.py      # Test suite
```

### Building from Source
```bash
git clone <repository>
cd stxp
pip install -e .
```

## License

This project is licensed under the MIT License - see the LICENSE file for details.

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request

## Support

For issues and questions, please open an issue on the GitHub repository.

---

**Note**: This tool is designed for legitimate text capture and email forwarding purposes. Please ensure compliance with local laws and regulations regarding privacy and data protection.