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

Wireshark คืออะไร? เครื่องมือวิเคราะห์แพ็กเก็ตสำหรับ Network Security และ Troubleshooting

Wireshark คืออะไร?

Wireshark เป็น **Network Protocol Analyzer (Packet Analyzer)** โปรแกรม **Open Source ฟรี** ที่ใช้ **จับแพ็กเก็ต (Capture)**, **วิเคราะห์ (Analyze)**, และ **แก้ไขปัญหา (Troubleshoot)** ทราฟฟิกเครือข่ายใน Real-time หรือจากไฟล์บันทึก (PCAP) เดิมชื่อ **Ethereal** พัฒนาโดย Gerald Combs ตั้งแต่ปี 1998

คุณสมบัติหลักของ Wireshark

  • Live Capture: จับแพ็กเก็ตจาก Interface (Ethernet, Wi-Fi, Loopback, Bluetooth, USB, dll.)
  • Deep Inspection: ถอดรหัส 3,000+ โปรโตคอล (HTTP, TLS, DNS, DHCP, SMB, QUIC, dll.)
  • Display Filters: กรองข้อมูลด้วย Syntax ที่ทรงพลัง (เช่น http.request.method == "POST", tcp.port == 443)
  • Coloring Rules: ไฮไลต์แพ็กเก็ตตามเงื่อนไข (Error = แดง, DNS = เขียว)
  • Statistics & Graphs: I/O Graphs, Flow Graphs, Conversations, Endpoints, Protocol Hierarchy
  • Export/Import: PCAPNG, PCAP, CSV, JSON, XML, Plain Text
  • Decryption: ถอดรหัส TLS/SSL (ถ้ามี Session Key), WEP/WPA/WPA2 (ถ้ามี PSK)
  • Cross-platform: Windows, macOS, Linux, UNIX, FreeBSD

4 การใช้งานหลัก (Four Main Uses)

  1. Network Troubleshooting: หาสาเหตุ Slow, Timeout, Retransmission, Packet Loss
  2. Security Analysis: ตรวจจับ Malware C2, Data Exfiltration, Brute-force, Reconnaissance
  3. QA/Testing: Verify โปรโตคอล/แอปทำงานถูกต้อง (VoIP, Video Streaming, Custom Protocol)
  4. Protocol Development/Debugging: Developer Debug Implementation

Wireshark ในมุมมอง Security (Security Perspective)

จุดแข็ง

  • มองเห็น "ความจริง" ของทราฟฟิก (Ground Truth)
  • Detect Anomalies: Port Scanning, DNS Tunneling, Clear-text Credentials, Suspicious User-Agent
  • Forensics: สืบสวนเหตุการณ์หลังเกิด (PCAP Analysis)
  • Threat Hunting: หา IOCs, Malware Traffic Patterns

ข้อจำกัด/ความเสี่ยง

  • ❌ **ไม่ใช่ IDS/IPS** (ไม่บล็อก/ป้องกัน Real-time เอง)
  • ❌ **Encrypted Traffic (TLS 1.3)** มองไม่เห็นเนื้อหา (ต้องมี Key Log หรือ MITM Proxy)
  • ❌ **Volume ใหญ่** Capture ได้ไม่หมด (Dropped Packets) - ต้องใช้ Capture Filter
  • ⚠️ **Legal/Ethical:** จับแพ็กเก็ตเครือข่ายที่ไม่ได้รับอนุญาต **อาจผิดกฎหมาย** (Wiretap Laws)
  • ⚠️ **Password Sniffing:** ดู Password ได้เฉพาะ Clear-text (HTTP, FTP, Telnet, POP3, IMAP ไม่ใช่ HTTPS/SSH)

คำสั่ง/ฟิลเตอร์ที่น่าสนใจ (Useful Filters)

วัตถุประสงค์Display Filter
HTTP Request/Responsehttp
DNS Query/Responsedns
TCP Retransmissiontcp.analysis.retransmission
TCP SYN (Connection Attempt)tcp.flags.syn == 1 and tcp.flags.ack == 0
Clear-text Password (HTTP Basic/FTP/Telnet)http.authbasic or ftp.request.arg.password or telnet.data contains "pass"
TLS Handshaketls.handshake
ICMP (Ping/Traceroute)icmp
Specific IPip.addr == 192.168.1.100

การติดตั้ง Wireshark บน Linux (Ubuntu/Debian/Kali)

sudo apt update
sudo apt install wireshark
# ระหว่างติดตั้ง จะถาม "Allow non-superusers to capture packets?" เลือก Yes
sudo usermod -aG wireshark $USER
# Logout/Login ใหม่ หรือ reboot

คำถามที่พบบ่อย (FAQ)

Wireshark เป็น Security Tool หรือ Monitoring Tool?

**เป็นทั้งคู่** แต่หลักคือ **Analysis/Troubleshooting Tool** ไม่ใช่ Real-time Prevention Tool (IDS/IPS)

แฮกเกอร์ใช้ Wireshark จริงไหม?

**ใช่** Ethical Hacker/Red Teamer ใช้มาก แต่มาเลเซียร์ (Black Hat) ก็ใช้เช่นกัน เพื่อ Sniff Credentials, Mapping Network

Wireshark ขโมยรหัสผ่านได้จริงไหม?

**ได้เฉพาะโปรโตคอลที่ไม่เข้ารหัส** (HTTP, FTP, Telnet, SMTP, POP3, IMAP, SNMPv1/v2) **ไม่ได้** กับ HTTPS, SSH, SFTP, TLS 1.2/1.3

Wireshark ผิดกฎหมายไหม?

**ตัวโปรแกรมไม่ผิดกฎหมาย** แต่ **การใช้งาน** อาจผิด: จับแพ็กเก็ตเครือข่ายที่ไม่ได้เป็นเจ้าของ/ไม่ได้รับอนุญาต = ผิด Computer Crime Act / Wiretap Law

Wireshark เห็นทราฟฟิกทั้งเครือข่ายได้ไหม?

**ได้เฉพาะทราฟฟิกที่ผ่าน Interface ของเครื่องที่รัน Wireshark** (Promiscuous Mode + Managed Switch ต้อง config Port Mirroring/SPAN)