From wikistone
Jump to: navigation, search
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
−
==Text Dump==
+
==TCPDump==
 
Monitor all traffic on port 25:
 
Monitor all traffic on port 25:
  
−
tcpdump -vv -X -s 1500 -i eth1 port 25
 
 
* -vv : More verbose output
 
* -vv : More verbose output
 
* -x : When parsing and printing, in addition to printing the headers of each packet, print the data of each packet.
 
* -x : When parsing and printing, in addition to printing the headers of each packet, print the data of each packet.
 
* -X : When parsing and printing, in addition to printing the headers of each packet, print the data of each packet (minus its link level header) in hex and ASCII. This is very handy for analysing new protocols.
 
* -X : When parsing and printing, in addition to printing the headers of each packet, print the data of each packet (minus its link level header) in hex and ASCII. This is very handy for analysing new protocols.
−
* -s : 1500: Snarf snaplen bytes of data from each packet rather than the default of 68. This is useful to see lots of information.
+
* -s : 0: Snarf up to snaplen bytes of data from each packet rather than the default of 68, 0 is no size limit. This is useful to see lots of information.
 
* -i : eth1 : Monitor eth1 interface
 
* -i : eth1 : Monitor eth1 interface
 +
* -C : pcap files rotate every n size in MB
 +
* -G : pcap files rotate every n sec
 +
* -W : rotate n files
 +
* -K : don't verify checksums
 
* src [net] : source host / network(CIDR)
 
* src [net] : source host / network(CIDR)
 
* dst [net] : destination host / network(CIDR)
 
* dst [net] : destination host / network(CIDR)
 +
* net : network(CIDR) (will filter src or dest)
 +
 +
==Text Dump==
 +
<big><code>tcpdump -vv -X -s 1500 -i eth1 port 25</code></big>
  
 
==File Dump==
 
==File Dump==
−
tcpdump -i [interface] -s 0 -w [file] src net a.b.c.d/24
+
tcpdump -i [interface] -s 0 -K -w [file] net a.b.c.d/24
−
* -s : bytes per packet to capture, default is 68 L3 bytes (96 L2), set to 0 to get all bytes in the packet
+
 
 +
 
 +
Or do a nohup to capture in the background whilst doing other such stuff.
 +
 
 +
<big><code>nohup tcpdump -i [interface] -s 0 -K -w [file] net a.b.c.d/24 &</code></big>
 +
 
 +
 
 +
Wrapping by time (s) and stamping with date and time.
 +
 
 +
<big><code>tcpdump -s 0 -i eth1 -G 7200 -W 100 -w /tmp/PacketCapture_%m%d-t%H%M%S.pcap net 10.0.0.0/28</code></big>

Latest revision as of 13:10, 15 August 2017

TCPDump

Monitor all traffic on port 25:

  • -vv : More verbose output
  • -x : When parsing and printing, in addition to printing the headers of each packet, print the data of each packet.
  • -X : When parsing and printing, in addition to printing the headers of each packet, print the data of each packet (minus its link level header) in hex and ASCII. This is very handy for analysing new protocols.
  • -s : 0: Snarf up to snaplen bytes of data from each packet rather than the default of 68, 0 is no size limit. This is useful to see lots of information.
  • -i : eth1 : Monitor eth1 interface
  • -C : pcap files rotate every n size in MB
  • -G : pcap files rotate every n sec
  • -W : rotate n files
  • -K : don't verify checksums
  • src [net] : source host / network(CIDR)
  • dst [net] : destination host / network(CIDR)
  • net : network(CIDR) (will filter src or dest)

Text Dump

tcpdump -vv -X -s 1500 -i eth1 port 25

File Dump

tcpdump -i [interface] -s 0 -K -w [file] net a.b.c.d/24


Or do a nohup to capture in the background whilst doing other such stuff.

nohup tcpdump -i [interface] -s 0 -K -w [file] net a.b.c.d/24 &


Wrapping by time (s) and stamping with date and time.

tcpdump -s 0 -i eth1 -G 7200 -W 100 -w /tmp/PacketCapture_%m%d-t%H%M%S.pcap net 10.0.0.0/28