Ngôn ngữ lập trình phổ biến trong an ninh mạng
| Ngôn ngữ | Vai trò chính | Ứng dụng điển hình | Độ khó |
|---|---|---|---|
| Python | Swiss Army Knife – scripting, automation, tooling, data analysis | Penetration testing script, malware analysis (pefile, yara), SOC automation (SOAR playbook), threat intel enrichment, CTF crypto, web scraping, API integration | Thấp |
| Go (Golang) | High-performance network tool, concurrent scanning, microservice security | Nmap masscan, nuclei templates, gRPC security tools, Kubernetes admission controller, C2 framework (Sliver), Cloud security tools (Trivy, kubescape) | Trung bình |
| C / C++ | Low-level, memory management, exploit development, reverse engineering | Shellcode, ROP chain, rootkit, driver development, binary exploitation, malware development, high-performance packet processing (DPDK, XDP) | Cao |
| PowerShell | Windows administration, offensive/defensive automation on Windows | Empire/Invoke-Obfuscation (Red Team), KQL hunting, Defender ATP API, Azure AD management, GPO deployment, AMSI bypass research | Trung bình |
| Bash / Shell | Linux/Unix automation, container hardening, log parsing | Hardening script (Lynis, CIS), log analysis (awk, grep, jq), container entrypoint, CI/CD pipeline security gates | Thấp |
| JavaScript / TypeScript | Web application security, Node.js backend, browser exploitation | XSS/CSRF payload, Puppeteer/Playwright automation, Node.js SAST (CodeQL), Electron app audit, browser extension analysis | Trung bình |
| Rust | Memory-safe systems programming, replacement for C/C++ in security tools | Firecracker, AWS Nitro, TigerBeetle, cryptographic libraries (ring, dalek), security tooling (cargo-audit, rustsec) | Cao |
| SQL | Database security, injection testing, log analysis | SQLi payload, privilege audit, sensitive data discovery, SIEM query (KQL, Splunk SPL, Elastic DSL) | Thấp |
| Lua | Embedded scripting in security appliances | WAF rule (ModSecurity, OpenResty), Nmap NSE scripts, Suricata/LuaJIT, Redis Lua sandbox | Thấp |
An ninh mạng có bắt buộc lập trình không?
- Entry-level (SOC L1, Junior Analyst): Không bắt buộc viết code phức tạp. Cần đọc hiểu script, chỉnh sửa playbook, dùng CLI.
- Mid-level (Detection Engineer, Threat Hunter, Pentester): Bắt buộc viết script tự động hóa, tool tùy chỉnh, exploit PoC.
- Senior/Architect/Researcher: Thiết kế hệ thống bảo mật, phát triển công cụ, nghiên cứu lỗ hổng zero-day – cần nắm vững C/C++, Rust, Go, assembly.
Lộ trình học lập trình cho an ninh mạng
- Python cơ bản: Biến, vòng lặp, hàm, file I/O, request, argparse, logging, virtualenv.
- Thực hành mini-project: Port scanner, banner grabber, hash cracker (dictionary), log parser (regex), VirusTotal API automation.
- Bash/Linux CLI: Pipe, redirect, cron, systemd, ssh, tmux, vim.
- PowerShell cơ bản: Cmdlet, pipeline, object, remote session, AMSI/ETW awareness.
- Go/Rust (tùy chọn): Khi cần hiệu năng, concurrency, binary đơn lẻ deploy dễ dàng.
- C/C++ (nếu theo Exploit Dev / Reverse Engineering / Malware Dev): Memory layout, stack/heap, calling convention, debugger (GDB, WinDbG, IDA/Ghidra).
Kết luận
Python là ngôn ngữ #1 cho an ninh mạng hiện đại nhờ hệ sinh thái thư viện khổng lồ (scapy, requests, pwntools, cryptography, pandas, scikit-learn). Go đang lên ngôi cho tooling hiệu năng cao. C/C++ vẫn là vua của exploit development và reverse engineering. Hãy bắt đầu bằng Python + Bash, sau đó mở rộng theo chuyên môn bạn chọn.