Metadata-Version: 2.4
Name: cyinfo
Version: 1.0.0
Summary: A comprehensive network security toolkit — SSL/TLS analysis, certificate inspection, vulnerability scanning, and deep HTTP/TLS probing via pycurl.
Author: sripa
Project-URL: Homepage, https://github.com/sripa/cyinfo
Project-URL: Documentation, https://github.com/sripa/cyinfo#readme
Project-URL: Repository, https://github.com/sripa/cyinfo
Project-URL: Issues, https://github.com/sripa/cyinfo/issues
Keywords: cybersecurity,ssl,tls,certificate,scanner,vulnerability,network,pycurl,security,pentest
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: System :: Networking
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28.0
Requires-Dist: dnspython>=2.3.0
Requires-Dist: pyOpenSSL>=23.0.0
Requires-Dist: pycurl>=7.45.0
Provides-Extra: jks
Requires-Dist: pyjks>=20.0.0; extra == "jks"
Provides-Extra: all
Requires-Dist: pyjks>=20.0.0; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: build>=0.10; extra == "dev"
Requires-Dist: twine>=4.0; extra == "dev"

# CyInfo

A comprehensive Python network security toolkit for SSL/TLS analysis, certificate inspection, vulnerability scanning, and deep HTTP/TLS probing.

[![PyPI version](https://badge.fury.io/py/cyinfo.svg)](https://pypi.org/project/cyinfo/)
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

---

## Features

### 🔍 Network Scanner (`cyinfo.scanner`)
Three-tier scanning with increasing depth:

| Level | Method | What it does |
|-------|--------|-------------|
| **Basic** | `basic_scan(target)` | IP resolution, DNS records (A/AAAA/MX/NS/TXT/CNAME/SOA), geolocation, HTTP status, reverse DNS |
| **Medium** | `medium_scan(target)` | SSL certificate details, TLS version, cipher suite, security headers grading, port scan with banner grabbing |
| **Advanced** | `advanced_scan(target)` | SSL handshake breakdown, encryption algorithms, PFS analysis, full certificate chain via pyOpenSSL |
| **Full** | `full_scan(target)` | Runs all three levels |

### 🔐 Certificate Analyzer (`cyinfo.cert_analyzer`)
Deep certificate and keystore inspection:

- **`analyze_certificate(path)`** — Parse any cert format (PEM, DER, CRT, CER, P7B). Extracts: type/usage, subject, issuer, dates, fingerprints (SHA-256/SHA-1/MD5), crypto suite, key usage, SANs, extensions, and more.
- **`analyze_keystore(path, password)`** — Parse PKCS12/PFX and JKS keystores. Extracts private key info, certificate chain, and all cert details.
- **`test_ssl_with_private_key(key, cert, port)`** — Bind a private key to a socket and test all TLS versions with 20-field handshake detail extraction.

### 🌐 PyCurl Inspector (`cyinfo.pycurl_inspector`)
Low-level HTTP/TLS analysis using only pycurl — **17 parameters tested**:

TLS handshake • Certificate chain & fingerprints • TLS version probing (1.0–1.3) • HTTP response & timing breakdown • HTTP/2 & HTTP/3/QUIC detection • Redirect chain tracing • Compression support • Cookie inspection • Security headers (10 checks) • Server/CDN/WAF fingerprinting • SSH banner & key exchange • Keep-alive behavior

---

## Installation

> [!IMPORTANT]
> Please ensure you are using a **64-bit version of Python**. If you attempt to install on 32-bit Python, the installation will be blocked.

```bash
pip install cyinfo
```

With JKS keystore support:
```bash
pip install cyinfo[jks]
```

For development:
```bash
pip install cyinfo[dev]
```

---

## Quick Start

### Python API

```python
from cyinfo import basic_scan, medium_scan, advanced_scan

# Level 1 — Basic recon
result = basic_scan("example.com")
print(result['ip_info']['resolved_ip'])
print(result['geolocation']['country'])

# Level 2 — Medium analysis
result = medium_scan("example.com")
print(result['ssl_tls_info']['tls_version'])
print(result['security_headers_analysis']['grade'])

# Level 3 — Advanced SSL deep dive
result = advanced_scan("example.com")
print(result['encryption_details']['key_exchange'])
print(result['forward_secrecy']['supported'])
```

```python
from cyinfo import analyze_certificate, analyze_keystore

# Analyze any certificate
cert = analyze_certificate("server.crt")
print(cert['certificates'][0]['validity']['days_remaining'])

# Parse a PKCS12 keystore
ks = analyze_keystore("keystore.p12", "password123")
print(ks['private_key_info']['bits'])
```

```python
from cyinfo import pycurl_deep_inspect

# Full 17-parameter inspection
result = pycurl_deep_inspect("https://example.com")
print(result['4_tls_version_support']['supported_versions'])
print(result['13_security_headers']['grade'])
print(result['15_ssh_info']['banner'])
```

### CLI

```bash
# Interactive scanner
cyinfo scan

# Quick commands
cyinfo scan --target example.com --level basic
cyinfo scan --target example.com --level full
cyinfo cert --file server.crt
cyinfo inspect --url https://example.com
```

---

## Project Structure

```
cyinfo/
├── pyproject.toml          # Package metadata & dependencies
├── README.md
├── LICENSE
├── src/
│   └── cyinfo/
│       ├── __init__.py     # Public API exports
│       ├── cli.py          # CLI entry point
│       ├── scanner.py      # 3-tier network scanner
│       ├── cert_analyzer.py # Certificate & keystore analyzer
│       └── pycurl_inspector.py # PyCurl deep inspector
└── tests/
    ├── __init__.py
    └── test_basic.py
```

---

## Requirements

- **Python 3.9+ (64-bit strictly required)**
- `requests` — HTTP requests
- `dnspython` — DNS resolution
- `pyOpenSSL` — Certificate chain analysis
- `pycurl` — Low-level HTTP/TLS probing

> [!WARNING]
> **64-bit Python Required:** Because this toolkit relies on advanced cryptographic libraries (`cryptography`, `twofish`), **you must use a 64-bit version of Python**. 32-bit Python will fail to install due to missing pre-compiled binaries.

---

## License

MIT License — see [LICENSE](LICENSE) for details.
