WiresharkPCAPNetworkPacket Analysis

Wireshark

Network packet analyzer. Capture dan analisis traffic — dari investigasi C2 sampai rekonstruksi file dari HTTP.

25 min read2026-04-09

1. Apa itu Wireshark?

Wireshark adalah network packet analyzer paling populer di dunia. Open source, cross-platform, dan dipakai oleh SOC analyst, network engineer, sampai malware researcher. Use case utama di SOC: • Investigasi C2 (Command & Control) communication • Deteksi data exfiltration • Credential sniffing (cleartext password) • Malware traffic analysis • Network forensics & incident response • Troubleshooting jaringan Wireshark punya GUI yang powerful, tapi juga ada tshark — versi CLI-nya yang bisa dipakai di server tanpa GUI. Keduanya saling melengkapi: capture di server pakai tshark, analisis mendalam di workstation pakai Wireshark.


2. Install (Linux)

bash
# Install Wireshark + tshark
sudo apt update && sudo apt install wireshark tshark -y

# Allow non-root capture
sudo usermod -aG wireshark $USER

# Logout & login kembali, lalu verifikasi
wireshark --version
tshark --version

Setelah install, tambahkan user ke group wireshark agar bisa capture tanpa root. Logout dan login kembali agar perubahan group berlaku.


3. Capture Traffic

  1. 1

    Buka Wireshark

    Jalankan Wireshark. Di halaman awal, kamu akan melihat daftar network interface yang tersedia.

  2. 2

    Pilih Interface

    Pilih interface yang ingin di-capture (eth0, wlan0, any). Interface dengan grafik aktivitas menunjukkan ada traffic.

  3. 3

    Set Capture Filter (Opsional)

    Masukkan capture filter di field sebelum start. Contoh: 'host 192.168.1.100' atau 'port 80'. Ini mengurangi ukuran file capture.

  4. 4

    Start Capture

    Klik tombol Start (ikon sirip hiu biru) atau double-click interface. Paket akan mulai muncul secara real-time.

  5. 5

    Reproduce Activity

    Lakukan aktivitas yang ingin di-capture: buka website, jalankan malware di sandbox, trigger alert.

  6. 6

    Stop & Save

    Klik Stop (ikon kotak merah). Save sebagai .pcapng (File > Save As). Format pcapng lebih kaya metadata dari pcap.


4. Capture Filter ≠ Display Filter

Capture Filter diterapkan SAAT capture (BPF syntax, contoh: 'host 10.0.0.1'). Paket yang tidak match TIDAK akan disimpan — tidak bisa di-undo. Display Filter diterapkan SETELAH capture (syntax Wireshark, contoh: 'ip.addr == 10.0.0.1'). Semua paket tetap tersimpan, filter hanya menyembunyikan yang tidak match. Tips: Kalau tidak yakin, capture semua dulu (tanpa capture filter), lalu filter pakai display filter.


5. Capture Filters (BPF Syntax)

bash
# Host tertentu
host 192.168.1.100

# Port tertentu
port 80
port 443
port 53

# Network range
net 192.168.1.0/24

# Protocol
tcp
udp
icmp

# Kombinasi
host 192.168.1.100 and port 443
not port 22
tcp and not port 22 and not port 3389
host 10.0.0.5 and (port 80 or port 443)

Capture filter menggunakan BPF (Berkeley Packet Filter) syntax. Lebih terbatas dari display filter, tapi efisien karena filtering di level kernel.


6. Display Filters — Protocol

bash
# Protocol dasar
http
dns
tcp
udp
tls
smb
icmp
arp
ftp
ssh

# Negasi — semua kecuali ARP dan DNS
!(arp or dns)

# Hanya traffic terenkripsi
tls

Display filter paling sederhana: ketik nama protocol. Wireshark akan menampilkan hanya paket protocol tersebut.


7. Display Filters — IP, Port, HTTP, DNS

bash
# IP Address
ip.addr == 192.168.1.100
ip.src == 10.0.0.5
ip.dst == 8.8.8.8

# Port
tcp.port == 80
tcp.dstport == 443
udp.port == 53

# HTTP
http.request.method == "GET"
http.request.method == "POST"
http.response.code == 200
http.host contains "evil"
http.request.uri contains "login"

# DNS
dns.qry.name contains "malware"
dns.qry.type == 1
dns.flags.response == 0

# Kombinasi
ip.addr == 192.168.1.100 and tcp.port == 80
http.request.method == "POST" and ip.dst == 10.0.0.5
dns.qry.name contains "suspicious" and ip.src == 192.168.1.0/24

Display filter Wireshark sangat powerful. Bisa filter berdasarkan field spesifik di setiap layer protocol.


8. Display Filters — TCP Analysis & TLS

bash
# TCP Flags
tcp.flags.syn == 1 and tcp.flags.ack == 0    # SYN scan
tcp.flags.rst == 1                             # Reset connections

# TCP Analysis
tcp.analysis.retransmission                    # Retransmissions
tcp.analysis.zero_window                       # Zero window
tcp.analysis.duplicate_ack                     # Duplicate ACKs

# TLS
tls.handshake.type == 1                        # Client Hello
tls.handshake.type == 2                        # Server Hello
tls.handshake.extensions_server_name contains "evil"

Filter TCP analysis berguna untuk troubleshooting dan deteksi scanning. Filter TLS berguna untuk melihat SNI (Server Name Indication) tanpa decrypt.


9. Kombinasi Powerful

bash
# Traffic dari internal ke external non-HTTP/HTTPS
ip.src == 192.168.0.0/16 and !(ip.dst == 192.168.0.0/16) and !(tcp.dstport == 80 or tcp.dstport == 443)

# POST ke IP tanpa domain (suspicious C2)
http.request.method == "POST" and http.host matches "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$"

# DNS query panjang (possible tunneling)
dns.qry.name.len > 50

# Frame contains string tertentu
frame contains "password"
frame contains "cmd.exe"
frame contains "powershell"

Kombinasi filter ini sering dipakai untuk threat hunting. Cari anomali: traffic non-standard, komunikasi ke IP langsung, DNS panjang, atau string mencurigakan.


10. Teknik Analisis

Follow Stream

Klik kanan paket > Follow > TCP/HTTP Stream. Melihat seluruh conversation antara client dan server dalam format readable. Sangat berguna untuk melihat HTTP request/response, command C2, atau data exfil.

Export Objects

File > Export Objects > HTTP/SMB/TFTP. Ekstrak file yang ditransfer dalam traffic: malware binary, dokumen, gambar. Langkah penting dalam malware traffic analysis.

Statistics > Conversations

Melihat semua conversation (IP pairs) beserta jumlah bytes dan paket. Cari conversation dengan bytes terbesar — bisa jadi data exfiltration.

Protocol Hierarchy

Statistics > Protocol Hierarchy. Overview protocol apa saja yang ada di capture. Kalau ada protocol aneh (IRC, non-standard port), investigasi lebih lanjut.

Expert Info

Analyze > Expert Information. Wireshark otomatis mendeteksi anomali: retransmission, malformed packets, connection resets. Shortcut untuk menemukan masalah.

Coloring Rules

View > Coloring Rules. Buat custom color untuk traffic tertentu. Contoh: merah untuk traffic ke known-bad IP, kuning untuk DNS query panjang.


11. Hunting: C2 Beaconing

bash
# Cari HTTP beaconing — POST reguler ke IP/domain yang sama
http.request.method == "POST"

# Cari koneksi ke port non-standard
tcp.dstport > 1024 and !(tcp.dstport == 8080 or tcp.dstport == 8443)

# DNS beaconing — query berulang ke domain yang sama
dns.qry.name contains "beacon"

# TLS ke IP tanpa SNI (suspicious)
tls.handshake.type == 1 and !(tls.handshake.extensions_server_name)

# Long-lived connections (C2 keep-alive)
tcp.time_delta > 0 and tcp.len > 0

C2 beaconing biasanya punya pola: interval reguler, POST request, koneksi ke IP/domain yang sama. Di Wireshark, gunakan Statistics > Conversations untuk melihat koneksi terlama.


12. Hunting: DNS Tunneling & Data Exfil

bash
# DNS Tunneling — query sangat panjang
dns.qry.name.len > 50

# DNS TXT record (sering dipakai tunneling)
dns.qry.type == 16

# HTTP POST dengan body besar (data exfil)
http.request.method == "POST" and http.content_length > 10000

# Upload ke cloud storage
http.host contains "drive.google" or http.host contains "dropbox" or http.host contains "mega.nz"

# FTP data transfer
ftp-data

DNS tunneling menggunakan DNS query/response untuk mengirim data. Ciri khas: subdomain sangat panjang, banyak TXT record, query volume tinggi ke satu domain.


13. Hunting: Cleartext Credentials & Suspicious TLS

bash
# HTTP Basic Auth (base64 encoded credentials)
http.authbasic

# FTP credentials
ftp.request.command == "USER" or ftp.request.command == "PASS"

# String "password" di traffic
frame contains "password"
frame contains "passwd"
frame contains "login"

# Self-signed certificates
tls.handshake.type == 11 and x509af.validity.notBefore

# Expired certificates
tls.handshake.type == 11

Cleartext credentials di jaringan = masalah serius. HTTP Basic Auth, FTP, Telnet mengirim password tanpa enkripsi. Self-signed cert bisa indikasi C2 atau MITM.


14. tshark — CLI Mode

bash
# Capture traffic
tshark -i eth0 -w capture.pcap

# Read pcap dengan filter
tshark -r capture.pcap -Y "http.request"

# Extract specific fields
tshark -r capture.pcap -Y "dns" -T fields -e dns.qry.name -e ip.src

# Top DNS queries
tshark -r capture.pcap -Y "dns.flags.response == 0" -T fields -e dns.qry.name | sort | uniq -c | sort -rn | head -20

# Top HTTP URLs
tshark -r capture.pcap -Y "http.request" -T fields -e http.host -e http.request.uri | head -20

# Unique User-Agents
tshark -r capture.pcap -Y "http.user_agent" -T fields -e http.user_agent | sort -u

# TCP connections summary
tshark -r capture.pcap -q -z conv,tcp

# Export HTTP objects
tshark -r capture.pcap --export-objects http,./exported_files

tshark adalah Wireshark versi CLI. Sangat berguna untuk automasi, scripting, dan analisis di server tanpa GUI. Output bisa di-pipe ke tools lain (awk, sort, grep).


15. Resources

  • Wireshark Display Filter Reference

    wiki.wireshark.org/DisplayFilters — referensi lengkap semua display filter

  • tshark Manual

    wireshark.org/docs/man-pages/tshark.html — dokumentasi lengkap tshark CLI

  • Malware Traffic Analysis

    malware-traffic-analysis.net — PCAP samples dari malware traffic nyata untuk latihan

  • Public PCAP Repository

    netresec.com/?page=PcapFiles — koleksi PCAP publik untuk berbagai skenario

  • Unit42 Wireshark Tutorials

    unit42.paloaltonetworks.com — tutorial Wireshark dari Palo Alto Unit42 untuk analisis malware traffic