SlideShare a Scribd company logo
how to GET GET
2013/06/27
#pakeana 16
@twovs
agenda
• 自己紹介
• Wireshark や tshark でなく
tcpdump で HTTP の GET だけを dump する方法tcpdump で HTTP の GET だけを dump する方法
about me
• @twovs
• ネコ2人+奥さん1人+可愛い娘
• 無線LAN装置の開発(1999~2004)• 無線LAN装置の開発(1999~2004)
• オンラインゲームのシステム管理者(2004~)
• ただし,ゲームには全く興味無し
• ZFS 最高 !!! beadm 便利 !!!
答え
tcp[((tcp[12:1] & 0xf0) >> 2):4]tcp[((tcp[12:1] & 0xf0) >> 2):4]
= 0x47455420
実行例
# cat filter
tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420
# tcpdump -n -t -X -i lo -F filter
tcpdump: listening on lo
127.0.0.1.38968 > 127.0.0.1.http: P 1871129285:1871129296(11) ack 1861065890 win
32767 <nop,nop,timestamp 9709988 9709773> (DF) [tos 0x10]
0x0000 4510 003f 020b 4000 4006 3a9c 7f00 0001 E..?..@.@.:.....
0x0010 7f00 0001 9838 0050 6f87 2ac5 6eed 9ca2 .....8.Po.*.n...
0x0020 8018 7fff bd67 0000 0101 080a 0094 29a4 .....g........).
0x0030 0094 28cd 4745 5420 2f68 6f67 650d 0a ..(.GET./hoge..
• GET /hoge だけが dump される
• 3-way-handshake など他のパケットは無視
方針概要
TCP ヘッダからヘッダ長を読み取り
TCP ヘッダからその長さだけ offset した
バイト列が GET かどうかを判定
4[Byte]
Memo.1
TCP ヘッダのヘッダ長は
先頭から 12[Byte] offset された後の
4[bit] に記述されている
12[Byte]
4[bit]
Memo.2
12[Byte] offset された後の
4[bit] がヘッダ長(Data Offset)で
その後 6[bit]が予約(Reserved)されてて
(さらにその後 6[bit] がよく見る FLAG)
12[Byte]
4[bit]
6+6[bit]
Memo.3
TCP のヘッダ長は 32 bit-word(4 Byte-word)
offset の bit を 4倍すればヘッダ長[Byte]に
offset は 4[bit](0000 - 1111)
‘0001’-> 4[Byte]
‘0010’-> 8[Byte]
…
‘0101’-> 20[Byte]
…
‘1111’-> 60[Byte]
(つまり,TCPヘッダは最大でも 60[Byte])
Memo.4
0x47 == G
0x45 == E0x45 == E
0x54 == T
0x20 == (space)
Memo.5
0x50 == P
0x4F == O0x4F == O
0x53 == S
0x54 == T
0x20 == (space)
#1
tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420
12[Byte] offset 後の 1[Byte] == 8[bit] を取得
ただし下 4[bit]の余計な bit も含んでいる
12[Byte]
8[bit]
#2
tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420
'0xf0' == '1111 0000' と and をとることで
余計な下 4[bit] を ‘0’ にする
12[Byte]
8[bit]
0
#3
tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420
右に 4[bit] シフトすることで 4bit 分のヘッダ長[bit]が
左に 2[bit] シフトする得られたヘッダ長[bit]を 4倍できる
トータルで右に 2[bit] シフトするとヘッダ長[Byte]を得るトータルで右に 2[bit] シフトするとヘッダ長[Byte]を得る
#4
tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420
TCP のヘッダ長[Byte] が得られた
#5
tcp[(TCPのヘッダ長):4] = 0x47455420
Data の先頭 4[Byte] が得られる
4[Byte]
#6
tcp[(TCPのヘッダ長):4] = 0x47455420
得られた 4[Byte] が GET なら true
4[Byte]
参考.1
POST だけを dump
tcp[((tcp[12:1] & 0xf0) >> 2):5]tcp[((tcp[12:1] & 0xf0) >> 2):5]
= 0x504F535420
参考.1
…と思うでしょ???
残念!!!
# cat filter
tcp[((tcp[12:1] & 0xf0) >> 2):5] = 0x504F535420
# tcpdump -n -t -X -i lo -F filter
tcpdump: data size must be 1, 2, or 4
参考.1
POST だけを dump
tcp[((tcp[12:1] & 0xf0) >> 2):4]tcp[((tcp[12:1] & 0xf0) >> 2):4]
= 0x504F5354
参考.2
http://seclists.org/tcpdump/2004/q4/94
http://seclists.org/tcpdump/2004/q4/95
http://seclists.org/tcpdump/2004/q4/98http://seclists.org/tcpdump/2004/q4/98
Jefferson.Ogata (at) noaa gov
ENDEND

More Related Content

PDF
a little more about CaptureFilter
PDF
IPv6冗長で差をつけよう 2011年夏の思い出作り VRRP編
PPTX
Maria X MIT presentation slides
PDF
Packet と向き合う夏 VRRP Advertisement編
PPTX
Sara portfolio april 2011 cput 2nd yr
PDF
It fin analyse_slideshare_20110915
PPTX
Islam science and morals
PDF
超簡単!? Punycode 変換 ~国際化・日本語ドメイン~
a little more about CaptureFilter
IPv6冗長で差をつけよう 2011年夏の思い出作り VRRP編
Maria X MIT presentation slides
Packet と向き合う夏 VRRP Advertisement編
Sara portfolio april 2011 cput 2nd yr
It fin analyse_slideshare_20110915
Islam science and morals
超簡単!? Punycode 変換 ~国際化・日本語ドメイン~

Viewers also liked (20)

PDF
DNS64 (El capitan and unbound-1.5.1)
PDF
raspi + soracom #pakeana33
PDF
how to defend DNS authoritative server against DNS WaterTorture
PPTX
PPTX
Xdr ppt
PDF
about tcpreplay-edit
PDF
TCP/IP Exercises
PPTX
GoogleAnalyticsを使った効果測定
PDF
BPF - All your packets belong to me
PDF
Data Integrity Techniques: Aviation Best Practices for CRC & Checksum Error D...
PDF
Network traffic analysis course
PPTX
Packet capture in network security
PDF
Introduction to tcpdump
PPS
Poor Rich (Poor Rich.Pps)
PPTX
Tcpdump
PPTX
Berkeley Packet Filters
PPTX
Tcpdump hunter
PPT
TCPdump-Wireshark
PPTX
Traffic analysis
DNS64 (El capitan and unbound-1.5.1)
raspi + soracom #pakeana33
how to defend DNS authoritative server against DNS WaterTorture
Xdr ppt
about tcpreplay-edit
TCP/IP Exercises
GoogleAnalyticsを使った効果測定
BPF - All your packets belong to me
Data Integrity Techniques: Aviation Best Practices for CRC & Checksum Error D...
Network traffic analysis course
Packet capture in network security
Introduction to tcpdump
Poor Rich (Poor Rich.Pps)
Tcpdump
Berkeley Packet Filters
Tcpdump hunter
TCPdump-Wireshark
Traffic analysis
Ad

Similar to how to GET GET (20)

PDF
Hokkaido.cap#2 一般的なプロトコルのパケットを覗いてみよう
ODP
tcpdumpとtcpreplayとtcprewriteと他。
PDF
Windowsのパケットモニタ作成
PDF
Hokkaido.cap #osc11do Wiresharkを使いこなそう!
PDF
Scapy presentation
PDF
Scapy presentation Remake(訂正)
PDF
法政大学情報科学部 2012年度コンピュータネットワーク-第8回授業-Web公開用
PDF
#pakeana 14
PDF
Trema day 1
PDF
Inside winnyp
PDF
Wiresharkで検出できないチャットプログラム
PDF
組み込みシステムのセキュリティ
PDF
CTF for ビギナーズ ネットワーク講習資料
PDF
Scapyで作る・解析するパケット
PPT
20060520.tcp
PDF
法政大学情報科学部 2012年度コンピュータネットワーク-第12回授業-Web公開用
PDF
TCP connectionの保存と復元
PDF
Hokkaido.cap#1 Wiresharkの使い方(基礎編)
PDF
Ethernetの受信処理
ODP
Programming under capability mode
Hokkaido.cap#2 一般的なプロトコルのパケットを覗いてみよう
tcpdumpとtcpreplayとtcprewriteと他。
Windowsのパケットモニタ作成
Hokkaido.cap #osc11do Wiresharkを使いこなそう!
Scapy presentation
Scapy presentation Remake(訂正)
法政大学情報科学部 2012年度コンピュータネットワーク-第8回授業-Web公開用
#pakeana 14
Trema day 1
Inside winnyp
Wiresharkで検出できないチャットプログラム
組み込みシステムのセキュリティ
CTF for ビギナーズ ネットワーク講習資料
Scapyで作る・解析するパケット
20060520.tcp
法政大学情報科学部 2012年度コンピュータネットワーク-第12回授業-Web公開用
TCP connectionの保存と復元
Hokkaido.cap#1 Wiresharkの使い方(基礎編)
Ethernetの受信処理
Programming under capability mode
Ad

More from @ otsuka752 (18)

PPTX
NS & NSID of Amazon Route 53
PPTX
OLD_LT_DNS_OLD
PPTX
OLD_Lt traffic analyse_OLD
PPTX
Hijack the domain name
PDF
Route53 で親子同居
PDF
reusable delegation set のススメ (Route53)
PDF
192.0.0.4 on android
PDF
iptables BPF module 効果測定
PDF
how to decrypt SSL/TLS without PrivateKey of servers
PDF
WireEdit のススメ
PDF
Measurement of Maximum new NAT-sessions per second / How to send packets
PDF
毎日 dig ったら分かったこと ~新 gTLD~
PDF
萌え萌えドメイン名一覧(.moe)
PDF
about Tcpreplay
PDF
パケットが教えてくれた ルートサーバが 13個の理由
PDF
IPv6SG_03_20121103
PDF
osoljp 2011.08
PDF
IPv6冗長で差をつけよう 2011年夏の思い出作り HSRP編
NS & NSID of Amazon Route 53
OLD_LT_DNS_OLD
OLD_Lt traffic analyse_OLD
Hijack the domain name
Route53 で親子同居
reusable delegation set のススメ (Route53)
192.0.0.4 on android
iptables BPF module 効果測定
how to decrypt SSL/TLS without PrivateKey of servers
WireEdit のススメ
Measurement of Maximum new NAT-sessions per second / How to send packets
毎日 dig ったら分かったこと ~新 gTLD~
萌え萌えドメイン名一覧(.moe)
about Tcpreplay
パケットが教えてくれた ルートサーバが 13個の理由
IPv6SG_03_20121103
osoljp 2011.08
IPv6冗長で差をつけよう 2011年夏の思い出作り HSRP編

how to GET GET