IT練習ノート

IT関連で調べたこと(実際は嵌ったこと)を書いています。

Wiresharkのpluginでキャプチャできないtcpのportがあるの?

たぶん、自分のやっていることのどこか間違っているのだとおもうのですが、よくわかりません。

環境

 wireshark -v
Wireshark 2.4.2 (v2.4.2-0-gb6c63ae)

Copyright 1998-2017 Gerald Combs <gerald@wireshark.org> and contributors.
License GPLv2+: GNU GPL version 2 or later <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled (64-bit) with Qt 5.3.2, with libpcap, without POSIX capabilities, with
GLib 2.36.0, with zlib 1.2.5, with SMI 0.4.8, with c-ares 1.12.0, with Lua
5.2.4, with GnuTLS 3.4.17, with Gcrypt 1.7.7, with MIT Kerberos, with GeoIP,
with nghttp2 1.14.0, with LZ4, with Snappy, with libxml2 2.9.4, with
QtMultimedia, without AirPcap, with SBC, without SpanDSP.

Running on Mac OS X 10.10.5, build 14F1605 (Darwin 14.5.0), with Intel(R)
Core(TM) i5-4250U CPU @ 1.30GHz (with SSE4.2), with 4096 MB of physical memory,
with locale ja_JP.UTF-8, with libpcap version 1.5.3 - Apple version 47, with
GnuTLS 3.4.17, with Gcrypt 1.7.7, with zlib 1.2.5.

Built using llvm-gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build
2336.9.00).

ネットワークインターフェースはLoopBack lo0

4桁のポートと5桁のポートに同じディセクタを割り当てる

local p_multi = Proto("mytest", "this is a test!");

function p_multi.dissector(buf, pkt, tree)
  pkt.cols.protocol = "mytest"
  info("foo bar");
end

DissectorTable.get("tcp.port"):add(8000 , p_multi)
DissectorTable.get("tcp.port"):add(33060, p_multi)

5桁のポートの場合ディセクタが動作していない。

phpの簡易サーバ立ち上げる

$ php -S localhost:33060

ブラウザからアクセス

f:id:naotoogawa:20171202134531j:plain

今回作ったプラグインプロトコル名(mytest)が出ていない。キャプチャは載せてないがログは出ていない。 f:id:naotoogawa:20171202134604j:plain

4桁のポートの場合ディセクタが動作している。ログも出ている。

phpの簡易サーバ立ち上げる

$ php -S localhost:8000

ブラウザからアクセス

f:id:naotoogawa:20171202134419j:plain

今回作ったプラグインプロトコル名(mytest)が出ている。キャプチャは載せてないがログも出ている。 f:id:naotoogawa:20171202134624j:plain

XProtocolのポートを変更

ハイフンではなくアンダースコアであることに注意

設定ファイル

[mysqld]

mysqlx_port=8001

コマンドライン

mysql.server start --mysqlx_port=8000

クライアント接続

$ mysqlsh -p -u root --port=8000
Creating a Session to 'root@localhost:8000'
Enter password:
Node Session successfully established. No default schema selected.
Welcome to MySQL Shell 1.0.9

Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type '\help', '\h' or '\?' for help, type '\quit' or '\q' to exit.

Currently in JavaScript mode. Use \sql to switch to SQL mode and execute queries.
mysql-js> session
<NodeSession:root@localhost:8000>
mysql-js>

クライアント接続エラーのケース

(root)blender:~ ogawanaoto$ mysqlsh -p -u root --port=8001
Creating a Session to 'root@localhost:8001'
Enter password:
ERROR: 2003 (HY000): Can't connect to MySQL server on 'localhost' (61)

Haskellのテスト構成イメージ

こんなイメージ

cabal
 |
 +--> TestSuite
       |
       +--> Tasty
             |
             +-(bridge)-> HSpec
             |             |
             |             +-(bridge)-> hspec-attoparsec
             |
             +-(bridge)-> QuickCheck