Skip to content

Instantly share code, notes, and snippets.

@cactaceae21
Last active January 18, 2020 00:13
Show Gist options
  • Save cactaceae21/976e4816ac034c1da209c9b9bb739ac1 to your computer and use it in GitHub Desktop.
Save cactaceae21/976e4816ac034c1da209c9b9bb739ac1 to your computer and use it in GitHub Desktop.
Network Analysis #Wireshark #pcap #network

TSHARK

https://hackertarget.com/tshark-tutorial-and-filter-examples/

Export specific packets

  • tshark -Y {filter} -r {input file} -w {output file}
  • tshark -2 -R {filter} -r {input file} -w {output file}

Dump raw packet 'data' field only

  • tshark -r infile -T fields -e data | tr -d '\n' > tempfile
import binascii
import sys
string = open(sys.argv[1],'r').read()
sys.stdout.write(binascii.unhexlify(string)) # needs to be stdout.write to avoid trailing newline

CAPINFOS

$capinfos  -a -e file.pcap.gz
File name:           wireless_080224_first.pcap.gz
First packet time:   2008-02-24 13:10:09.637336
Last packet time:    2008-02-24 13:40:23.026171
$capinfos  -T -r -a -e file.pcap.gz
file.pcap.gz   2008-02-24 13:10:09.637336      2008-02-24 13:40:23.026171
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment