Tshark, komut satırıdan çalışan çok esnek bir network sniffer yazılımıdır.Yerel ağınızdaki trafiği izlemek, kaydetmek ve analiz çalışmaları yapmak için linux,windows ve bsd’lerde çalıştırabileceğiniz ender yazılımlardan biridir.
Bu yazıda anlatılanları, yerel ağın tamamını dinleyebileceğiniz yönetilebilir switch’in monitor portu, hub (kaldı mı artık) veya ağ geçidiniz üzerinde denerseniz, yerel ağınızdaki http, ftp ve dhcp kayıtlarını takip edebilir, analiz ve istatistlik için kayıt altına alabilirsiniz.
Tshark kullanım parameteleri için;
coslat@ubuntucuk:~/Masaüstü/network forensic$ tshark -h
TShark 1.2.2
Dump and analyze network traffic.
See http://www.wireshark.org for more information.
Copyright 1998-2009 Gerald Combs <gerald@wireshark.org> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Usage: tshark [options] …
Capture interface:
-i <interface> name or idx of interface (def: first non-loopback)
-f <capture filter> packet filter in libpcap filter syntax
-s <snaplen> packet snapshot length (def: 65535)
-p don’t capture in promiscuous mode
-y <link type> link layer type (def: first appropriate)
-D print list of interfaces and exit
-L print list of link-layer types of iface and exit
Kullanım parametrelerini ve açıklamalarını örnekler üzerinden inceleyelim, gerekli olanlar;
Tüm isim çözme işlemlerini kapatsın,zaman kaybetmeyelim = -nn
eth0 ağ arabirimini dinlesin = -i eth0
HTTP isteklerini yakalamak istiyorum = -R http.request
TCP 80 ve 3128 portlarından akan trafiği analiz etsin = tcp.port == 3128,http
ARP ve DNS isteklerini yakalamakla, sniffer yorulmasın = no arp and port not 53
coslat@ubuntucuk:~/Masaüstü/network forensic$ sudo tshark -nn -i eth0 not arp and port not 53 -d tcp.port==3128,http -R http.request
[sudo] password for coslat:
Running as user “root” and group “root”. This could be dangerous.
Capturing on eth0
4.092491 192.168.5.205 -> 188.124.8.106 HTTP GET / HTTP/1.1
4.776588 192.168.5.205 -> 188.124.8.106 HTTP GET /wp-content/plugins/dynamic-subpages/dynamic-subpages.css?ver=0.50 HTTP/1.1
4.776611 192.168.5.205 -> 188.124.8.106 HTTP GET /wp-includes/js/jquery/jquery.js?ver=1.4.2 HTTP/1.1
7.932276 192.168.5.205 -> 212.175.15.89 HTTP GET /rds/data.asp?1286798927370 HTTP/1.1
7.935070 192.168.5.205 -> 212.175.15.89 HTTP GET /live/v.asp?1286798927370 HTTP/1.1
^C5 packets captured
“Kaynak IP -> Hedef IP HTTP METHOD İstenilen Sayfa” şeklinde çıktı aldık. HOST kısmı nerede ?
Tshark field’larına bakıp, istediğimiz formatta kayıt üretmesini sağlayabiliriz.
İhtiyacımız olan http fields bilgileri, http://www.wireshark.org/docs/dfref/h/http.html adresinde mevcut.
İstediğimiz HTTP kayıt türü;
Paketin zaman bilgisi = -e frame.time
Kaynak IP adresi = -e ip.src
Kaynak MAC adresi = -e eth.src
Hedef IP adresi = -e ip.dst
Hedef PORT numarası= -e tcp.dstport
HTTP HOST adresi = -e http.host
İstenilen URL= -e http.request.uri
HTTP Method = -e http.request.method
Ve bunların arasına birer boşluk bırakarak yaz = -E separator=’ ‘
Read more