Tcpdump เป็นโปรแกรม Protocol Analyzers ได้พัฒนามาตั้งแต่ ค.ศ. 1990 ที่ LawrenceBerkeley National Laboratory โดยถูกใช้สําหรับงานทางด้าน network monitor ซึ่งเป็นเครื่องมือที่วิเคราะห์คุณภาพของเครือข่าย (วิเคราะห์ข้อมูลที่
อยู่บนเครือข่าย) การทํางานของ tcpdumpตัว tcpdump จะไปเปลี่ยนการทํางานของ Interface (Lan Card) ใหัทํางานในลักษณะ promiscuous mode ซึ่งจะคอยรับขัอมูลจากเครือข่ายและสามารถนําข้อมูลเหล่านั้นมาแสดงผลได้หลายวิธี เช่น แสดงผลบน
หน้าจอ (Console) หรือ จะแสดงผลในลักษณะของไฟล์ เพื่อนํากลับมาวิเคราะห์ในภายหลังก็ได้
ตัวอย่าง option ของ tcpdump
– tcpdump -i interface
เลือก interface ที่ tcpdump จะคอยรับข้อมูล ใช้สําหรับเครื่องที่มีหลาย
interface (มี Lan Card หลายใบ)
– tcpdump –n
tcpdump จะไม่พิมพ์ host name ลดการค้นหาชื่อจาก DNS
– tcpdump –l
จะเก็บข้อมูลที่จะแสดงผลไว้ใน buffers ซึ่งสามารถนําข้อมูลเก็บลงไฟล์ได้ ดังนี้
#tcpdump -l | tee “filename”
หรือ
#tcpdump -l > “filename” & tail –f “filename”
– tcpdump –w file
เก็บข้อมูลทั้งหมดลงไฟล์ แทนที่จะแสดงผลทางจอภาพ ซึ่งสามารถนําข้อมูลกลับมา
วิเคราะห์ได้โดยใช้option –r (ด่านล่าง)
– tcpdump –r file
อ่าน้อมูลจากไฟล์ (ที่บันทึกจาก option –w)
– tcpdump –t
ไม่แสดง timestamp
– tcpdump –x
แสดงข้อมูลในรูปเลขฐาน 16 (hex)
– อื่น ๆ ดูจาก man page
#man tcpdump

โปรแกรม Ipsumdump ประกอบด้วย 2 ส่วน
1. ipsumdump เป็นโปรแกรมสำหรับอ่าน IP packet จาก tcpdump หรือ network traffic และ summary โดยอยู่ในรูป
ของ ASCII
2. ipaggcreate เป็นโปรแกรมที่ให้ข้อมลทางสถิติจาก tcpdump ซึ่งข้อมูลที่ให้คือ จำนวนของ packet (เป็นได้ทั้ง text และ binary)
การติดตั้ง (Install) ipsumdump(ดาวโหลดโปรแกรม ที่นี่)
แตกไฟล์ที่ได้โดยใช้คำสั่ง tar -zxvf ipsumdump-1.70.tar.gz
* ./configure
* make
* make install
SYNOPSIS
ipsumdump [-r | -i | …] [–src, –dst, –sport, –dport, …] [other options] [files or interfaces]
ตัวอย่าง OPTIONS บางส่วนของ ipsumdump (พร้อมคำอธิบาย)
Data Sources
Data source options บอกถึง ipsumdump ใช้ data source ประเภทใด เช่น tcpdump(1) raw-packet files (–tcpdump), live network interfaces (–interface), NetFlow summary files (–netflow-summary), ipsumdump output files (–ipsumdump), DAG or NLANR-formatted files (–dag, –nlanr), or others.
Non-option arguments specify the files, หรือ interfaces ที่อ่าน เช่น ‘ipsumdump -r eth0 eth1’ เป็นการอ่าน 2 tcpdump(1) files, ที่มีชื่อว่า eth0'' และ
eth1”; ‘ipsumdump -i eth0 eth1’ เป็นการอ่านจาก 2 network interfaces, eth0'' และ
eth1”.
Options ที่อ่าน file อ่านจาก standard input เมื่อผู้ใช้ใส่ single dash – เป็นชื่อ filename หรือ เมื่อผู้ใช้ให้ option ที่ไม่มี filename ทั้งหมด
–tcpdump, -r
เป็น option ที่เกี่ยวกับการอ่าน file จาก tcpdump -w option (pcap files) และ File ที่มีการ compress เป็นนามสกุล gzip หรือ bzip2 ซึ่ง ipsumdump จะสามารถ uncompress ได้
–interface, -i
เป็น option ที่อ่านจาก network interfaces ipsumdump จะทำงานต่อเนื่องจนกระทั่งมี interrupt เกิดขึ้นที่ SIGINT or SIGHUP และ kernel จะแสดงว่ามีจำนวน packets เท่าไรที่มีการ dropped ก่อนการเป็น output.
–ipsumdump
เป็น option ที่อ่าน ipsumdump files ที่ลักษณะ packet ไม่ได้ระบุชนิด input files
–format=format
เป็น option ที่อ่าน ipsumdump files ที่มีการระบุ format file โดย format ควรจะเป็น space-separated list
–dag[=encap]
เป็น option ที่อ่าน DAG-formatted trace files
–nlanr
เป็น option ที่อ่าน NLANR-formatted trace files (fr, fr+, or tsh format)
–netflow-summary
เป็น option ที่อ่าน NetFlow summary files
–tcpdump-text
เป็น option ที่อ่านจาก tcpdump ที่มีรูปแบบเป็น text file
Dump Contents
–timestamp, -t
เป็น option เกี่ยวกับ packet timestamp ใน dumpfile
–first-timestamp, -T
เป็น option เกี่ยวกับ flow-begin timestamp ใน dumpfile
–src, -s
เป็น option เกี่ยวกับ IP source address ใน dumpfile เช่น: 192.168.1.101.
–dst, -d
เป็น option เกี่ยวกับ IP destination address เช่น 18.26.4.44.
–sport, -S
เป็น option เกี่ยวกับ TCP หรือ UDP source port ใน dumpfile
–dport, -D
เป็น option เกี่ยวกับ TCP หรือ UDP destination port ใน dumpfile. เช่น 80
–length, -l
เป็น option เกี่ยวกับ ความยาวของ packet ใน dumpfile.
–protocol, -p
เป็น option เกี่ยวกับ IP protocol ใน dumpfile. โดย T คือ TCP , U คือ UDP , I คือ ICMP
–id
เป็น option เกี่ยวกับ IP ID field ใน dumpfile. เช่น 19371.
–fragment, -g
เป็น option เกี่ยวกับ IP fragment test ใน dumpfile โดย F คือ first fragments และ f คือ second และ subsequent fragments ส่วน nonfragment คือ single period
–fragment-offset, –fragoff, -G
เป็น option เกี่ยวกับ IP fragment offset ใน dumpfile โดย field value ของ fragment offset อยู่ในรูปของ bytes
–ip-opt
เป็น Option เกี่ยวกับ IP ใน dumpfile
–ip-sum
เป็น Option เกี่ยวกับ IP checksum ใน dumpfile เช่น 34987.
–tcp-seq, -Q
เป็น Option เกี่ยวกับ TCP sequence number ใน dumpfile เช่น 4009339012
–tcp-ack, -K
เป็น Option เกี่ยวกับ TCP acknowledgement number ใน dumpfile เช่น4009339012
–tcp-flags, -F
เป็น Option เกี่ยวกับ TCP flags byte ใน dumpfile แต่ละ flag เป็นการแสดงถึง uppercase letter เช่น F คือ FIN, S คือ SYN, R คือ RST, P คือ PSH, A คือ ACK, U คือ URG, E คือ ECE (flag bit 6), C คือ CWR (flag bit 7), และ N คือ Nonce Sum (flag bit 8).
–tcp-window, -W
เป็น Option เกี่ยวกับ TCP receive window ใน dumpfile
Include in the dump. This value is not scaled by the connection’s window scale, if any. Example: 480. For non-TCP packets, and for fragments after the first, this field is a single dash -.
–tcp-opt, -O
เป็น Option เกี่ยวกับ TCP ใน dumpfile
–tcp-sack
เป็น Option เกี่ยวกับ SACK-related TCP options ใน dumpfile
–udp-length
เป็น Option เกี่ยวกับบอกความยาวของ UDP ใน dumpfile
–payload-length, -L
เป็น Option เกี่ยวกับบอกความยาวของ packet payload ใน dumpfile
–payload
เป็น Option เกี่ยวกับ actual packet payload ใน dumpfile
–payload-md5
เป็น Option เกี่ยวกับ MD5 checksum ของ packet payload ใน dumpfile
–capture-length
เป็น Option เกี่ยวกับ ความยาวของ captured IP data ใน dumpfile
–packet-count, -c
เป็น Option เกี่ยวกับ การนับ packet ใน dumpfile
–link
เป็น Option เกี่ยวกับ link number ใน dumpfile
Other Options
–output=file, -o file
เป็น Option เกี่ยวกับการเขียน summary dumpfile ออกมาในรูปของ text file
–binary, -b
เป็น Option เกี่ยวกับการเขียน summary dumpfile ออกมาในรูปของ binary
tcpdump=file, -w file
เป็น Option เกี่ยวกับการเขียน processed packets ของ tcpdump
–filter=filter, -f filter
เป็น Option เกี่ยวกับ packets และ flows matching a tcpdump filter
เช่น ‘ipsumdump -f “tcp && src net 18/8”’ เป็นการ summarize data ของ TCP packets จาก net 18. (The syntax for filter is currently a subset of tcpdump’s syntax.)
–bad-packets
เป็น Option เกี่ยวกับ Print lines like ‘!bad IP header length 4’ ของ packets ที่ไม่มี IP headers, bad IP headers, หรือ bad TCP/UDP headers. (A bad header คือ ความยาวที่ไม่ถูกต้อง หรือ unexpected version, หรือ spread across multiple fragments.)
–anonymize, -A
เป็น Option เกี่ยวกับ Anonymize IP addresses เป็น output การ anonymization คือ การเก็บ prefix และ class.
–no-promiscuous
เป็น Option เกี่ยวกับ Do not place interfaces into promiscuous mode.
–sample=p
เป็น Option เกี่ยวกับ Sample packets with probability p. p is the chance that a packet will cause output to be generated.
–multipacket
เป็น Option ที่จะมีผลกับการอ่าน NetFlow หรือ IP summaries
–collate
เป็น Option เกี่ยวกับการ Sort output packets โดยเรียงจากเวลาที่เพิ่มมากขึ้น โดยใช้ option นี้เมื่อมีการอ่านจาก multiple tcpdump(1) files
–interval=time
เป็น Option เกี่ยวกับเวลาของการ process packet ซึ่งอยู่ในหน่วยของวินาที
–limit-packets=count
เป็น Option เกี่ยวกับนับ packets
–map-address=addrs
เป็น Option เกี่ยวกับ addrs เป็น a space- หรือ comma-separated list ของ IP addresses และ prefixes. เมื่อ Summary dump เสร็จสมบูรณ์, ipsumdump จะเขียน addresses นั้นเป็น standard error, paired ที่ anonymzed counterparts.
–record-counts=time
เป็น Option ที่ใช้ประโยชน์เมื่อมีการอ่านจาก interfaces. เป็น Option ที่เมื่อ ipsumdump มีการเขียน comment recording the cumulative number of packets output และ จำนวนของ packets ที่มีการ dropped โดย kernel ก่อนที่ ipsumdump จะ processมันในทุก ๆ วินาที
–random-seed=seed
เป็น Option เกี่ยวกับการ Set random seed โดย random seed คือ การ random ค่า โดยใช้ /dev/random ร่วมกับ data อื่น ๆ เช่น packet และ ค่าของ anonymized IP addresses.
–no-mmap
เป็น Option เกี่ยวกับบอกให้รู้ว่าไม่มีการใช้ memory mapping เมื่อมีการ read file
–quiet, -q
เป็น Option เกี่ยวกับไม่มีการ print a progress bar
–config
เป็น Option เกี่ยวกับการ configuration ipsumdump
–verbose, -V
เป็น Option เกี่ยวกับบอก error messages.
–help, -h
เป็น Option เกี่ยวกับ help message เพื่อช่วยในการใช้งาน
–version, -v
เป็น Option เกี่ยวกับบอกเวอร์ชั่น และข้อมูล license
ข้อมูลเพิ่มเติม http://en.wikipedia.org/wiki/Tcpdump
ข้อมูลเพิ่มเติม http://www.cs.ucla.edu/~kohler/ipsumdump/