Skip to main content

Сетевая кастрюля — TLS, HTTP, DNS, WebSocket, WHOIS, сканер, прокси 🍲

Project description

🍲 kastrula v0.2.0

Сетевая кастрюля — Python-библиотека для работы с сетью.

pip install kastrula

Модули

Модуль Описание
tls Сертификаты, JA3, JARM, cipher enum, handshake
http HTTP/2 клиент с браузерными профилями, сессии, retry
dns Резолвер, DoH, DoT, кэш, zone transfer
scan TCP/UDP порты, баннеры, OS fingerprint, NSE-скрипты
ws WebSocket подключение, сниффинг фреймов
whois WHOIS для доменов и IP
trace Traceroute (UDP/TCP)
proxy Чекер, граббер, валидатор прокси
export Отчёты в JSON/HTML/текст
aio Async-версии всех модулей
cli CLI с субкомандами

Быстрый старт

from kastrula import *

# TLS
cert = grab_cert("google.com")
print(cert.subject, cert.days_left())

probe = TLSProbe("github.com")
info = probe.handshake()
print(info.protocol_version, info.cipher_name)

ciphers = cipher_enum("google.com")
jarm = jarm_fingerprint("google.com")

# HTTP с профилем браузера
with KastClient(profile="chrome_120") as client:
    resp = client.get("https://httpbin.org/ip")
    print(resp.json())

# Сессия с cookies и retry
session = KastSession(profile="firefox_121", retries=3)
session.get("https://example.com/login")
print(session.cookies)

# DNS
ips = resolve("google.com")
records = dns_records("github.com", ["A", "MX", "NS", "TXT"])

# DNS over HTTPS / TLS
ips = doh_resolve("google.com")
ips = dot_resolve("google.com")

# Сканирование
result = port_scan("example.com", ports=[22, 80, 443])
print(result.summary())

udp = udp_scan("192.168.1.1", ports=[53, 123, 161])
os_info = os_fingerprint("example.com")
scripts = run_scripts("example.com", ports=[80, 443])

# WebSocket
with WSClient("wss://echo.websocket.events") as ws:
    ws.send("hello")
    frame = ws.recv()
    print(frame.text)

session = ws_sniff("wss://stream.binance.com:9443/ws/btcusdt@trade", duration=5)

# WHOIS
info = whois("google.com")
print(info.registrar, info.days_until_expiry())
ip_info = ip_whois("8.8.8.8")

# Traceroute
result = tcp_traceroute("google.com", port=443)
print(result.summary())

# Прокси
proxies = grab_proxies()
result = check_proxies(proxies[:50], threads=30)
print(result.summary())

# Экспорт
report = Report("Scan Report", target="example.com")
report.add_section("Ports", scan_result)
report.save_html("report.html")
report.save_json("report.json")

Async

import asyncio
from kastrula.aio import full_recon, multi_resolve

async def main():
    # Полная разведка
    data = await full_recon("example.com")

    # Параллельный резолв
    results = await multi_resolve(["google.com", "github.com", "example.com"])

asyncio.run(main())

CLI

kastrula scan example.com -p 22,80,443 --os --scripts
kastrula tls github.com
kastrula dns google.com --doh https://cloudflare-dns.com/dns-query
kastrula whois example.com
kastrula trace google.com
kastrula http httpbin.org
kastrula proxy grab --check
kastrula proxy check socks5://1.2.3.4:1080
kastrula ws wss://echo.websocket.events --sniff -d 10
kastrula recon example.com

На Pydroid запускай cli.py без аргументов — интерактивный режим.

Зависимости

  • httpx[http2] — HTTP/2
  • cryptography — сертификаты
  • websockets — WebSocket

DNS, scan, whois, trace, proxy — на чистых сокетах.

Лицензия

MIT — KrScript

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

kastrula-0.2.0.tar.gz (43.4 kB view details)

Uploaded Source

Built Distribution

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

kastrula-0.2.0-py3-none-any.whl (48.2 kB view details)

Uploaded Python 3

File details

Details for the file kastrula-0.2.0.tar.gz.

File metadata

  • Download URL: kastrula-0.2.0.tar.gz
  • Upload date:
  • Size: 43.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for kastrula-0.2.0.tar.gz
Algorithm Hash digest
SHA256 56eb16aaade5c6c3b1443e920d69ae07a97f1805863ba8a66172c3012ad13e4a
MD5 88666f45fef94bec810b50d0b97e3cfd
BLAKE2b-256 3d000422a23b5575a4e5725ebb1b6e2a46ca3caaddb9265f4fec5ffb9161f0b6

See more details on using hashes here.

File details

Details for the file kastrula-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: kastrula-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 48.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for kastrula-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9935a412046192f51dd578082b4dcf65064d8332c9e0982ab78be2970e1ffaa5
MD5 fb184b77df16740e2b8d4bf4c87ce77f
BLAKE2b-256 9976d7de5c2765872072d23ca28e31af0f1b0aedbf91ae978f70b938becda130

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