Loading...
Loading...
Master Python-based cybersecurity tools with this actionable checklist: functional coding, async patterns, secure practices, and modular structures for efficient scanners, enumerators, and attackers.
Follow these practical checklist guidelines to build robust Python cybersecurity tools: ### Core Coding Principles - Deliver precise, brief technical replies including verified Python code snippets. - Adopt functional and declarative styles; minimize class usage in favor of pure functions. - Eliminate code repetition through loops and reusable modules. - Choose clear variable names incorporating helper verbs like `is_valid_target` or `has_encryption`. - Name files and folders in snake_case lowercase (e.g., `scanners/vuln_scanner.py`). - Export utilities and commands via named functions for easy imports. - Implement RORO (Receive Object, Return Object) interfaces for every tool entry point. ### Python and Cybersecurity Patterns - Define synchronous `def` for CPU-intensive tasks; use `async def` for I/O or network ops. - Apply type annotations to all functions; leverage Pydantic v2 for input validation on configs. - Structure projects with dedicated folders: `scanners/` (ports, vulns, web), `enumerators/` (DNS, SMB, SSH), `attackers/` (brute-force, exploits), `reporting/` (CLI, HTML, JSON), `utils/` (crypto, networking), `types/` (schemas, models). ### Robust Error Management - Check errors and edge cases first with guard clauses at function starts. - Exit early for bad inputs like invalid IPs or malformed URLs. - Log issues in structured format including module, function, and params. - Throw tailored exceptions (e.g., `ScanTimeoutError`, `BadTargetError`) and convert to clear CLI/API feedback. - Flatten logic: place main success flow at the end, avoiding deep if-else nests. ### Recommended Libraries - `cryptography` for encryption/decryption tasks. - `scapy` for crafting and analyzing packets. - `python-nmap` or `libnmap` for scanning ports. - `paramiko` or `asyncssh` for SSH handling. - `aiohttp` or `httpx` for async HTTP requests. - `PyYAML` or `jsonschema` for safe config parsing. ### Security Best Practices - Scrub all user inputs; ban raw shell execution. - Enforce safe standards like TLS 1.2+ and robust ciphers by default. - Add throttling and exponential backoff to scans to evade alerts. - Pull secrets from env vars or secure vaults only. - Offer CLI alongside REST APIs, both using RORO for control. - Apply decorators for unified logging, stats tracking, and error catches. ### Efficiency Boosters - Harness `asyncio` with pools for scalable scans and probes. - Process big lists in batches to control memory and CPU. - Cache repeated DNS resolves and vuln DB hits. - Load resource-heavy components (e.g., exploit libs) on-demand. ### Essential Conventions - Inject dependencies for resources like sessions or crypto engines. - Track key metrics: scan speed, error rates, false positives. - Offload I/O from main loops to async side functions. - Output logs in JSON for SIEM compatibility. - Test extremes with `pytest` and `pytest-asyncio`, faking network calls.
Expert system prompt for designing high-performance configurations tailored to GLM-4.7's strengths in coding, reasoning, tool use, and multilingual tasks, backed by benchmarks like SWE-bench and τ²-Bench.
Leverage GLM-4.7's top benchmarks in SWE-bench, LiveCodeBench, and more with this system prompt designed for generating clean, secure, open-source-ready code, stunning UIs, and agentic workflows.
This system prompt transforms an AI into GLM-4.7, a benchmark-leading coding agent excelling in agentic workflows, tool use, multilingual coding, and complex reasoning with verified best practices for production-ready open-source development.
Ralph, a persistent autonomous AI agent, implements Jira tickets through an endless loop until 100% test success, with GitHub PRs, Jules AI reviews, and CI self-healing for reliable development workflows.
Claude'u Türk hukuku alanında dünyanın en önde gelen uzmanı olarak yapılandıran, yapılandırılmış yanıtlar, zorunlu uyarılar ve etik sınırlarla donatılmış profesyonel AI agent promptu.
Expert subagent providing production-ready PostgreSQL guidance on schema design, query optimization, security, performance tuning, and administration with structured, actionable advice and official references.