diff --git a/data/msfgui/msfgui.glade b/data/msfgui/msfgui.glade
index 927eedd1fb..bf3649dc31 100644
--- a/data/msfgui/msfgui.glade
+++ b/data/msfgui/msfgui.glade
@@ -44,7 +44,6 @@
-
-
-
- パケットキャプチャについての統計を含む Struct
- を返します。構造体は以下のメンバを持ちます。
-
-
-recv
- 受信したパケットの数
drop
- 取りこぼしたしたパケットの数
-
-
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc-ja/Dumper.html b/external/ruby-pcapx/doc-ja/Dumper.html
deleted file mode 100644
index 7a6da5229c..0000000000
--- a/external/ruby-pcapx/doc-ja/Dumper.html
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-Dumper
-
-
-
-Dumper
--
-
- パケットを tcpdump 形式のファイルに書き出すクラス。生成したファイルは
- tcpdump や
Capture.open_offline
を使って読むことができます。
-
-スーパークラス:
-Object
-クラスメソッド:
-
--
-
open(capture, filename)
- -
-
-
- captureから取り込んだパケットを
- filenameに書き出すためのDumper
を返し
- ます。
-
-
-メソッド:
-
--
-
close
- -
-
-
- Dumper
オブジェクトをクローズします。
-
- -
-
dump(packet)
- -
-
-
- packetをこのDumper
に書き出します。
- packetはこのDumper
をオープンする時に
- 指定したCapture
から取り込まれたものでなければなりま
- せん。
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc-ja/Filter.html b/external/ruby-pcapx/doc-ja/Filter.html
deleted file mode 100644
index 94e533a873..0000000000
--- a/external/ruby-pcapx/doc-ja/Filter.html
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-
-Filter
-
-
-
-Filter
--
-
-
Filter
はパケットが、ある条件にマッチするかど
- うかを判定します。Filter
は実際には
- bpf_program
へのラッパーとして作られています。
- フィルタの記述方法に関しては tcpdump(1)
- を参照して下さい。
-
-スーパークラス:
-Object
-クラスメソッド:
-
--
-
compile(expr, capture[, optimize[, netmask]])
- -
-
-
-
new(expr, capture[, optimize[, netmask]])
- -
-
-
-
-
- Filter
オブジェクトを生成します。
- expr はフィルタの文字列です。capture
- は Capture
オブジェクトです。optimize
- で最適化を行うかどうかを制御します。
- netmask によりローカルネットのネットマスク
- を指定します。
-
-
-
-
- 生成された Filter
は capture
- から取り込まれたパケットに対してのみ適用できます。
-
-
-
-
- libpcap-0.5以降
- を使用している場合には capture
- の部分に、以下の値を指定することもできます。
-
-
-[snaplen, datalink]
- 配列で必要なパラメータを直接与える
- 省略 (または
nil
) - Ethernetでのデフォルトとみなす
- (
[68, DLT_EN10MB
]
)
-
-
-
-
-
-
-
-メソッド:
-
--
-
self === packet
- -
-
-
-
self =~ packet
- -
-
-
- packet がこのフィルタにマッチすればtrueを返
- します。
-
- -
-
~ self
- -
-
-
- 「 self
ではない」という条件を表
- すFilter
を返します。
-
- -
-
self | other
- -
-
-
- 「 self
またはother 」という条件を表
- すFilter
を返します。
-
- -
-
self & other
- -
-
-
- 「 self
かつother 」という条件を表
- すFilter
を返します。
-
- -
-
source
- -
-
-
- フィルタの元となった文字列を返します。
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc-ja/ICMPPacket.html b/external/ruby-pcapx/doc-ja/ICMPPacket.html
deleted file mode 100644
index 2e7c7c9b8a..0000000000
--- a/external/ruby-pcapx/doc-ja/ICMPPacket.html
+++ /dev/null
@@ -1,189 +0,0 @@
-
-
-
-ICMPPacket
-
-
-
-ICMPPacket
--
-
-
-
- ICMPメッセージを含むパケット。
-
-
-
-
- ICMPメッセージのフォーマットはICMPタイプによって異なりま
- す。そのため特定のICMPタイプのパケットにしか存在しないフィー
- ルドがあります。存在しないフィールドにアクセスしようとす
- ると例外が発生します。
-
-
-
-
- どのICMPタイプに対しても有効なフィールドは type, code,
- cksum です。
-
-
-
-スーパークラス:
-IPPacket
-メソッド:
-
--
-
icmp_cksum
- -
-
-
- ICMPチェックサムを返します。
-
- -
-
icmp_code
- -
-
-
- ICMPコードを返します。
-
- -
-
icmp_data
- -
-
-
- ICMP_ECHO/ICMP_ECHOREPLYメッセージのデータ部分を
- String
として返します。
-
- -
-
icmp_gwaddr
- -
-
-
- ICMP_REDIRECTメッセージのゲートウェイアドレスを
- IPAddress
として返します。
-
- -
-
icmp_id
- -
-
-
- 識別子を返します。
-
- -
-
icmp_ip
- -
-
-
- 元のIPデータグラムをIPPacket
として返します。
-
- -
-
icmp_lifetime
- -
-
-
- ICMP_ROUTERADVERTメッセージの有効時間を返します。
-
- -
-
icmp_nextmtu
- -
-
-
- ICMP_UNREACH_NEEDFRAGメッセージの Next Hop MTU を返しま
- す。(参照: rfc1191)
-
- -
-
icmp_num_addrs
- -
-
-
- ICMP_ROUTERADVERTメッセージのアドレス数を返します。
-
- -
-
icmp_otime
- -
-
-
-
icmp_rtime
- -
-
-
-
icmp_ttime
- -
-
-
- ICMP_TSTAMP/ICMP_TSTAMPREPLYメッセージのタイムス
- タンプをTime
として返します。
-
- -
-
icmp_pptr
- -
-
-
- ICMP_PARAMPROBメッセージのエラーポインタを返します。
-
- -
-
icmp_radv(nth)
- -
-
-
- ICMP_ROUTERADVERTメッセージのnth番目のアドレ
- スエントリを返します。返り値は [address,
- preference]
なる2要素の配列です。
-
- -
-
icmp_seq
- -
-
-
- シーケンス番号を返します。
-
- -
-
icmp_seqle
- -
-
-
-
-
- リトルエンディアンとして読みとったシーケンス番号を返し
- ます。
-
-
-
-
- 多くのping
コマンドの実装はシーケンス番
- 号をホストバイトオーダーで書き込みます。したがって、
- リトルエンディアンのホストから送信されたICMPメッセー
- ジのシーケンス番号はリトルエンディアンになっている可
- 能性があります。
-
-
-
-
- -
-
icmp_type
- -
-
-
- ICMPタイプを返します。
-
- -
-
icmp_typestr
- -
-
-
- ICMPタイプを表す文字列を返します。(例: "echo reply")
-
- -
-
icmp_wpa
- -
-
-
- ICMP_ROUTERADVERTメッセージのアドレスエントリ長(単位:
- 32-bit word)を返します。
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc-ja/IPAddress.html b/external/ruby-pcapx/doc-ja/IPAddress.html
deleted file mode 100644
index 0818f31b31..0000000000
--- a/external/ruby-pcapx/doc-ja/IPAddress.html
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-IPAddress
-
-
-
-IPAddress
--
-
- IP アドレスを表すオブジェクトです。
-
-スーパークラス:
-Object
-メソッド:
-
--
-
self == other
- -
-
-
- 二つの IP アドレスが同じアドレスかどうかを判定します。
-
- -
-
hostname
- -
-
-
- この IP アドレスに対応するホスト名を返します。
-
- -
-
to_i
- -
-
-
- IP アドレスの値を整数として返します。
-
- -
-
to_num_s
- -
-
-
- IP アドレスの値を表す文字列を返します。
-
- -
-
to_s
- -
-
-
- IP アドレスの値を表す文字列かホスト名を返します。どちらを返
- すかはPcap.convert=
で設定します。
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc-ja/IPPacket.html b/external/ruby-pcapx/doc-ja/IPPacket.html
deleted file mode 100644
index 88f19a005a..0000000000
--- a/external/ruby-pcapx/doc-ja/IPPacket.html
+++ /dev/null
@@ -1,142 +0,0 @@
-
-
-
-IPPacket
-
-
-
-IPPacket
--
-
- IPヘッダを含むパケット。
-
-スーパークラス:
-Packet
-メソッド:
-
--
-
ip_data
- -
-
-
- データ部分をString
として返します。
-
- -
-
ip_df?
- -
-
-
- Don't Fragment ビットが立っているかどうかを返します。
-
- -
-
ip_dst
- -
-
-
-
dst
- -
-
-
- デスティネーション IP アドレスをIPAddress
として返します。
-
- -
-
ip_flags
- -
-
-
- IP フラグビットフィールド (3 bit) の値を返します。
-
- -
-
ip_hlen
- -
-
-
- ヘッダ長を返します。(単位: 4 octets)
-
- -
-
ip_id
- -
-
-
- Identification フィールドの値を返します。
-
- -
-
ip_len
- -
-
-
- パケット長を返します。(単位: octet)
-
- -
-
ip_mf?
- -
-
-
- More Fragment ビットが立っているかどうかを返します。
-
- -
-
ip_off
- -
-
-
- フラグメントオフセットを返します。
-
- -
-
ip_proto
- -
-
-
- プロトコルフィールドの値を返します。
-
- -
-
ip_src
- -
-
-
-
src
- -
-
-
- ソース IP アドレスをIPAddress
として返します。
-
- -
-
ip_sum
- -
-
-
- チェックサムフィールドの値を返します。
-
- -
-
ip_tos
- -
-
-
- TOSフィールドの値を返します。
-
- -
-
ip_ttl
- -
-
-
- TTL フィールドの値を返します。
-
- -
-
ip_ver
- -
-
-
- IP バージョンフィールドの値を返します。
-
- -
-
to_s
- -
-
-
- 文字列に変換します。
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc-ja/Packet.html b/external/ruby-pcapx/doc-ja/Packet.html
deleted file mode 100644
index 49331b7bcf..0000000000
--- a/external/ruby-pcapx/doc-ja/Packet.html
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-
-Packet
-
-
-
-Packet
--
-
-
Capture
によってキャプチャされたパケットのデータ。
- Packet
、およびそのサブクラスはMarshal
に対応
- しています。
-
-スーパークラス:
-Object
-メソッド:
-
--
-
caplen
- -
-
-
- パケットのキャプチャされている部分の長さを返します。
-
- -
-
datalink
- -
-
-
- データリンクのタイプを表す整数を返します。
- (DLT_EN10MB
等)
-
- -
-
ip?
- -
-
-
- このパケットがIPPacket
- かそのサブクラスのインスタンスであれば
- true
を返します。
-
- -
-
len
- -
-
-
-
length
- -
-
-
-
size
- -
-
-
- パケット全体の長さを返します。
-
- -
-
raw_data
- -
-
-
- このパケットの先頭からの生データをString
として返します。
-
- -
-
tcp?
- -
-
-
- このパケットがTCPPacket
かそのサブクラスのインス
- タンスであれば true を返します。
-
- -
-
time
- -
-
-
- このパケットのタイムスタンプを Time
オブジェク
- トとして返します。
-
- -
-
time_i
- -
-
-
- このパケットのタイムスタンプを整数として返します。
-
- -
-
udp?
- -
-
-
- このパケットがUDPPacket
かそのサブクラスのインス
- タンスであれば true を返します。
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc-ja/Pcap.html b/external/ruby-pcapx/doc-ja/Pcap.html
deleted file mode 100644
index a6ac6a5c1f..0000000000
--- a/external/ruby-pcapx/doc-ja/Pcap.html
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-Pcap
-
-
-
-Pcap
--
-
- pcap 全般に関するメソッドや定数を定義しています。
-
-定数:
-
--
-
DLT_NULL
- -
-
-
-
DLT_EN10MB
- -
-
-
-
DLT_EN3MB
- -
-
-
-
DLT_AX25
- -
-
-
-
DLT_PRONET
- -
-
-
-
DLT_CHAOS
- -
-
-
-
DLT_IEEE802
- -
-
-
-
DLT_ARCNET
- -
-
-
-
DLT_SLIP
- -
-
-
-
DLT_PPP
- -
-
-
-
DLT_FDDI
- -
-
-
-
DLT_ATM_RFC1483
- -
-
-
-
DLT_RAW
- -
-
-
-
DLT_SLIP_BSDOS
- -
-
-
-
DLT_PPP_BSDOS
- -
-
-
- データリンク層の種類を表す定数。
-
-
-モジュールメソッド:
-
--
-
convert = bool
- -
-
-
- Pcap
モジュール中のクラスが IP アドレスなどの数値を
- 文字列に変換しようとした時の動作を設定します。true
- ならばそのような数値は名前に変換されます。
-
- -
-
convert?
- -
-
-
- Pcap
モジュール中のクラスが IP アドレスなどの数値を
- 文字列に変換しようとした時の動作を返します。true
- ならばそのような数値は名前に変換されます。
-
- -
-
lookupdev
- -
-
-
- ネットワークデバイス名を返します。
-
- -
-
lookupnet(device)
- -
-
-
- [net, mask]
なる2要素配列を返します。
- net
はネットワーク番号を表す
- IPAddress
です。
- mask
はネットマスクを表すInteger
です。
- 引数deviceによりネットワークデバイス名を指定
- します。
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc-ja/PcapError.html b/external/ruby-pcapx/doc-ja/PcapError.html
deleted file mode 100644
index 2543203534..0000000000
--- a/external/ruby-pcapx/doc-ja/PcapError.html
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-PcapError
-
-
-
-PcapError
--
-
- pcap に関する例外です。
-
-スーパークラス:
-StandardError
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc-ja/Pcaplet.html b/external/ruby-pcapx/doc-ja/Pcaplet.html
deleted file mode 100644
index cbea64eacd..0000000000
--- a/external/ruby-pcapx/doc-ja/Pcaplet.html
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-
-Pcaplet
-
-
-
-Pcaplet
--
-
-
-
- Capture
を使うパケット処理ツールの雛形を提供するクラスで
- す。
- 使うときは'pcaplet'
を require
して下
- さい。
-
-
-
-
- 典型的な使い方:
-
-require 'pcaplet'
-
-my_tool = Pcaplet.new
-my_tool.each_packet {|pkt|
- # pkt について処理を行なうコード
-}
-my_tool.close
-
-
-
-
-
-
-
- コマンドラインで指定されたフィルタ、および
- 以下のコマンドラインオプションを tcpdump と同様に解釈します。
-
--i -r -c -s -n
-
-
-
- '-r
' オプションでは、gzipで圧縮されたファイルを読
- み込むこともできます。
-
-
-
-スーパークラス:
-Object
-クラスメソッド:
-
--
-
new([option])
- -
-
-
- Pcaplet
オブジェクトを生成します。コマンドライン
- の解析とデバイスのオープンが行なわれます。
- optionを指定すると、コマンドラインオプションに
- 追加されます。
-
-
-メソッド:
-
--
-
add_filter(filter)
- -
-
-
- コマンドラインで指定されたフィルタ加えて、さらに
- filterを追加します。実際にはフィルタを以下のよ
- うに設定します。
-
-"( current_filter ) and ( filter )"
-
-
-
-
- -
-
each_packet {|packet|...}
- -
-
-
-
each {|packet|...}
- -
-
-
- 各パケットに対して繰り返します。ブロックには
- Packet
クラスかそのサブクラスのインスタンスが渡されま
- す。
-
- -
-
capture
- -
-
-
- 内部で使用している Capture
オブジェクトを返します。
-
- -
-
close
- -
-
-
- デバイスをクローズします。
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc-ja/TCPPacket.html b/external/ruby-pcapx/doc-ja/TCPPacket.html
deleted file mode 100644
index adbfe1e6c7..0000000000
--- a/external/ruby-pcapx/doc-ja/TCPPacket.html
+++ /dev/null
@@ -1,148 +0,0 @@
-
-
-
-TCPPacket
-
-
-
-TCPPacket
--
-
- TCPヘッダを含むパケット。
-
-スーパークラス:
-IPPacket
-メソッド:
-
--
-
tcp_ack
- -
-
-
- Acknowledgement Number を返します。
-
- -
-
tcp_data
- -
-
-
- データ部分を String
として返します。
-
- -
-
tcp_data_len
- -
-
-
- データ部分の長さを返します。
-
- -
-
tcp_dport
- -
-
-
-
dport
- -
-
-
- デスティネーションポート番号を返します.
-
- -
-
tcp_flags
- -
-
-
- TCP フラグフィールドの値 (6 bit) を返します。
-
- -
-
tcp_flags_s
- -
-
-
- TCP フラグフィールドの値 (6 bit) を
- ".A...F"
といった形式の文字列として返します。
-
- -
-
tcp_fin?
- -
-
-
-
tcp_syn?
- -
-
-
-
tcp_rst?
- -
-
-
-
tcp_psh?
- -
-
-
-
tcp_ack?
- -
-
-
-
tcp_urg?
- -
-
-
- フラグが立っていればtrue
を,そうでなければ
- false
を返します.
-
- -
-
tcp_off
- -
-
-
-
tcp_hlen
- -
-
-
- TCP データオフセット(TCPヘッダ長)を返します。
-
- -
-
tcp_seq
- -
-
-
- Sequence Number を返します。
-
- -
-
tcp_sum
- -
-
-
- Checksum フィールドの値を返します。
-
- -
-
tcp_sport
- -
-
-
-
sport
- -
-
-
- ソースポート番号を返します.
-
- -
-
tcp_urp
- -
-
-
- Urgent Pointer フィールドの値を返します。
-
- -
-
tcp_win
- -
-
-
- Window Size を返します。
-
- -
-
to_s
- -
-
-
- 文字列に変換します。
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc-ja/TruncatedPacket.html b/external/ruby-pcapx/doc-ja/TruncatedPacket.html
deleted file mode 100644
index b2c085baf2..0000000000
--- a/external/ruby-pcapx/doc-ja/TruncatedPacket.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-TruncatedPacket
-
-
-
-TruncatedPacket
--
-
- 要求されたパケットに関する情報が、キャプチャされたデータ内に
- 存在しません。
-
-スーパークラス:
-PcapError
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc-ja/UDPPacket.html b/external/ruby-pcapx/doc-ja/UDPPacket.html
deleted file mode 100644
index 5bd4103245..0000000000
--- a/external/ruby-pcapx/doc-ja/UDPPacket.html
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-UDPPacket
-
-
-
-UDPPacket
--
-
- UDPヘッダを含むパケット。
-
-スーパークラス:
-IPPacket
-メソッド:
-
--
-
udp_data
- -
-
-
- データ部分を String
として返します。
-
- -
-
udp_dport
- -
-
-
-
dport
- -
-
-
- デスティネーションポート番号を返します.
-
- -
-
udp_len
- -
-
-
- Lengthフィールドの値を返します。この値はUDPデータグラム
- 全体の長さ(単位: オクテット)を表します。
-
- -
-
udp_sum
- -
-
-
- Checksum フィールドの値を返します。
-
- -
-
udp_sport
- -
-
-
-
sport
- -
-
-
- ソースポート番号を返します.
-
- -
-
to_s
- -
-
-
- 文字列に変換します。
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc-ja/index.html b/external/ruby-pcapx/doc-ja/index.html
deleted file mode 100644
index 946f776010..0000000000
--- a/external/ruby-pcapx/doc-ja/index.html
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-Ruby/Pcap Library
-
-
-
-Ruby/Pcap拡張ライブラリ
-
-LBL の libpcap (Packet Capture library) への ruby インタフェースです。
-
-モジュール
-
-
-クラス
-
-以下のクラスは全て Pcap
モジュールの下で定義されています。
-したがって使用するときは Pcap
モジュールを
-include
するか、もしくは Pcap::Capture
のよ
-うに参照してください。
-
-
-
-例外
-
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
diff --git a/external/ruby-pcapx/doc/Capture.html b/external/ruby-pcapx/doc/Capture.html
deleted file mode 100644
index 19f83ed80b..0000000000
--- a/external/ruby-pcapx/doc/Capture.html
+++ /dev/null
@@ -1,144 +0,0 @@
-
-
-
-Capture
-
-
-
-Capture
--
-
- Packet Capture Object
-
-Super Class:
-Object
-Included Modules:
-
-Enumerable
-
-Class Methods:
-
--
-
open_live(device[, snaplen[, promisc[, to_ms]]])
- -
-
-
- Open specified device and return Capture
- object.
- Default value for snaplen,
- promisc and to_ms are 68 octets,
- true
and 1000 milliseconds.
-
- -
-
open_offline(filename)
- -
-
-
- Open filename and return Capture
object.
-
-
-Methods:
-
--
-
close
- -
-
-
- Close Capture
object.
-
- -
-
datalink
- -
-
-
- Return an integer representing data-link type.
- (e.g. DLT_EN10MB
)
-
- -
-
dispatch([count]) {|packet|...}
- -
-
-
-
-
- Iterate over each packet. The argument given to the block
- is an instance of Packet
or its sub-class.
-
-
-
-
- count specifies the maximum number of packets to
- process. a count of -1 processes all the packets
- received in one buffer. a count of 0 processes all
- packets until an error occurs, EOF is reached, or the read
- times out.
- Default of count is -1.
-
-
-
- -
-
each_packet([count]) {|packet|...}
- -
-
-
-
each([count]) {|packet|...}
- -
-
-
-
loop([count]) {|packet|...}
- -
-
-
-
-
- Iterate over each packet. The argument given to the block
- is an instance of Packet
or its sub-class.
-
-
-
-
- count specifies the maximum number of packets to
- process. A negative count processes packets forever
- or until EOF is reached. Default of count is -1.
-
-
-
- -
-
snapshot
- -
-
-
-
snaplen
- -
-
-
- Return the snapshot length.
-
- -
-
setfilter(filter[, optimize])
- -
-
-
- Specify filter as packet filter.
- filter can be a string or a Filter
object.
- optimize controls whether optimization is performed.
- Default of optimize is true
.
-
- -
-
stats
- -
-
-
- Return a Struct
which represents packet statistics.
- This struct has following members.
-
-
-recv
- number of received packets
drop
- number of dropped packets
-
-
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc/Dumper.html b/external/ruby-pcapx/doc/Dumper.html
deleted file mode 100644
index 28a84f04e3..0000000000
--- a/external/ruby-pcapx/doc/Dumper.html
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-Dumper
-
-
-
-Dumper
--
-
- Class to dump packets to tcpdump-format file. Generated file
- can be read with tcpdump and
Capture.open_offline
.
-
-Super Class:
-Object
-Class Methods:
-
--
-
open(capture, filename)
- -
-
-
- Return a Dumper
to dump packets captured by
- capture to filename.
-
-
-Methods:
-
--
-
close
- -
-
-
- close Dumper
.
-
- -
-
dump(packet)
- -
-
-
- Dump packet to this Dumper
.
- packet must be a packet captured by
- Capture
specified when opening this Dumper
.
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc/Filter.html b/external/ruby-pcapx/doc/Filter.html
deleted file mode 100644
index 68e2ea4164..0000000000
--- a/external/ruby-pcapx/doc/Filter.html
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-
-Filter
-
-
-
-Filter
--
-
-
Filter
determines whether a packet satisfies
- specified condition. Actually Filter
is
- wrapper for bpf_program
. For details of filter
- expression, see tcpdump(1)
.
-
-Super Class:
-Object
-Class Methods:
-
--
-
compile(expr, capture[, optimize[, netmask]])
- -
-
-
-
new(expr, capture[, optimize[, netmask]])
- -
-
-
-
-
- Create a new Filter
object.
- expr is a filter string. capture
- is a Capture
object. optimize
- controls optimization of resulting code.
- netmask specifies the netmask of the local net.
-
-
-
-
- Created Filter
can be applied to packets
- captured via capture.
-
-
-
-
- If libpcap-0.5 or later
- used, one of following values can be specified
- instead of capture:
-
-
-[snaplen, datalink]
- an array containing required parameters
- omitted (or
nil
) - Ethernet default
- (
[68, DLT_EN10MB
]
)
-
-
-
-
-
-
-
-Methods:
-
--
-
self === packet
- -
-
-
-
self =~ packet
- -
-
-
- Return true if packet matches this filter.
-
- -
-
~ self
- -
-
-
- Return a Filter
which represents
- "not self
".
-
- -
-
self | other
- -
-
-
- Return a Filter
which represents
- "self
or other".
-
- -
-
self & other
- -
-
-
- Return a Filter
which represents
- "self
and other".
-
- -
-
source
- -
-
-
- Returns the orginal string from which the filter is constructed.
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc/ICMPPacket.html b/external/ruby-pcapx/doc/ICMPPacket.html
deleted file mode 100644
index ba99a09edd..0000000000
--- a/external/ruby-pcapx/doc/ICMPPacket.html
+++ /dev/null
@@ -1,184 +0,0 @@
-
-
-
-ICMPPacket
-
-
-
-ICMPPacket
--
-
-
-
- A packet carrying ICMP message.
-
-
- ICMP message formats are vary according to ICMP type.
- Thus some fields exist in certain types of packet. Any
- attempt to access nonexistence field raises an exception.
-
-
-
-
- Type, code and cksum fields are valid for any ICMP type.
-
-
-
-
-
-Super Class:
-IPPacket
-Methods:
-
--
-
icmp_cksum
- -
-
-
- Return ICMP checksum.
-
- -
-
icmp_code
- -
-
-
- Return ICMP code.
-
- -
-
icmp_data
- -
-
-
- Return data portion of ICMP_ECHO/ICMP_ECHOREPLY
- messages as String
-
- -
-
icmp_gwaddr
- -
-
-
- Return gateway address of ICMP_REDIRECT message as
- IPAddress
.
-
- -
-
icmp_id
- -
-
-
- Return identifier.
-
- -
-
icmp_ip
- -
-
-
- Return original IP Datagram as IPPacket
.
-
- -
-
icmp_lifetime
- -
-
-
- Return lifetime of ICMP_ROUTERADVERT message.
-
- -
-
icmp_nextmtu
- -
-
-
- Return Next Hop MTU of ICMP_UNREACH_NEEDFRAG message
- (See rfc1191).
-
- -
-
icmp_num_addrs
- -
-
-
- Return number of addresses of ICMP_ROUTERADVERT message.
-
- -
-
icmp_otime
- -
-
-
-
icmp_rtime
- -
-
-
-
icmp_ttime
- -
-
-
- Return timestamp of
- ICMP_TSTAMP/ICMP_TSTAMPREPLY message as Time
.
-
- -
-
icmp_pptr
- -
-
-
- Return error pointer of ICMP_PARAMPROB message.
-
- -
-
icmp_radv(nth)
- -
-
-
- Return nth address entry of
- ICMP_ROUTERADVERT message. Returned value is a two
- elements array [address, preference]
.
-
- -
-
icmp_seq
- -
-
-
- Return sequence number.
-
- -
-
icmp_seqle
- -
-
-
-
-
- Return sequence number interpreted as little endian.
-
-
-
-
- No small portion of ping
command
- implementations write sequence number in host byte
- order. Thus the sequence number of ICMP messages
- transmitted from little endian host may be in little
- endian.
-
-
-
- -
-
icmp_type
- -
-
-
- Return ICMP type.
-
- -
-
icmp_typestr
- -
-
-
- Return string describing ICMP type (e.g. "echo reply").
-
- -
-
icmp_wpa
- -
-
-
- Return word per address entry of ICMP_ROUTERADVERT message.
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc/IPAddress.html b/external/ruby-pcapx/doc/IPAddress.html
deleted file mode 100644
index c211041723..0000000000
--- a/external/ruby-pcapx/doc/IPAddress.html
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-IPAddress
-
-
-
-IPAddress
--
-
- IP Address object.
-
-Super Class:
-Object
-Methods:
-
--
-
self == other
- -
-
-
- Return true
if two addresses are the same address.
-
- -
-
hostname
- -
-
-
- Return host name correspond to this address.
-
- -
-
to_i
- -
-
-
- Return the value of IP address as integer.
-
- -
-
to_num_s
- -
-
-
- Return numerical string representation
-
- -
-
to_s
- -
-
-
- Return numerical string representation or host name.
- Behavior of this method is controlled by Pcap.convert=
.
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc/IPPacket.html b/external/ruby-pcapx/doc/IPPacket.html
deleted file mode 100644
index c553608b56..0000000000
--- a/external/ruby-pcapx/doc/IPPacket.html
+++ /dev/null
@@ -1,142 +0,0 @@
-
-
-
-IPPacket
-
-
-
-IPPacket
--
-
- A packet carrying IP header.
-
-Super Class:
-Packet
-Methods:
-
--
-
ip_data
- -
-
-
- Return data part as String
.
-
- -
-
ip_df?
- -
-
-
- Return true
if Don't Fragment bit is set.
-
- -
-
ip_dst
- -
-
-
-
dst
- -
-
-
- Return destination IP address as IPAddress
.
-
- -
-
ip_flags
- -
-
-
- Return the value of 3-bits IP flag field.
-
- -
-
ip_hlen
- -
-
-
- Return header length. (Unit: 4 octets)
-
- -
-
ip_id
- -
-
-
- Return identification.
-
- -
-
ip_len
- -
-
-
- Return total length.
-
- -
-
ip_mf?
- -
-
-
- Return true
if More Fragment bit is set.
-
- -
-
ip_off
- -
-
-
- Return fragment offset.
-
- -
-
ip_proto
- -
-
-
- Return the value of protocol field.
-
- -
-
ip_src
- -
-
-
-
src
- -
-
-
- Return source IP address as IPAddress
.
-
- -
-
ip_sum
- -
-
-
- Return the value of checksum field.
-
- -
-
ip_tos
- -
-
-
- Return the value of TOS field.
-
- -
-
ip_ttl
- -
-
-
- Return TTL.
-
- -
-
ip_ver
- -
-
-
- Return IP version.
-
- -
-
to_s
- -
-
-
- Return string representation.
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc/Packet.html b/external/ruby-pcapx/doc/Packet.html
deleted file mode 100644
index 6e958b1042..0000000000
--- a/external/ruby-pcapx/doc/Packet.html
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-Packet
-
-
-
-Packet
--
-
- Packet captured with
Capture
object.
- Packet
and its sub-classes are Marshal
compliant.
-
-Super Class:
-Object
-Methods:
-
--
-
caplen
- -
-
-
- Return captured length.
-
- -
-
datalink
- -
-
-
- Return an integer representing data-link type.
- (e.g. DLT_EN10MB
)
-
- -
-
ip?
- -
-
-
- Return true
if this packet is an instance of
- IPPacket
or its sub-class.
-
- -
-
len
- -
-
-
-
length
- -
-
-
-
size
- -
-
-
- Return total length of packet.
-
- -
-
raw_data
- -
-
-
- Return raw data of packet as String
.
-
- -
-
tcp?
- -
-
-
- Return true
if this packet is an instance of
- TCPPacket
or its sub-class.
-
- -
-
time
- -
-
-
- Return timestamp as Time
.
-
- -
-
time_i
- -
-
-
- Return timestamp as integer.
-
- -
-
udp?
- -
-
-
- Return true
if this packet is an instance of
- UDPPacket
or its sub-class.
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc/Pcap.html b/external/ruby-pcapx/doc/Pcap.html
deleted file mode 100644
index 3323832df8..0000000000
--- a/external/ruby-pcapx/doc/Pcap.html
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-
-Pcap
-
-
-
-Pcap
--
-
-
Pcap
defines general methods and constants related to
- pcap.
-
-Constants:
-
--
-
DLT_NULL
- -
-
-
-
DLT_EN10MB
- -
-
-
-
DLT_EN3MB
- -
-
-
-
DLT_AX25
- -
-
-
-
DLT_PRONET
- -
-
-
-
DLT_CHAOS
- -
-
-
-
DLT_IEEE802
- -
-
-
-
DLT_ARCNET
- -
-
-
-
DLT_SLIP
- -
-
-
-
DLT_PPP
- -
-
-
-
DLT_FDDI
- -
-
-
-
DLT_ATM_RFC1483
- -
-
-
-
DLT_RAW
- -
-
-
-
DLT_SLIP_BSDOS
- -
-
-
-
DLT_PPP_BSDOS
- -
-
-
- Data-link type constants.
-
-
-Module Methods:
-
--
-
convert = bool
- -
-
-
- Set the behavior of classes under module Pcap
- when they convert IP address or other numbers to string.
- Value true
means that the numbers are converted
- to their symbolic name.
-
- -
-
convert?
- -
-
-
- Return the behavior of classes under module Pcap
- when they convert IP address or other numbers to string.
- Value true
means that the numbers are converted
- to their symbolic name.
-
- -
-
lookupdev
- -
-
-
- Return a name of network device.
-
- -
-
lookupnet(device)
- -
-
-
- Return a two-element array
- [net, mask]
.
- net
is network number as IPAddress
.
- mask
is netmask as Integer
.
- Argument device is network device name.
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc/PcapError.html b/external/ruby-pcapx/doc/PcapError.html
deleted file mode 100644
index a444e96af4..0000000000
--- a/external/ruby-pcapx/doc/PcapError.html
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-PcapError
-
-
-
-PcapError
--
-
- Exception about pcap.
-
-Super Class:
-StandardError
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc/Pcaplet.html b/external/ruby-pcapx/doc/Pcaplet.html
deleted file mode 100644
index cca75ba797..0000000000
--- a/external/ruby-pcapx/doc/Pcaplet.html
+++ /dev/null
@@ -1,108 +0,0 @@
-
-
-
-Pcaplet
-
-
-
-Pcaplet
--
-
-
-
- Pcaplet
provides a template for packet monitoring tool
- using Capture
.
- You need to require 'pcaplet'
to use this class.
-
-
-
-
- Typical usage:
-
-require 'pcaplet'
-
-my_tool = Pcaplet.new
-my_tool.each_packet {|pkt|
- # code for processing pkt
-}
-my_tool.close
-
-
-
-
-
-
-
- Pcaplet
interprets filter expression specified in
- command line and following command line options as tcpdump does.
-
--i -r -c -s -n
-
-
-
- '-r
' option can handle gzipped file.
-
-
-
-Super Class:
-Object
-Class Methods:
-
--
-
new([option])
- -
-
-
- Generate Pcaplet
instance. Command line
- analysis and device open is performed.
- option is added to command line options.
-
-
-Methods:
-
--
-
add_filter(filter)
- -
-
-
- Add filter to the filter specified in command line.
- Filter is set as follows.
-
-"( current_filter ) and ( filter )"
-
-
-
-
- -
-
each_packet {|packet|...}
- -
-
-
-
each {|packet|...}
- -
-
-
- Iterate over each packet. The argument given to the block
- is an instance of Packet
or its sub-class.
-
- -
-
capture
- -
-
-
- Return Capture
object which is used internally.
-
- -
-
close
- -
-
-
- Close underlying device.
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc/TCPPacket.html b/external/ruby-pcapx/doc/TCPPacket.html
deleted file mode 100644
index 92675b7fa8..0000000000
--- a/external/ruby-pcapx/doc/TCPPacket.html
+++ /dev/null
@@ -1,147 +0,0 @@
-
-
-
-TCPPacket
-
-
-
-TCPPacket
--
-
- A packet carrying TCP header.
-
-Super Class:
-IPPacket
-Methods:
-
--
-
tcp_ack
- -
-
-
- Return acknowledgement number.
-
- -
-
tcp_data
- -
-
-
- Return data part as String
.
-
- -
-
tcp_data_len
- -
-
-
- Return length of data part.
-
- -
-
tcp_dport
- -
-
-
-
dport
- -
-
-
- Return destination port number.
-
- -
-
tcp_flags
- -
-
-
- Return the value of 6-bits flag field.
-
- -
-
tcp_flags_s
- -
-
-
- Return the value of 6-bits flag field as string like
- ".A...F"
.
-
- -
-
tcp_fin?
- -
-
-
-
tcp_syn?
- -
-
-
-
tcp_rst?
- -
-
-
-
tcp_psh?
- -
-
-
-
tcp_ack?
- -
-
-
-
tcp_urg?
- -
-
-
- Return true
if flag is set.
-
- -
-
tcp_off
- -
-
-
-
tcp_hlen
- -
-
-
- Return TCP data offset (header length). (Unit: 4-octets)
-
- -
-
tcp_seq
- -
-
-
- Return sequence number.
-
- -
-
tcp_sum
- -
-
-
- Return the value of checksum field.
-
- -
-
tcp_sport
- -
-
-
-
sport
- -
-
-
- Return source port number.
-
- -
-
tcp_urp
- -
-
-
- Return urgent pointer.
-
- -
-
tcp_win
- -
-
-
- Return window size.
-
- -
-
to_s
- -
-
-
- Return string representation.
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc/TruncatedPacket.html b/external/ruby-pcapx/doc/TruncatedPacket.html
deleted file mode 100644
index 1a3f672a44..0000000000
--- a/external/ruby-pcapx/doc/TruncatedPacket.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-TruncatedPacket
-
-
-
-TruncatedPacket
--
-
- Requested packet information is not available because necessary data
- is truncated out of capture buffer.
-
-Super Class:
-PcapError
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc/UDPPacket.html b/external/ruby-pcapx/doc/UDPPacket.html
deleted file mode 100644
index 3b476eede0..0000000000
--- a/external/ruby-pcapx/doc/UDPPacket.html
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-UDPPacket
-
-
-
-UDPPacket
--
-
- A packet carrying UDP header.
-
-Super Class:
-IPPacket
-Methods:
-
--
-
udp_data
- -
-
-
- Return data part as String
.
-
- -
-
udp_dport
- -
-
-
-
dport
- -
-
-
- Return destination port number.
-
- -
-
udp_len
- -
-
-
- Return value of length field. This value represents
- the length in octets of this UDP datagram.
-
- -
-
udp_sum
- -
-
-
- Return the value of checksum field.
-
- -
-
udp_sport
- -
-
-
-
sport
- -
-
-
- Return source port number.
-
- -
-
to_s
- -
-
-
- Return string representation.
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
-
diff --git a/external/ruby-pcapx/doc/index.html b/external/ruby-pcapx/doc/index.html
deleted file mode 100644
index 80f0ef882a..0000000000
--- a/external/ruby-pcapx/doc/index.html
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-Ruby/Pcap Library
-
-
-
-Ruby/Pcap extension library
-
-Ruby interface to LBL libpcap (Packet Capture library).
-
-Modules
-
-
-Classes
-
-Following classes are defined under module Pcap
.
-When you use these classes, you need to include
module
-Pcap
or refer them like Pcap::Capture
.
-
-
-
-Exceptions
-
-
-
-
-
-
-fukusima@goto.info.waseda.ac.jp
-
-
diff --git a/external/ruby-pcapx/examples/httpdump.rb b/external/ruby-pcapx/examples/httpdump.rb
deleted file mode 100755
index 57a470f32b..0000000000
--- a/external/ruby-pcapx/examples/httpdump.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/local/bin/ruby
-require 'pcaplet'
-httpdump = Pcaplet.new('-s 1500')
-
-HTTP_REQUEST = Pcap::Filter.new('tcp and dst port 80', httpdump.capture)
-HTTP_RESPONSE = Pcap::Filter.new('tcp and src port 80', httpdump.capture)
-
-httpdump.add_filter(HTTP_REQUEST | HTTP_RESPONSE)
-httpdump.each_packet {|pkt|
- data = pkt.tcp_data
- case pkt
- when HTTP_REQUEST
- if data and data =~ /^GET\s+(\S+)/
- path = $1
- host = pkt.dst.to_s
- host << ":#{pkt.dst_port}" if pkt.dport != 80
- s = "#{pkt.src}:#{pkt.sport} > GET http://#{host}#{path}"
- end
- when HTTP_RESPONSE
- if data and data =~ /^(HTTP\/.*)$/
- status = $1
- s = "#{pkt.dst}:#{pkt.dport} < #{status}"
- end
- end
- puts s if s
-}
diff --git a/external/ruby-pcapx/examples/tcpdump.rb b/external/ruby-pcapx/examples/tcpdump.rb
deleted file mode 100755
index 2644382406..0000000000
--- a/external/ruby-pcapx/examples/tcpdump.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/local/bin/ruby
-require 'pcaplet'
-include Pcap
-
-class Time
- # tcpdump style format
- def to_s
- sprintf "%0.2d:%0.2d:%0.2d.%0.6d", hour, min, sec, tv_usec
- end
-end
-
-pcaplet = Pcaplet.new
-pcaplet.each_packet { |pkt|
- print "#{pkt.time} #{pkt}"
- if pkt.tcp?
- print " (#{pkt.tcp_data_len})"
- print " ack #{pkt.tcp_ack}" if pkt.tcp_ack?
- print " win #{pkt.tcp_win}"
- end
- if pkt.ip?
- print " (DF)" if pkt.ip_df?
- end
- print "\n"
-}
-pcaplet.close
diff --git a/external/ruby-pcapx/examples/test.rb b/external/ruby-pcapx/examples/test.rb
deleted file mode 100755
index 4c17967147..0000000000
--- a/external/ruby-pcapx/examples/test.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/local/bin/ruby
-require 'pcap'
-
-dev = Pcap.lookupdev
-cap = Pcap::Capture.open_live(dev)
-cap.setfilter("ip")
-cap.loop do |pkt|
- print pkt, "\n"
-end
-cap.close
diff --git a/external/ruby-pcapx/extconf.rb b/external/ruby-pcapx/extconf.rb
deleted file mode 100644
index 786bd973d1..0000000000
--- a/external/ruby-pcapx/extconf.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-require 'mkmf'
-
-pcap_dir = with_config("pcap-dir", "/usr/local")
-pcap_includedir = with_config("pcap-includedir", pcap_dir + "/include")
-pcap_libdir = with_config("pcap-libdir", pcap_dir + "/lib")
-
-$CFLAGS = "-I#{pcap_includedir}"
-$LDFLAGS = "-L#{pcap_libdir}"
-
-have_library("socket", "socket")
-have_library("xnet", "gethostbyname")
-have_func("hstrerror")
-if have_header("pcap.h") && have_library("pcap", "pcap_open_live")
- have_func("pcap_compile_nopcap")
- create_makefile("PcapX")
-end
diff --git a/external/ruby-pcapx/icmp_packet.c b/external/ruby-pcapx/icmp_packet.c
deleted file mode 100644
index a99e911757..0000000000
--- a/external/ruby-pcapx/icmp_packet.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
- * icmp_packet.c
- *
- * $Id: icmp_packet.c,v 1.1.1.1 1999/10/27 09:54:38 fukusima Exp $
- *
- * Copyright (C) 1999 Masaki Fukushima
- */
-
-#include "ruby_pcap.h"
-
-/* rfc1256 */
-#ifndef ICMP_ROUTERADVERT
-#define ICMP_ROUTERADVERT 9
-#endif
-#ifndef ICMP_ROUTERSOLICIT
-#define ICMP_ROUTERSOLICIT 10
-#endif
-
-/* rfc1393 */
-#ifndef ICMP_TROUTE
-#define ICMP_TROUTE 30
-#endif
-
-/* rfc1788 */
-#ifndef ICMP_DOMAIN
-#define ICMP_DOMAIN 37
-#endif
-#ifndef ICMP_DOMAINREPLY
-#define ICMP_DOMAINREPLY 38
-#endif
-
-/* rfc1700 */
-#ifndef ICMP_UNREACH_NET_UNKNOWN
-#define ICMP_UNREACH_NET_UNKNOWN 6
-#endif
-#ifndef ICMP_UNREACH_HOST_UNKNOWN
-#define ICMP_UNREACH_HOST_UNKNOWN 7
-#endif
-#ifndef ICMP_UNREACH_ISOLATED
-#define ICMP_UNREACH_ISOLATED 8
-#endif
-#ifndef ICMP_UNREACH_NET_PROHIB
-#define ICMP_UNREACH_NET_PROHIB 9
-#endif
-#ifndef ICMP_UNREACH_HOST_PROHIB
-#define ICMP_UNREACH_HOST_PROHIB 10
-#endif
-#ifndef ICMP_UNREACH_TOSNET
-#define ICMP_UNREACH_TOSNET 11
-#endif
-#ifndef ICMP_UNREACH_TOSHOST
-#define ICMP_UNREACH_TOSHOST 12
-#endif
-
-/* rfc1716 */
-#ifndef ICMP_UNREACH_FILTER_PROHIB
-#define ICMP_UNREACH_FILTER_PROHIB 13
-#endif
-#ifndef ICMP_UNREACH_HOST_PRECEDENCE
-#define ICMP_UNREACH_HOST_PRECEDENCE 14
-#endif
-#ifndef ICMP_UNREACH_PRECEDENCE_CUTOFF
-#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15
-#endif
-
-#ifndef ICMP_PARAMPROB_OPTABSENT
-#define ICMP_PARAMPROB_OPTABSENT 1
-#endif
-
-#define ICMP_HDR(pkt) ((struct icmp *)LAYER4_HDR(pkt))
-#define ICMP_DATA(pkt) ((u_char *)LAYER5_HDR(pkt))
-#define ICMP_DATALEN(pkt) \
- (ntohs(IP_HDR(pkt)->ip_len) - (IP_HDR(pkt)->ip_hl * 4 + 8))
-#define ICMP_CAPLEN(pkt) (pkt->hdr.pkthdr.caplen - pkt->hdr.layer4_off)
-
-VALUE cICMPPacket;
-
-#define CheckTruncateICMP(pkt, need) \
- CheckTruncate(pkt, pkt->hdr.layer4_off, need, "truncated ICMP")
-
-struct icmp_type_info {
- char *name;
- VALUE klass;
-};
-static struct icmp_type_info icmp_types[] = {
- {/* 0 */ "echo reply" },
- {},{},
- {/* 3 */ "unreachable" },
- {/* 4 */ "source quench" },
- {/* 5 */ "redirect" },
- {},{},
- {/* 8 */ "echo request" },
- {/* 9 */ "router advertisement" },
- {/* 10 */ "router solicitation" },
- {/* 11 */ "time exceeded" },
- {/* 12 */ "parameter problem" },
- {/* 13 */ "time stamp request" },
- {/* 14 */ "time stamp reply" },
- {/* 15 */ "information request" },
- {/* 16 */ "information reply" },
- {/* 17 */ "address mask request" },
- {/* 18 */ "address mask reply" },
- {},{},{},{},{},{},{},{},{},{},{},
- {/* 30 */ "traceroute" },
- {},{},{},{},{},{},
- {/* 37 */ "domain name request" },
- {/* 38 */ "domain name reply" }
-#define ICMP_TYPE_MAX 38
-};
-
-VALUE
-setup_icmp_packet(pkt, tl_len)
- struct packet_object *pkt;
- int tl_len;
-{
- VALUE klass = cICMPPacket;
-
- if (tl_len >= 1) {
- struct icmp *icmp = ICMP_HDR(pkt);
- if (icmp->icmp_type <= ICMP_TYPE_MAX
- && icmp_types[icmp->icmp_type].klass) {
- klass = icmp_types[icmp->icmp_type].klass;
- }
- }
- return klass;
-}
-
-
-#define ICMPP_METHOD(func, need, val) \
-static VALUE\
-(func)(self)\
- VALUE self;\
-{\
- struct packet_object *pkt;\
- struct icmp *icmp;\
- GetPacket(self, pkt);\
- CheckTruncateICMP(pkt, (need));\
- icmp = ICMP_HDR(pkt);\
- return (val);\
-}
-
-/*
- * Common methods (icmp_type independent)
- */
-
-ICMPP_METHOD(icmpp_type, 1, INT2FIX(icmp->icmp_type))
-ICMPP_METHOD(icmpp_code, 2, INT2FIX(icmp->icmp_code))
-ICMPP_METHOD(icmpp_cksum, 4, INT2FIX(ntohs(icmp->icmp_cksum)))
-ICMPP_METHOD(icmpp_typestr, 1,
- (icmp->icmp_type <= ICMP_TYPE_MAX
- &&icmp_types[icmp->icmp_type].name)
- ? rb_str_new2(icmp_types[icmp->icmp_type].name)
- : rb_obj_as_string(INT2FIX(icmp->icmp_type)))
-
-
-/*
- * icmp_type specific methods
- */
-
-ICMPP_METHOD(icmpp_pptr, 5, INT2FIX(icmp->icmp_pptr))
-ICMPP_METHOD(icmpp_gwaddr, 8, new_ipaddr(&icmp->icmp_gwaddr))
-ICMPP_METHOD(icmpp_id, 6, INT2FIX(ntohs(icmp->icmp_id)))
-ICMPP_METHOD(icmpp_seq, 8, INT2FIX(ntohs(icmp->icmp_seq)))
-#ifdef WORDS_BIGENDIAN
-ICMPP_METHOD(icmpp_seqle, 8, INT2FIX(((0x00ff&icmp->icmp_seq)<<8) +
- (icmp->icmp_seq >> 8)))
-#else
-ICMPP_METHOD(icmpp_seqle, 8, INT2FIX(icmp->icmp_seq))
-#endif
-
-/* rfc1191 */
-struct mtu_discovery {
- u_short unused;
- u_short nextmtu;
-};
-#define MTUD(icmp) ((struct mtu_discovery *)&icmp->icmp_void)
-
-static VALUE
-icmpp_nextmtu(self)
- VALUE self;
-{
- struct packet_object *pkt;
- struct icmp *icmp;
-
- GetPacket(self, pkt);
- CheckTruncateICMP(pkt, 8);
- icmp = ICMP_HDR(pkt);
-
- if (icmp->icmp_code != ICMP_UNREACH_NEEDFRAG)
- rb_raise(rb_eRuntimeError, "not ICMP_UNREACH_NEEDFRAG");
- return INT2FIX(ntohs(MTUD(icmp)->nextmtu));
-}
-
-/* rfc1256 */
-struct ih_rdiscovery {
- u_char num_addrs;
- u_char wpa;
- u_short lifetime;
-};
-#define IHRD(icmp) ((struct ih_rdiscovery *)&icmp->icmp_void)
-
-struct id_rdiscovery {
- struct in_addr ird_addr;
- long ird_pref;
-};
-#define IDRD(icmp) ((struct id_rdiscovery *)icmp->icmp_data)
-
-ICMPP_METHOD(icmpp_num_addrs, 5, INT2FIX(IHRD(icmp)->num_addrs))
-ICMPP_METHOD(icmpp_wpa, 6, INT2FIX(IHRD(icmp)->wpa))
-ICMPP_METHOD(icmpp_lifetime, 8, INT2FIX(ntohs(IHRD(icmp)->lifetime)))
-
-static VALUE
-icmpp_radv(self, ind)
- VALUE self, ind;
-{
- struct packet_object *pkt;
- struct icmp *icmp;
- int i = NUM2INT(ind);
- VALUE ary;
-
- GetPacket(self, pkt);
- CheckTruncateICMP(pkt, 5);
- if (i > IHRD(icmp)->num_addrs)
- rb_raise(rb_eRuntimeError, "num_addrs = %d, requested radv(%d)",
- (int)IHRD(icmp)->num_addrs, i);
-
- CheckTruncateICMP(pkt, 8 + i*8);
- icmp = ICMP_HDR(pkt);
-
- ary = rb_ary_new();
- rb_ary_push(ary, new_ipaddr(&IDRD(icmp)->ird_addr));
- rb_ary_push(ary, INT2NUM(ntohl(IDRD(icmp)->ird_pref)));
- return ary;
-}
-
-#define time_new_msec(t) rb_time_new((t)/1000, (t)%1000 * 1000)
-ICMPP_METHOD(icmpp_otime, 12, time_new_msec(ntohl(icmp->icmp_otime)))
-ICMPP_METHOD(icmpp_rtime, 16, time_new_msec(ntohl(icmp->icmp_rtime)))
-ICMPP_METHOD(icmpp_ttime, 20, time_new_msec(ntohl(icmp->icmp_ttime)))
-
-static VALUE
-icmpp_ip(self)
- VALUE self;
-{
- struct packet_object *pkt;
- struct icmp *icmp;
- struct pcap_pkthdr pkthdr;
-
- GetPacket(self, pkt);
- CheckTruncateICMP(pkt, 9);
- icmp = ICMP_HDR(pkt);
-
- pkthdr.caplen = ICMP_CAPLEN(pkt) - 8;
- pkthdr.len = 0;
- pkthdr.ts.tv_sec = 0;
- pkthdr.ts.tv_usec = 0;
- return new_packet((char *)&icmp->icmp_ip, &pkthdr, DLT_RAW);
-}
-
-ICMPP_METHOD(icmpp_mask, 12, UINT32_2_NUM(ntohl(icmp->icmp_mask)))
-ICMPP_METHOD(icmpp_data, 9, rb_str_new(icmp->icmp_data, ICMP_CAPLEN(pkt)-8))
-
-/* rfc1393 */
-struct traceroute {
- u_short ohc;
- u_short rhc;
- u_long lspeed;
- u_long lmtu;
-};
-#define TROUTE(icmp) ((struct traceroute *)icmp->icmp_data)
-ICMPP_METHOD(icmpp_ohc, 10, INT2FIX(ntohs(TROUTE(icmp)->ohc)))
-ICMPP_METHOD(icmpp_rhc, 12, INT2FIX(ntohs(TROUTE(icmp)->rhc)))
-ICMPP_METHOD(icmpp_lspeed, 16, UINT32_2_NUM(ntohl(TROUTE(icmp)->lspeed)))
-ICMPP_METHOD(icmpp_lmtu, 20, UINT32_2_NUM(ntohl(TROUTE(icmp)->lmtu)))
-
-/* rfc1788 */
-struct domain_reply {
- u_long ttl;
- char names[1];
-};
-#define DOMAIN(icmp) ((struct domain_reply *)icmp->icmp_data)
-ICMPP_METHOD(icmpp_ttl, 12, UINT32_2_NUM(ntohl(DOMAIN(icmp)->ttl)))
-
-void
-Init_icmp_packet(void)
-{
- VALUE klass;
-
- rb_define_const(mPcap, "ICMP_ECHOREPLY", INT2NUM(ICMP_ECHOREPLY));
- rb_define_const(mPcap, "ICMP_UNREACH", INT2NUM(ICMP_UNREACH));
- rb_define_const(mPcap, "ICMP_SOURCEQUENCH",INT2NUM(ICMP_SOURCEQUENCH));
- rb_define_const(mPcap, "ICMP_REDIRECT", INT2NUM(ICMP_REDIRECT));
- rb_define_const(mPcap, "ICMP_ECHO", INT2NUM(ICMP_ECHO));
- rb_define_const(mPcap, "ICMP_TIMXCEED", INT2NUM(ICMP_TIMXCEED));
- rb_define_const(mPcap, "ICMP_PARAMPROB", INT2NUM(ICMP_PARAMPROB));
- rb_define_const(mPcap, "ICMP_TSTAMP", INT2NUM(ICMP_TSTAMP));
- rb_define_const(mPcap, "ICMP_TSTAMPREPLY", INT2NUM(ICMP_TSTAMPREPLY));
- rb_define_const(mPcap, "ICMP_IREQ", INT2NUM(ICMP_IREQ));
- rb_define_const(mPcap, "ICMP_IREQREPLY", INT2NUM(ICMP_IREQREPLY));
- rb_define_const(mPcap, "ICMP_MASKREQ", INT2NUM(ICMP_MASKREQ));
- rb_define_const(mPcap, "ICMP_MASKREPLY", INT2NUM(ICMP_MASKREPLY));
-
- /* UNREACH codes */
- rb_define_const(mPcap, "ICMP_UNREACH_NET", INT2NUM(ICMP_UNREACH_NET));
- rb_define_const(mPcap, "ICMP_UNREACH_HOST", INT2NUM(ICMP_UNREACH_HOST));
- rb_define_const(mPcap, "ICMP_UNREACH_PROTOCOL", INT2NUM(ICMP_UNREACH_PROTOCOL));
- rb_define_const(mPcap, "ICMP_UNREACH_PORT", INT2NUM(ICMP_UNREACH_PORT));
- rb_define_const(mPcap, "ICMP_UNREACH_NEEDFRAG", INT2NUM(ICMP_UNREACH_NEEDFRAG));
- rb_define_const(mPcap, "ICMP_UNREACH_SRCFAIL", INT2NUM(ICMP_UNREACH_SRCFAIL));
- rb_define_const(mPcap, "ICMP_UNREACH_NET_UNKNOWN", INT2NUM(ICMP_UNREACH_NET_UNKNOWN));
- rb_define_const(mPcap, "ICMP_UNREACH_HOST_UNKNOWN", INT2NUM(ICMP_UNREACH_HOST_UNKNOWN));
- rb_define_const(mPcap, "ICMP_UNREACH_ISOLATED", INT2NUM(ICMP_UNREACH_ISOLATED));
- rb_define_const(mPcap, "ICMP_UNREACH_NET_PROHIB", INT2NUM(ICMP_UNREACH_NET_PROHIB));
- rb_define_const(mPcap, "ICMP_UNREACH_HOST_PROHIB", INT2NUM(ICMP_UNREACH_HOST_PROHIB));
- rb_define_const(mPcap, "ICMP_UNREACH_TOSNET", INT2NUM(ICMP_UNREACH_TOSNET));
- rb_define_const(mPcap, "ICMP_UNREACH_TOSHOST", INT2NUM(ICMP_UNREACH_TOSHOST));
- rb_define_const(mPcap, "ICMP_UNREACH_FILTER_PROHIB", INT2NUM(ICMP_UNREACH_FILTER_PROHIB));
- rb_define_const(mPcap, "ICMP_UNREACH_HOST_PRECEDENCE", INT2NUM(ICMP_UNREACH_HOST_PRECEDENCE));
- rb_define_const(mPcap, "ICMP_UNREACH_PRECEDENCE_CUTOFF", INT2NUM(ICMP_UNREACH_PRECEDENCE_CUTOFF));
-
- /* REDIRECT codes */
- rb_define_const(mPcap, "ICMP_REDIRECT_NET", INT2NUM(ICMP_REDIRECT_NET));
- rb_define_const(mPcap, "ICMP_REDIRECT_HOST", INT2NUM(ICMP_REDIRECT_HOST));
- rb_define_const(mPcap, "ICMP_REDIRECT_TOSNET", INT2NUM(ICMP_REDIRECT_TOSNET));
- rb_define_const(mPcap, "ICMP_REDIRECT_TOSHOST", INT2NUM(ICMP_REDIRECT_TOSHOST));
-
- /* TIMEXCEED codes */
- rb_define_const(mPcap, "ICMP_TIMXCEED_INTRANS", INT2NUM(ICMP_TIMXCEED_INTRANS));
- rb_define_const(mPcap, "ICMP_TIMXCEED_REASS", INT2NUM(ICMP_TIMXCEED_REASS));
-
- /* PARAMPROB code */
- rb_define_const(mPcap, "ICMP_PARAMPROB_OPTABSENT", INT2NUM(ICMP_PARAMPROB_OPTABSENT));
-
- cICMPPacket = rb_define_class_under(mPcap, "ICMPPacket", cIPPacket);
- rb_define_method(cICMPPacket, "icmp_type", icmpp_type, 0);
- rb_define_method(cICMPPacket, "icmp_typestr", icmpp_typestr, 0);
- rb_define_method(cICMPPacket, "icmp_code", icmpp_code, 0);
- rb_define_method(cICMPPacket, "icmp_cksum", icmpp_cksum, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPEchoReply", cICMPPacket);
- icmp_types[ICMP_ECHOREPLY].klass = klass;
- rb_define_method(klass, "icmp_id", icmpp_id, 0);
- rb_define_method(klass, "icmp_seq", icmpp_seq, 0);
- rb_define_method(klass, "icmp_seqle", icmpp_seqle, 0);
- rb_define_method(klass, "icmp_data", icmpp_data, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPUnreach", cICMPPacket);
- icmp_types[ICMP_UNREACH].klass = klass;
- rb_define_method(klass, "icmp_nextmtu", icmpp_nextmtu, 0);
- rb_define_method(klass, "icmp_ip", icmpp_ip, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPSourceQuench", cICMPPacket);
- icmp_types[ICMP_SOURCEQUENCH].klass = klass;
- rb_define_method(klass, "icmp_ip", icmpp_ip, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPRedirect", cICMPPacket);
- icmp_types[ICMP_REDIRECT].klass = klass;
- rb_define_method(klass, "icmp_gwaddr", icmpp_gwaddr, 0);
- rb_define_method(klass, "icmp_ip", icmpp_ip, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPEcho", cICMPPacket);
- icmp_types[ICMP_ECHO].klass = klass;
- rb_define_method(klass, "icmp_id", icmpp_id, 0);
- rb_define_method(klass, "icmp_seq", icmpp_seq, 0);
- rb_define_method(klass, "icmp_seqle", icmpp_seqle, 0);
- rb_define_method(klass, "icmp_data", icmpp_data, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPRouterAdvert", cICMPPacket);
- icmp_types[ICMP_ROUTERADVERT].klass = klass;
- rb_define_method(klass, "icmp_num_addrs", icmpp_num_addrs, 0);
- rb_define_method(klass, "icmp_wpa", icmpp_wpa, 0);
- rb_define_method(klass, "icmp_lifetime", icmpp_lifetime, 0);
- rb_define_method(klass, "icmp_radv", icmpp_radv, 1);
-
- klass = rb_define_class_under(mPcap, "ICMPRouterSolicit", cICMPPacket);
- icmp_types[ICMP_ROUTERSOLICIT].klass = klass;
-
- klass = rb_define_class_under(mPcap, "ICMPTimxceed", cICMPPacket);
- icmp_types[ICMP_TIMXCEED].klass = klass;
- rb_define_method(klass, "icmp_ip", icmpp_ip, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPParamProb", cICMPPacket);
- icmp_types[ICMP_PARAMPROB].klass = klass;
- rb_define_method(klass, "icmp_pptr", icmpp_pptr, 0);
- rb_define_method(klass, "icmp_ip", icmpp_ip, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPTStamp", cICMPPacket);
- icmp_types[ICMP_TSTAMP].klass = klass;
- rb_define_method(klass, "icmp_id", icmpp_id, 0);
- rb_define_method(klass, "icmp_seq", icmpp_seq, 0);
- rb_define_method(klass, "icmp_otime", icmpp_otime, 0);
- rb_define_method(klass, "icmp_rtime", icmpp_rtime, 0);
- rb_define_method(klass, "icmp_ttime", icmpp_ttime, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPTStampReply", cICMPPacket);
- icmp_types[ICMP_TSTAMPREPLY].klass = klass;
- rb_define_method(klass, "icmp_id", icmpp_id, 0);
- rb_define_method(klass, "icmp_seq", icmpp_seq, 0);
- rb_define_method(klass, "icmp_otime", icmpp_otime, 0);
- rb_define_method(klass, "icmp_rtime", icmpp_rtime, 0);
- rb_define_method(klass, "icmp_ttime", icmpp_ttime, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPIReq", cICMPPacket);
- icmp_types[ICMP_IREQ].klass = klass;
- rb_define_method(klass, "icmp_id", icmpp_id, 0);
- rb_define_method(klass, "icmp_seq", icmpp_seq, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPIReqReply", cICMPPacket);
- icmp_types[ICMP_IREQREPLY].klass = klass;
- rb_define_method(klass, "icmp_id", icmpp_id, 0);
- rb_define_method(klass, "icmp_seq", icmpp_seq, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPMaskReq", cICMPPacket);
- icmp_types[ICMP_MASKREQ].klass = klass;
- rb_define_method(klass, "icmp_id", icmpp_id, 0);
- rb_define_method(klass, "icmp_seq", icmpp_seq, 0);
- /*rb_define_method(klass, "icmp_mask", icmpp_mask, 0);*/
-
- klass = rb_define_class_under(mPcap, "ICMPMaskReply", cICMPPacket);
- icmp_types[ICMP_MASKREPLY].klass = klass;
- rb_define_method(klass, "icmp_id", icmpp_id, 0);
- rb_define_method(klass, "icmp_seq", icmpp_seq, 0);
- /*rb_define_method(klass, "icmp_mask", icmpp_mask, 0);*/
-
- klass = rb_define_class_under(mPcap, "ICMPTRoute", cICMPPacket);
- icmp_types[ICMP_TROUTE].klass = klass;
- rb_define_method(klass, "icmp_id", icmpp_id, 0);
- rb_define_method(klass, "icmp_ohc", icmpp_ohc, 0);
- rb_define_method(klass, "icmp_rhc", icmpp_rhc, 0);
- rb_define_method(klass, "icmp_lspeed", icmpp_lspeed, 0);
- rb_define_method(klass, "icmp_lmtu", icmpp_lmtu, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPDomain", cICMPPacket);
- icmp_types[ICMP_DOMAIN].klass = klass;
- rb_define_method(klass, "icmp_id", icmpp_id, 0);
- rb_define_method(klass, "icmp_seq", icmpp_seq, 0);
-
- klass = rb_define_class_under(mPcap, "ICMPDomainReply", cICMPPacket);
- icmp_types[ICMP_DOMAINREPLY].klass = klass;
- rb_define_method(klass, "icmp_id", icmpp_id, 0);
- rb_define_method(klass, "icmp_seq", icmpp_seq, 0);
- rb_define_method(klass, "icmp_ttl", icmpp_ttl, 0);
- /*rb_define_method(klass, "icmp_names", icmpp_names, 0);*/
-}
diff --git a/external/ruby-pcapx/ip_packet.c b/external/ruby-pcapx/ip_packet.c
deleted file mode 100644
index 5e96ac5d00..0000000000
--- a/external/ruby-pcapx/ip_packet.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * ip_packet.c
- *
- * $Id: ip_packet.c,v 1.1.1.1 1999/10/27 09:54:38 fukusima Exp $
- *
- * Copyright (C) 1998, 1999 Masaki Fukushima
- */
-
-#include "ruby_pcap.h"
-#include
-
-VALUE cIPPacket;
-static VALUE cIPAddress;
-
-#define CheckTruncateIp(pkt, need) \
- CheckTruncate(pkt, pkt->hdr.layer3_off, need, "truncated IP")
-
-VALUE
-setup_ip_packet(pkt, nl_len)
- struct packet_object *pkt;
- int nl_len;
-{
- VALUE class;
-
- DEBUG_PRINT("setup_ip_packet");
-
- if (nl_len > 0 && IP_HDR(pkt)->ip_v != 4) {
- return cPacket;
- }
-
- class = cIPPacket;
- nl_len = MIN(nl_len, ntohs(IP_HDR(pkt)->ip_len));
- if (nl_len > 20) {
- int hl = IP_HDR(pkt)->ip_hl * 4;
- int tl_len = nl_len - hl;
- if (tl_len > 0) {
- pkt->hdr.layer4_off = pkt->hdr.layer3_off + hl;
- /* if this is fragment zero, setup upper layer */
- if ((ntohs(IP_HDR(pkt)->ip_off) & IP_OFFMASK) == 0) {
- switch (IP_HDR(pkt)->ip_p) {
- case IPPROTO_TCP:
- class = setup_tcp_packet(pkt, tl_len);
- break;
- case IPPROTO_UDP:
- class = setup_udp_packet(pkt, tl_len);
- break;
- case IPPROTO_ICMP:
- class = setup_icmp_packet(pkt, tl_len);
- break;
- }
- }
- }
- }
-
- return class;
-}
-
-#define IPP_METHOD(func, need, val) \
-static VALUE\
-(func)(self)\
- VALUE self;\
-{\
- struct packet_object *pkt;\
- struct ip *ip;\
-\
- DEBUG_PRINT(#func);\
- GetPacket(self, pkt);\
- CheckTruncateIp(pkt, (need));\
- ip = IP_HDR(pkt);\
- return (val);\
-}
-
-IPP_METHOD(ipp_ver, 1, INT2FIX(ip->ip_v))
-IPP_METHOD(ipp_hlen, 1, INT2FIX(ip->ip_hl))
-IPP_METHOD(ipp_tos, 2, INT2FIX(ip->ip_tos))
-IPP_METHOD(ipp_len, 4, INT2FIX(ntohs(ip->ip_len)))
-IPP_METHOD(ipp_id, 6, INT2FIX(ntohs(ip->ip_id)))
-IPP_METHOD(ipp_flags, 8, INT2FIX((ntohs(ip->ip_off) & ~IP_OFFMASK) >> 13))
-IPP_METHOD(ipp_df, 8, ntohs(ip->ip_off) & IP_DF ? Qtrue : Qfalse)
-IPP_METHOD(ipp_mf, 8, ntohs(ip->ip_off) & IP_MF ? Qtrue : Qfalse)
-IPP_METHOD(ipp_off, 8, INT2FIX(ntohs(ip->ip_off) & IP_OFFMASK))
-IPP_METHOD(ipp_ttl, 9, INT2FIX(ip->ip_ttl))
-IPP_METHOD(ipp_proto, 10, INT2FIX(ip->ip_p))
-IPP_METHOD(ipp_sum, 12, INT2FIX(ntohs(ip->ip_sum)))
-IPP_METHOD(ipp_src, 16, new_ipaddr(&ip->ip_src))
-IPP_METHOD(ipp_dst, 20, new_ipaddr(&ip->ip_dst))
-
-static VALUE
-ipp_sumok(self)
- VALUE self;
-{
- struct packet_object *pkt;
- struct ip *ip;
- int hlen, i, sum;
- unsigned short *ipus;
-
- GetPacket(self, pkt);
- CheckTruncateIp(pkt, 20);
- ip = IP_HDR(pkt);
-
- hlen = ip->ip_hl * 4;
- CheckTruncateIp(pkt, hlen);
-
- ipus = (unsigned short *)ip;
- sum = 0;
- hlen /= 2; /* 16-bit word */
- for (i = 0; i < hlen; i++) {
- sum += ntohs(ipus[i]);
- sum = (sum & 0xffff) + (sum >> 16);
- }
- if (sum == 0xffff)
- return Qtrue;
- return Qfalse;
-}
-
-static VALUE
-ipp_data(self)
- VALUE self;
-{
- struct packet_object *pkt;
- struct ip *ip;
- int len, hlen;
-
- DEBUG_PRINT("ipp_data");
- GetPacket(self, pkt);
- CheckTruncateIp(pkt, 20);
- ip = IP_HDR(pkt);
-
- hlen = ip->ip_hl * 4;
- len = pkt->hdr.pkthdr.caplen - pkt->hdr.layer3_off - hlen;
- return rb_str_new((u_char *)ip + hlen, len);
-}
-
-/*
- * IPAddress
- */
-
-/* IPv4 adress (32bit) is stored by immediate value */
-#if SIZEOF_VOIDP < 4
-# error IPAddress assumes sizeof(void *) >= 4
-#endif
-
-#define GetIPAddress(obj, addr) {\
- Check_Type(obj, T_DATA);\
- addr = (struct in_addr *)&(DATA_PTR(obj));\
-}
-
-VALUE
-new_ipaddr(addr)
- struct in_addr *addr;
-{
- VALUE self;
-
- self = Data_Wrap_Struct(cIPAddress, 0, 0, (void *)addr->s_addr);
- return self;
-}
-
-#ifndef INADDR_NONE
-# define INADDR_NONE (0xffffffff)
-#endif
-static VALUE
-ipaddr_s_new(self, val)
- VALUE self, val;
-{
- struct in_addr addr;
- struct hostent *hent;
- char *hname;
-
- switch(TYPE(val)) {
- case T_STRING:
- hname = RSTRING(val)->ptr;
- hent = gethostbyname(hname);
- if (hent == NULL) {
- extern int h_errno;
- switch (h_errno) {
- case HOST_NOT_FOUND:
- rb_raise(ePcapError, "host not found: %s", hname);
- break;
- default:
-#ifdef HAVE_HSTRERROR
- rb_raise(ePcapError, (char *)hstrerror(h_errno));
-#else
- rb_raise(ePcapError, "host not found: %s", hname);
-#endif
- }
- }
- addr = *(struct in_addr *)hent->h_addr;
- break;
- case T_FIXNUM:
- case T_BIGNUM:
- addr.s_addr = htonl(NUM2ULONG(val));
- break;
- default:
- rb_raise(rb_eTypeError, "String or Integer required");
- }
- return new_ipaddr(&addr);
-}
-
-static VALUE
-ipaddr_to_i(self)
- VALUE self;
-{
- struct in_addr *addr;
-
- GetIPAddress(self, addr);
- return UINT32_2_NUM(ntohl(addr->s_addr));
-}
-
-static VALUE
-ipaddr_num_s(self)
- VALUE self;
-{
- struct in_addr *addr;
-
- GetIPAddress(self, addr);
- return rb_str_new2(inet_ntoa(*addr));
-}
-
-static VALUE
-ipaddr_hostname(self)
- VALUE self;
-{
- struct in_addr *addr;
- struct hostent *host;
-
- GetIPAddress(self, addr);
- host = gethostbyaddr((char *)&addr->s_addr, sizeof addr->s_addr, AF_INET);
- if (host == NULL)
- return ipaddr_num_s(self);
- return rb_str_new2(host->h_name);
-}
-
-static VALUE
-ipaddr_to_s(self)
- VALUE self;
-{
- if (RTEST(rbpcap_convert))
- return ipaddr_hostname(self);
- else
- return ipaddr_num_s(self);
-}
-
-static VALUE
-ipaddr_equal(self, other)
- VALUE self, other;
-{
- struct in_addr *addr1;
- struct in_addr *addr2;
-
- GetIPAddress(self, addr1);
- if (rb_class_of(other) == cIPAddress) {
- GetIPAddress(other, addr2);
- if (addr1->s_addr == addr2->s_addr)
- return Qtrue;
- }
- return Qfalse;
-}
-
-static VALUE
-ipaddr_hash(self)
- VALUE self;
-{
- struct in_addr *addr;
-
- GetIPAddress(self, addr);
- return INT2FIX(ntohl(addr->s_addr));
-}
-
-static VALUE
-ipaddr_dump(self, limit)
- VALUE self;
- VALUE limit;
-{
- struct in_addr *addr;
-
- GetIPAddress(self, addr);
- return rb_str_new((char *)addr, sizeof addr);
-}
-
-static VALUE
-ipaddr_s_load(klass, str)
- VALUE klass;
- VALUE str;
-{
- struct in_addr addr;
- int i;
-
- if (RSTRING(str)->len != sizeof addr) {
- rb_raise(rb_eArgError, "dump format error (IPAddress)");
- }
- for (i = 0; i < sizeof addr; i++) {
- ((char *)&addr)[i] = RSTRING(str)->ptr[i];
- }
- return new_ipaddr(&addr);
-}
-
-void
-Init_ip_packet(void)
-{
- DEBUG_PRINT("Init_ip_packet");
-
- cIPPacket = rb_define_class_under(mPcap, "IPPacket", cPacket);
-
- rb_define_method(cIPPacket, "ip_ver", ipp_ver, 0);
- rb_define_method(cIPPacket, "ip_hlen", ipp_hlen, 0);
- rb_define_method(cIPPacket, "ip_tos", ipp_tos, 0);
- rb_define_method(cIPPacket, "ip_len", ipp_len, 0);
- rb_define_method(cIPPacket, "ip_id", ipp_id, 0);
- rb_define_method(cIPPacket, "ip_flags", ipp_flags, 0);
- rb_define_method(cIPPacket, "ip_df?", ipp_df, 0);
- rb_define_method(cIPPacket, "ip_mf?", ipp_mf, 0);
- rb_define_method(cIPPacket, "ip_off", ipp_off, 0);
- rb_define_method(cIPPacket, "ip_ttl", ipp_ttl, 0);
- rb_define_method(cIPPacket, "ip_proto", ipp_proto, 0);
- rb_define_method(cIPPacket, "ip_sum", ipp_sum, 0);
- rb_define_method(cIPPacket, "ip_sumok?", ipp_sumok, 0);
- rb_define_method(cIPPacket, "ip_src", ipp_src, 0);
- rb_define_method(cIPPacket, "src", ipp_src, 0);
- rb_define_method(cIPPacket, "ip_dst", ipp_dst, 0);
- rb_define_method(cIPPacket, "dst", ipp_dst, 0);
- rb_define_method(cIPPacket, "ip_data", ipp_data, 0);
-
- cIPAddress = rb_define_class_under(mPcap, "IPAddress", rb_cObject);
- rb_define_singleton_method(cIPAddress, "new", ipaddr_s_new, 1);
- rb_define_method(cIPAddress, "to_i", ipaddr_to_i, 0);
- rb_define_method(cIPAddress, "to_s", ipaddr_to_s, 0);
- rb_define_method(cIPAddress, "num_s", ipaddr_num_s, 0);
- rb_define_method(cIPAddress, "to_num_s", ipaddr_num_s, 0); /* BWC */
- rb_define_method(cIPAddress, "hostname", ipaddr_hostname, 0);
- rb_define_method(cIPAddress, "sym_s", ipaddr_hostname, 0);
- rb_define_method(cIPAddress, "==", ipaddr_equal, 1);
- rb_define_method(cIPAddress, "===", ipaddr_equal, 1);
- rb_define_method(cIPAddress, "eql?", ipaddr_equal, 1);
- rb_define_method(cIPAddress, "hash", ipaddr_hash, 0);
-
- rb_define_method(cIPAddress, "_dump", ipaddr_dump, 1);
- rb_define_singleton_method(cIPAddress, "_load", ipaddr_s_load, 1);
-
- Init_tcp_packet();
- Init_udp_packet();
- Init_icmp_packet();
-}
diff --git a/external/ruby-pcapx/lib/pcapletx.rb b/external/ruby-pcapx/lib/pcapletx.rb
deleted file mode 100644
index 4e9f0bb11e..0000000000
--- a/external/ruby-pcapx/lib/pcapletx.rb
+++ /dev/null
@@ -1,113 +0,0 @@
-require 'PcapX'
-require 'getopts'
-
-def pcapletx_usage()
- $stderr.print <"
- end
- end
-
- class IPPacket
- def to_s
- "#{ip_src} > #{ip_dst}"
- end
- end
-
- class TCPPacket
- def tcp_data_len
- ip_len - 4 * (ip_hlen + tcp_hlen)
- end
-
- def tcp_flags_s
- return \
- (tcp_urg? ? 'U' : '.') +
- (tcp_ack? ? 'A' : '.') +
- (tcp_psh? ? 'P' : '.') +
- (tcp_rst? ? 'R' : '.') +
- (tcp_syn? ? 'S' : '.') +
- (tcp_fin? ? 'F' : '.')
- end
-
- def to_s
- "#{src}:#{sport} > #{dst}:#{dport} #{tcp_flags_s}"
- end
- end
-
- class UDPPacket
- def to_s
- "#{src}:#{sport} > #{dst}:#{dport} len #{udp_len} sum #{udp_sum}"
- end
- end
-
- class ICMPPacket
- def to_s
- "#{src} > #{dst}: icmp: #{icmp_typestr}"
- end
- end
-
- #
- # Backword compatibility
- #
- IpPacket = IPPacket
- IpAddress = IPAddress
- TcpPacket = TCPPacket
- UdpPacket = UDPPacket
-
- # IpAddress is now obsolete.
- # New class IPAddress is implemented in C.
-=begin
- class IpAddress
- def initialize(a)
- raise AurgumentError unless a.is_a?(Integer)
- @addr = a
- end
-
- def to_i
- return @addr
- end
-
- def ==(other)
- @addr == other.to_i
- end
-
- alias === ==
- alias eql? ==
-
- def to_num_s
- return ((@addr >> 24) & 0xff).to_s + "." +
- ((@addr >> 16) & 0xff).to_s + "." +
- ((@addr >> 8) & 0xff).to_s + "." +
- (@addr & 0xff).to_s;
- end
-
- def hostname
- addr = self.to_num_s
- # "require 'socket'" is here because of the order of
- # ext initialization in static linked binary
- require 'socket'
- begin
- return Socket.gethostbyname(addr)[0]
- rescue SocketError
- return addr
- end
- end
-
- def to_s
- if Pcap.convert?
- return hostname
- else
- return to_num_s
- end
- end
- end
-=end
-end
-
-class Time
- # tcpdump style format
- def tcpdump
- sprintf "%0.2d:%0.2d:%0.2d.%0.6d", hour, min, sec, tv_usec
- end
-end
-
-autoload :PcapletX, 'pcapletx'
diff --git a/external/ruby-pcapx/packet.c b/external/ruby-pcapx/packet.c
deleted file mode 100644
index 2bd78590ef..0000000000
--- a/external/ruby-pcapx/packet.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * packet.c
- *
- * $Id: packet.c,v 1.4 2000/08/13 06:56:15 fukusima Exp $
- *
- * Copyright (C) 1998-2000 Masaki Fukushima
- */
-
-#include "ruby.h"
-#include "ruby_pcap.h"
-#include
-#include
-#include
-
-#define DL_HDR(pkt) ((u_char *)LAYER2_HDR(pkt))
-#define DL_DATA(pkt) ((u_char *)LAYER3_HDR(pkt))
-
-VALUE cPacket;
-static VALUE mMarshal;
-int id_load;
-int id_dump;
-
-/* called from GC */
-static void
-free_packet(pkt)
- struct packet_object *pkt;
-{
- DEBUG_PRINT("free_packet");
- free(pkt);
-}
-
-/* called from GC */
-static void
-mark_packet(pkt)
- struct packet_object *pkt;
-{
- DEBUG_PRINT("mark_packet");
- if (pkt->udata != Qnil)
- rb_gc_mark(pkt->udata);
-}
-
-struct datalink_type {
- int type;
- int nltype_off; /* offset of network-layer type field */
- int nl_off; /* offset of network-layer header */
-};
-
-
-/* supported datalink types */
-static struct datalink_type datalinks[] = {
- { DLT_NULL, -2, 4 },
- { DLT_EN10MB, 12, 14 },
- { DLT_IEEE802, 20, 22 },
- { DLT_SLIP, -2, 16 },
- { DLT_PPP, 2, 4 },
-#ifndef PCAP_FDDIPAD
- { DLT_FDDI, 19, 21 }, /* 10: DLT_FDDI */
-#else
- { DLT_FDDI, 19 + PCAP_FDDIPAD, 21 + PCAP_FDDIPAD },
-#endif
- { DLT_ATM_RFC1483, 6, 8 },
- { DLT_RAW, -2, 0 },
- { DLT_SLIP_BSDOS, -2, 24 },
- { DLT_PPP_BSDOS, -2, 24 },
- { DLT_IEEE802_11, -1, 0 },
- { DLT_IEEE802_11_RADIO, -1, 0 }, /* radiotap is padded to 64 bytes */
- { DLT_IEEE802_11_RADIO_AVS, -1, 0 },
- { DLT_LINUX_SLL, -1, 0 },
- { DLT_PRISM_HEADER, -1, 0 },
- { DLT_AIRONET_HEADER, -1, 0 },
- { 255, 0, 0 }
-};
-
-
-VALUE
-new_packet(data, pkthdr, dl_type)
- const u_char *data;
- const struct pcap_pkthdr *pkthdr;
- int dl_type;
-{
- VALUE class;
- struct packet_object *pkt;
- int nl_off, nl_len, nltype_off, nl_type, pad, i;
- unsigned short *f;
- int t = -1;
-
- DEBUG_PRINT("new_packet");
-
- // This is slow and needs to be rewritten
- for (i = 0; datalinks[i].type != 255; i++) {
- if (datalinks[i].type == dl_type) {
- t = i;
- break;
- }
- }
-
- /* check nework layer type and offset */
- if (t == -1)
- rb_raise(ePcapError, "Unknown data-link type (%d)", dl_type);
-
- nltype_off = datalinks[t].nltype_off;
- nl_off = datalinks[t].nl_off;
-
- /* parse the DLT header to figure it out */
- if (nltype_off == -1) {
-
- switch(dl_type) {
- case DLT_LINUX_SLL:
- default:
- if (pkthdr->caplen > 16) {
- f = (unsigned short *)(data + 4);
- i = ntohs(*f);
- if (pkthdr->caplen > i + 16 ) {
- nltype_off = i + 14;
- nl_off = i + 16;
- }
- }
- break;
- }
- }
-
- /* assume this is raw IP */
- if (nltype_off == -2) {
- nl_type = ETHERTYPE_IP;
- /* assume Ether Type value */
- } else if (nltype_off != -1) {
- nl_type = ntohs(*(u_short *)(data + nltype_off));
- }
-
-
- /* alloc memory and setup packet_object */
- pad = nl_off % 4; /* align network layer header */
- pkt = xmalloc(sizeof(*pkt) + pad + pkthdr->caplen);
- pkt->hdr.version = PACKET_MARSHAL_VERSION;
- pkt->hdr.flags = 0;
- pkt->hdr.dl_type = dl_type;
- pkt->hdr.layer3_off = OFF_NONEXIST;
- pkt->hdr.layer4_off = OFF_NONEXIST;
- pkt->hdr.layer5_off = OFF_NONEXIST;
- pkt->hdr.pkthdr = *pkthdr;
- pkt->data = (u_char *)pkt + sizeof(*pkt) + pad;
- pkt->udata = Qnil;
-
- memcpy(pkt->data, data, pkthdr->caplen);
-
- nl_len = pkthdr->caplen - nl_off;
- if (nl_off >= 0 && nl_len > 0)
- pkt->hdr.layer3_off = nl_off;
-
- /* setup upper layer */
- class = cPacket;
- if (pkt->hdr.layer3_off != OFF_NONEXIST) {
- switch (nl_type) {
- case ETHERTYPE_IP:
- class = setup_ip_packet(pkt, nl_len);
- break;
- }
- }
-#if DEBUG
- if (ruby_debug && TYPE(class) != T_CLASS) {
- rb_fatal("not class");
- }
-#endif
- return Data_Wrap_Struct(class, mark_packet, free_packet, pkt);
-}
-
-static VALUE
-packet_load(class, str)
- VALUE class;
- VALUE str;
-{
- struct packet_object *pkt = NULL;
- struct packet_object_header *hdr;
- int version;
- u_char *str_ptr;
-
- DEBUG_PRINT("packet_load");
-
- str_ptr = RSTRING(str)->ptr;
- hdr = (struct packet_object_header *)str_ptr;
- version = hdr->version;
- if (version == PACKET_MARSHAL_VERSION) {
- bpf_u_int32 caplen;
- u_short layer3_off;
- int pad;
-
- caplen = ntohl(hdr->pkthdr.caplen);
- layer3_off = ntohs(hdr->layer3_off);
- pad = layer3_off % 4; /* align network layer header */
- pkt = (struct packet_object *)xmalloc(sizeof(*pkt) + pad + caplen);
-
- pkt->hdr.version = PACKET_MARSHAL_VERSION;
- pkt->hdr.flags = hdr->flags;
- pkt->hdr.dl_type = hdr->dl_type;
- pkt->hdr.layer3_off = ntohs(hdr->layer3_off);
- pkt->hdr.layer4_off = ntohs(hdr->layer4_off);
- pkt->hdr.layer5_off = ntohs(hdr->layer5_off);
- pkt->hdr.pkthdr.ts.tv_sec = ntohl(hdr->pkthdr.ts.tv_sec);
- pkt->hdr.pkthdr.ts.tv_usec = ntohl(hdr->pkthdr.ts.tv_usec);
- pkt->hdr.pkthdr.caplen = ntohl(hdr->pkthdr.caplen);
- pkt->hdr.pkthdr.len = ntohl(hdr->pkthdr.len);
-
- pkt->data = (u_char *)pkt + sizeof(*pkt) + pad;
- memcpy(pkt->data, str_ptr + sizeof(*hdr), caplen);
- if (PKTFLAG_TEST(pkt, POH_UDATA)) {
- int l = sizeof(*hdr) + caplen;
- VALUE ustr = rb_str_substr(str, l, RSTRING(str)->len - l);
- pkt->udata = rb_funcall(mMarshal, id_load, 1, ustr);
- } else {
- pkt->udata = Qnil;
- }
- PKTFLAG_SET(pkt, POH_UDATA, (pkt->udata != Qnil));
- } else {
- rb_raise(rb_eArgError, "unknown packet marshal version(0x%x)", version);
- }
-
- if (pkt != NULL)
- return Data_Wrap_Struct(class, mark_packet, free_packet, pkt);
- else
- return Qnil;
-}
-
-static VALUE
-packet_dump(self, limit)
- VALUE self;
- VALUE limit;
-{
- struct packet_object *pkt;
- struct packet_object_header hdr;
- VALUE str;
-
- DEBUG_PRINT("packet_dump");
- GetPacket(self, pkt);
-
- hdr.version = PACKET_MARSHAL_VERSION;
- hdr.flags = pkt->hdr.flags;
- hdr.dl_type = pkt->hdr.dl_type;
- hdr.layer3_off = htons(pkt->hdr.layer3_off);
- hdr.layer4_off = htons(pkt->hdr.layer4_off);
- hdr.layer5_off = htons(pkt->hdr.layer5_off);
- hdr.pkthdr.ts.tv_sec = htonl(pkt->hdr.pkthdr.ts.tv_sec);
- hdr.pkthdr.ts.tv_usec = htonl(pkt->hdr.pkthdr.ts.tv_usec);
- hdr.pkthdr.caplen = htonl(pkt->hdr.pkthdr.caplen);
- hdr.pkthdr.len = htonl(pkt->hdr.pkthdr.len);
-
- str = rb_str_new((char *)&hdr, sizeof(hdr));
- rb_str_cat(str, pkt->data, pkt->hdr.pkthdr.caplen);
- if (pkt->udata != Qnil) {
- VALUE ustr;
- ustr = rb_funcall(mMarshal, id_dump, 1, pkt->udata);
- rb_str_concat(str, ustr);
- }
- return str;
-}
-
-static VALUE
-packet_set_udata(self, val)
- VALUE self;
- VALUE val;
-{
- struct packet_object *pkt;
-
- DEBUG_PRINT("packet_set_udata");
- GetPacket(self, pkt);
-
- pkt->udata = val;
- PKTFLAG_SET(pkt, POH_UDATA, (val != Qnil));
- return val;
-}
-
-static VALUE
-packet_match(self, expr)
- VALUE self;
- VALUE expr;
-{
- if (IsKindOf(expr, cFilter)) {
- return filter_match(expr, self);
- }
- rb_raise(rb_eArgError, "Not Filter");
-}
-
-#define PACKET_METHOD(func, val) \
-static VALUE\
-(func)(self)\
- VALUE self;\
-{\
- struct packet_object *pkt;\
-\
- DEBUG_PRINT(#func);\
- GetPacket(self, pkt);\
- return (val);\
-}
-
-PACKET_METHOD(packet_get_udata, pkt->udata);
-PACKET_METHOD(packet_datalink, INT2FIX(pkt->hdr.dl_type));
-PACKET_METHOD(packet_ip, rb_obj_is_kind_of(self, cIPPacket));
-PACKET_METHOD(packet_tcp, rb_obj_is_kind_of(self, cTCPPacket));
-PACKET_METHOD(packet_udp, rb_obj_is_kind_of(self, cUDPPacket));
-PACKET_METHOD(packet_length, UINT32_2_NUM(pkt->hdr.pkthdr.len));
-PACKET_METHOD(packet_caplen, UINT32_2_NUM(pkt->hdr.pkthdr.caplen));
-PACKET_METHOD(packet_time, rb_time_new(pkt->hdr.pkthdr.ts.tv_sec,
- pkt->hdr.pkthdr.ts.tv_usec));
-PACKET_METHOD(packet_time_i, rb_int2inum(pkt->hdr.pkthdr.ts.tv_sec));
-PACKET_METHOD(packet_raw_data, rb_str_new(pkt->data, pkt->hdr.pkthdr.caplen));
-
-void
-Init_packet(void)
-{
- DEBUG_PRINT("Init_packet");
-
- /* define class Packet */
- cPacket = rb_define_class_under(mPcap, "Packet", rb_cObject);
-
- rb_define_singleton_method(cPacket, "_load", packet_load, 1);
- rb_define_method(cPacket, "_dump", packet_dump, 1);
- /* marshal backward compatibility */
- rb_define_singleton_method(cPacket, "_load_from", packet_load, 1);
- rb_define_method(cPacket, "_dump_to", packet_dump, 1);
-
- rb_define_method(cPacket, "udata", packet_get_udata, 0);
- rb_define_method(cPacket, "udata=", packet_set_udata, 1);
- rb_define_method(cPacket, "datalink", packet_datalink, 0);
- rb_define_method(cPacket, "ip?", packet_ip, 0);
- rb_define_method(cPacket, "tcp?", packet_tcp, 0);
- rb_define_method(cPacket, "udp?", packet_udp, 0);
- rb_define_method(cPacket, "length", packet_length, 0);
- rb_define_method(cPacket, "size", packet_length, 0);
- rb_define_method(cPacket, "caplen", packet_caplen, 0);
- rb_define_method(cPacket, "time", packet_time, 0);
- rb_define_method(cPacket, "time_i", packet_time_i, 0);
- rb_define_method(cPacket, "raw_data", packet_raw_data, 0);
- rb_define_method(cPacket, "=~", packet_match, 1);
-
- /* mMarshal in ruby/marshal.c is static. Why? */
- mMarshal = rb_eval_string("Marshal");
- id_load = rb_intern("load");
- id_dump = rb_intern("dump");
- Init_ip_packet();
-}
diff --git a/external/ruby-pcapx/ruby_pcap.h b/external/ruby-pcapx/ruby_pcap.h
deleted file mode 100644
index 254ee5d9f6..0000000000
--- a/external/ruby-pcapx/ruby_pcap.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * ruby_pcap.h
- *
- * $Id: ruby_pcap.h,v 1.4 2000/08/13 06:56:15 fukusima Exp $
- *
- * Copyright (C) 1998-2000 Masaki Fukushima
- */
-
-#ifndef RUBY_PCAP_H
-#define RUBY_PCAP_H
-
-#include "ruby.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#ifndef IP_OFFMASK
-# define IP_OFFMASK 0x1fff
-#endif
-#ifdef linux
-# define __FAVOR_BSD
-#endif
-#include
-#include
-#include
-#include
-#include
-
-#ifdef DEBUG
-# define DEBUG_PRINT(x) \
- ((RTEST(ruby_debug) && RTEST(ruby_verbose))?\
- (fprintf(stderr, "%s\n", x),fflush(stderr)) : 0)
-#else
-# define DEBUG_PRINT(x) (0)
-#endif
-
-#define UINT32_2_NUM(i) rb_uint2inum(i)
-#ifndef UINT2NUM
-# define UINT2NUM(i) rb_uint2inum(i)
-#endif
-#define MIN(x, y) ((x)<(y) ? (x) : (y))
-
-
-#define PACKET_MARSHAL_VERSION 1
-
-/* ruby config.h defines WORDS_BIGENDIAN if big-endian */
-struct packet_object_header {
-#ifdef WORDS_BIGENDIAN
- u_char version:4; /* marshal format version */
- u_char flags:4; /* flags */
-#else
- u_char flags:4; /* flags */
- u_char version:4; /* marshal format version */
-#endif
-#define POH_UDATA 0x01 /* flag: user data exists */
-#define POH_RSVD1 0x02 /* (reserved) */
-#define POH_RSVD2 0x03 /* (reserved) */
-#define POH_RSVD3 0x04 /* (reserved) */
- u_char dl_type; /* data-link type (DLT_*) */
- u_short layer3_off; /* layer 3 header offset */
- u_short layer4_off; /* layer 4 header offset */
- u_short layer5_off; /* layer 5 header offset */
-#define OFF_NONEXIST 0xffff /* offset value for non-existent layer */
- struct pcap_pkthdr pkthdr; /* pcap packet header */
-};
-
-struct packet_object {
- struct packet_object_header hdr; /* packet object header */
- u_char *data; /* packet data */
- VALUE udata; /* user data */
-};
-
-#define PKTFLAG_TEST(pkt, flag) ((pkt)->hdr.flags & (flag))
-#define PKTFLAG_SET(pkt, flag, val) \
- ((val) ? ((pkt)->hdr.flags |= (flag)) : ((pkt)->hdr.flags &= ~(flag)))
-
-#define LAYER2_HDR(pkt) ((pkt)->data)
-#define LAYER3_HDR(pkt) ((pkt)->data + (pkt)->hdr.layer3_off)
-#define LAYER4_HDR(pkt) ((pkt)->data + (pkt)->hdr.layer4_off)
-#define LAYER5_HDR(pkt) ((pkt)->data + (pkt)->hdr.layer5_off)
-
-#define GetPacket(obj, pkt) Data_Get_Struct(obj, struct packet_object, pkt)
-#define Caplen(pkt, from) ((pkt)->hdr.pkthdr.caplen - (from))
-#define CheckTruncate(pkt, from, need, emsg) (\
- (from) + (need) > (pkt)->hdr.pkthdr.caplen ? \
- rb_raise(eTruncatedPacket, (emsg)) : 0 \
-)
-
-#define IsKindOf(v, class) RTEST(rb_obj_is_kind_of(v, class))
-#define CheckClass(v, class) ((IsKindOf(v, class)) ? 0 :\
- rb_raise(rb_eTypeError, "wrong type %s (expected %s)",\
- rb_class2name(CLASS_OF(v)), rb_class2name(class)))
-
-
-/* Pcap.c */
-extern VALUE mPcap, rbpcap_convert;
-extern VALUE ePcapError;
-extern VALUE eTruncatedPacket;
-extern VALUE cFilter;
-void Init_PcapX(void);
-VALUE filter_match(VALUE self, VALUE v_pkt);
-
-/* packet.c */
-extern VALUE cPacket;
-void Init_packet(void);
-VALUE new_packet(const u_char *, const struct pcap_pkthdr *, int);
-
-/* ip_packet.c */
-#define IP_HDR(pkt) ((struct ip *)LAYER3_HDR(pkt))
-#define IP_DATA(pkt) ((u_char *)LAYER4_HDR(pkt))
-extern VALUE cIPPacket;
-void Init_ip_packet(void);
-VALUE setup_ip_packet(struct packet_object *, int);
-VALUE new_ipaddr(struct in_addr *);
-
-/* tcp_packet.c */
-extern VALUE cTCPPacket;
-void Init_tcp_packet(void);
-VALUE setup_tcp_packet(struct packet_object *, int);
-
-/* udp_packet.c */
-extern VALUE cUDPPacket;
-void Init_udp_packet(void);
-VALUE setup_udp_packet(struct packet_object *, int);
-
-/* icmp_packet.c */
-extern VALUE cICMPPacket;
-void Init_icmp_packet(void);
-VALUE setup_icmp_packet(struct packet_object *, int);
-
-#endif /* RUBY_PCAP_H */
diff --git a/external/ruby-pcapx/tcp_packet.c b/external/ruby-pcapx/tcp_packet.c
deleted file mode 100644
index e0bf08f55d..0000000000
--- a/external/ruby-pcapx/tcp_packet.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * tcp_packet.c
- *
- * $Id: tcp_packet.c,v 1.1.1.1 1999/10/27 09:54:38 fukusima Exp $
- *
- * Copyright (C) 1998, 1999 Masaki Fukushima
- */
-
-#include "ruby_pcap.h"
-#include
-
-#define TCP_HDR(pkt) ((struct tcphdr *)LAYER4_HDR(pkt))
-#define TCP_DATA(pkt) ((u_char *)LAYER5_HDR(pkt))
-#define TCP_DATALEN(pkt) (ntohs(IP_HDR(pkt)->ip_len) - \
- (IP_HDR(pkt)->ip_hl + TCP_HDR(pkt)->th_off) * 4)
-
-VALUE cTCPPacket;
-
-#define CheckTruncateTcp(pkt, need) \
- CheckTruncate(pkt, pkt->hdr.layer4_off, need, "truncated TCP")
-
-VALUE
-setup_tcp_packet(pkt, tl_len)
- struct packet_object *pkt;
- int tl_len;
-{
- VALUE class;
-
- DEBUG_PRINT("setup_tcp_packet");
-
- class = cTCPPacket;
- if (tl_len > 20) {
- int hl = TCP_HDR(pkt)->th_off * 4;
- int layer5_len = tl_len - hl;
- if (layer5_len > 0) {
- pkt->hdr.layer5_off = pkt->hdr.layer4_off + hl;
- /* upper layer */
- }
- }
- return class;
-}
-
-#define TCPP_METHOD(func, need, val) \
-static VALUE\
-(func)(self)\
- VALUE self;\
-{\
- struct packet_object *pkt;\
- struct tcphdr *tcp;\
- DEBUG_PRINT(#func);\
- GetPacket(self, pkt);\
- CheckTruncateTcp(pkt, (need));\
- tcp = TCP_HDR(pkt);\
- return (val);\
-}
-
-TCPP_METHOD(tcpp_sport, 2, INT2FIX(ntohs(tcp->th_sport)))
-TCPP_METHOD(tcpp_dport, 4, INT2FIX(ntohs(tcp->th_dport)))
-TCPP_METHOD(tcpp_seq, 8, UINT32_2_NUM(ntohl(tcp->th_seq)))
-TCPP_METHOD(tcpp_acknum, 12, UINT32_2_NUM(ntohl(tcp->th_ack)))
-TCPP_METHOD(tcpp_off, 13, INT2FIX(tcp->th_off))
-TCPP_METHOD(tcpp_flags, 14, INT2FIX(tcp->th_flags))
-TCPP_METHOD(tcpp_win, 16, INT2FIX(ntohs(tcp->th_win)))
-TCPP_METHOD(tcpp_sum, 18, INT2FIX(ntohs(tcp->th_sum)))
-TCPP_METHOD(tcpp_urp, 20, INT2FIX(ntohs(tcp->th_urp)))
-
-#define TCPP_FLAG(func, flag) \
- TCPP_METHOD(func, 14, (tcp->th_flags & flag) ? Qtrue : Qfalse)
-TCPP_FLAG(tcpp_fin, TH_FIN)
-TCPP_FLAG(tcpp_syn, TH_SYN)
-TCPP_FLAG(tcpp_rst, TH_RST)
-TCPP_FLAG(tcpp_psh, TH_PUSH)
-TCPP_FLAG(tcpp_ack, TH_ACK)
-TCPP_FLAG(tcpp_urg, TH_URG)
-
-static VALUE
-tcpp_data(self)
- VALUE self;
-{
- struct packet_object *pkt;
- VALUE v_len;
- int len;
-
- DEBUG_PRINT("tcpp_data");
- GetPacket(self, pkt);
-
- if (pkt->hdr.layer5_off == OFF_NONEXIST) return Qnil;
-
- len = MIN(Caplen(pkt, pkt->hdr.layer5_off), TCP_DATALEN(pkt));
- if (len < 1) return Qnil;
- return rb_str_new(TCP_DATA(pkt), len);
-}
-
-void
-Init_tcp_packet(void)
-{
- DEBUG_PRINT("Init_tcp_packet");
-
- /* define class TcpPacket */
- cTCPPacket = rb_define_class_under(mPcap, "TCPPacket", cIPPacket);
-
- rb_define_method(cTCPPacket, "tcp_sport", tcpp_sport, 0);
- rb_define_method(cTCPPacket, "sport", tcpp_sport, 0);
- rb_define_method(cTCPPacket, "tcp_dport", tcpp_dport, 0);
- rb_define_method(cTCPPacket, "dport", tcpp_dport, 0);
- rb_define_method(cTCPPacket, "tcp_seq", tcpp_seq, 0);
- rb_define_method(cTCPPacket, "tcp_ack", tcpp_acknum, 0);
- rb_define_method(cTCPPacket, "tcp_off", tcpp_off, 0);
- rb_define_method(cTCPPacket, "tcp_hlen", tcpp_off, 0);
- rb_define_method(cTCPPacket, "tcp_flags", tcpp_flags, 0);
- rb_define_method(cTCPPacket, "tcp_win", tcpp_win, 0);
- rb_define_method(cTCPPacket, "tcp_sum", tcpp_sum, 0);
- rb_define_method(cTCPPacket, "tcp_urp", tcpp_urp, 0);
- rb_define_method(cTCPPacket, "tcp_fin?", tcpp_fin, 0);
- rb_define_method(cTCPPacket, "tcp_syn?", tcpp_syn, 0);
- rb_define_method(cTCPPacket, "tcp_rst?", tcpp_rst, 0);
- rb_define_method(cTCPPacket, "tcp_psh?", tcpp_psh, 0);
- rb_define_method(cTCPPacket, "tcp_ack?", tcpp_ack, 0);
- rb_define_method(cTCPPacket, "tcp_urg?", tcpp_urg, 0);
- rb_define_method(cTCPPacket, "tcp_data", tcpp_data, 0);
-}
diff --git a/external/ruby-pcapx/test.rb b/external/ruby-pcapx/test.rb
deleted file mode 100644
index 559a9e174a..0000000000
--- a/external/ruby-pcapx/test.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env ruby
-$:.unshift(File.dirname(__FILE__))
-$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
-
-require 'pcapletx'
-include PcapX
-
-class Time
- # tcpdump style format
- def to_s
- sprintf "%0.2d:%0.2d:%0.2d.%0.6d", hour, min, sec, tv_usec
- end
-end
-
-pcaplet = PcapletX.new(ARGV.join(' '))
-
-pcaplet.each_packet do |pkt|
- print "#{pkt.time} #{pkt} #{pkt.datalink} #{pkt.raw_data.index("\xff" * 6)}"
- if pkt.tcp?
- print " (#{pkt.tcp_data_len})"
- print " ack #{pkt.tcp_ack}" if pkt.tcp_ack?
- print " win #{pkt.tcp_win}"
- end
- if pkt.ip?
- print " (DF)" if pkt.ip_df?
- end
- print "\n"
-end
-
-
-pcaplet.close
diff --git a/external/ruby-pcapx/udp_packet.c b/external/ruby-pcapx/udp_packet.c
deleted file mode 100644
index 6ce2a42ac5..0000000000
--- a/external/ruby-pcapx/udp_packet.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * udp_packet.c
- *
- * $Id: udp_packet.c,v 1.1.1.1 1999/10/27 09:54:38 fukusima Exp $
- *
- * Copyright (C) 1999 Masaki Fukushima
- */
-
-#include "ruby_pcap.h"
-#include
-
-#define UDP_HDR(pkt) ((struct udphdr *)LAYER4_HDR(pkt))
-#define UDP_DATA(pkt) ((u_char *)LAYER5_HDR(pkt))
-#define UDP_LENGTH(pkt) (ntohs(UDP_HDR(pkt)->uh_ulen))
-
-VALUE cUDPPacket;
-
-#define CheckTruncateUdp(pkt, need) \
- CheckTruncate(pkt, pkt->hdr.layer4_off, need, "truncated UDP")
-
-VALUE
-setup_udp_packet(pkt, tl_len)
- struct packet_object *pkt;
- int tl_len;
-{
- VALUE class;
-
- DEBUG_PRINT("setup_udp_packet");
-
- class = cUDPPacket;
- if (tl_len > 8) {
- int hl = 8;
- int layer5_len;
-
- tl_len = MIN(tl_len, UDP_LENGTH(pkt));
- layer5_len = tl_len - hl;
- if (layer5_len > 0) {
- pkt->hdr.layer5_off = pkt->hdr.layer4_off + hl;
- /* upper layer */
- }
- }
- return class;
-}
-
-#define UDPP_METHOD(func, need, val) \
-static VALUE\
-(func)(self)\
- VALUE self;\
-{\
- struct packet_object *pkt;\
- struct udphdr *udp;\
- DEBUG_PRINT(#func);\
- GetPacket(self, pkt);\
- CheckTruncateUdp(pkt, (need));\
- udp = UDP_HDR(pkt);\
- return (val);\
-}
-
-UDPP_METHOD(udpp_sport, 2, INT2FIX(ntohs(udp->uh_sport)))
-UDPP_METHOD(udpp_dport, 4, INT2FIX(ntohs(udp->uh_dport)))
-UDPP_METHOD(udpp_len, 6, INT2FIX(ntohs(udp->uh_ulen)))
-UDPP_METHOD(udpp_sum, 8, INT2FIX(ntohs(udp->uh_sum)))
-
-static VALUE
-udpp_data(self)
- VALUE self;
-{
- struct packet_object *pkt;
- int len;
-
- DEBUG_PRINT("udpp_data");
- GetPacket(self, pkt);
- CheckTruncateUdp(pkt, 8);
-
- if (pkt->hdr.layer5_off == OFF_NONEXIST) return Qnil;
-
- len = MIN(Caplen(pkt, pkt->hdr.layer5_off), UDP_LENGTH(pkt)-8);
- return rb_str_new(UDP_DATA(pkt), len);
-}
-
-void
-Init_udp_packet(void)
-{
- DEBUG_PRINT("Init_udp_packet");
-
- /* define class UdpPacket */
- cUDPPacket = rb_define_class_under(mPcap, "UDPPacket", cIPPacket);
-
- rb_define_method(cUDPPacket, "udp_sport", udpp_sport, 0);
- rb_define_method(cUDPPacket, "sport", udpp_sport, 0);
- rb_define_method(cUDPPacket, "udp_dport", udpp_dport, 0);
- rb_define_method(cUDPPacket, "dport", udpp_dport, 0);
- rb_define_method(cUDPPacket, "udp_len", udpp_len, 0);
- rb_define_method(cUDPPacket, "udp_sum", udpp_sum, 0);
- rb_define_method(cUDPPacket, "udp_data", udpp_data, 0);
-}
diff --git a/lib/msf/ui/gtk2/app.rb b/lib/msf/ui/gtk2/app.rb
index 384e1fad1f..a944525247 100644
--- a/lib/msf/ui/gtk2/app.rb
+++ b/lib/msf/ui/gtk2/app.rb
@@ -285,6 +285,13 @@ module Ui
ad.show
end
+ #
+ # The Online Help link
+ #
+ def on_online_activate
+ Rex::Compat.open_browser('http://metasploit3.com/msf/support')
+ end
+
#
# Call the refresh method to reload all module
#
diff --git a/lib/msf/ui/gtk2/frame/modules_tree.rb b/lib/msf/ui/gtk2/frame/modules_tree.rb
index b4ec7844fc..9952f136f3 100644
--- a/lib/msf/ui/gtk2/frame/modules_tree.rb
+++ b/lib/msf/ui/gtk2/frame/modules_tree.rb
@@ -254,69 +254,83 @@ module Gtk2
#
def add_modules(filter=/.*/)
+
+ mod_exploits = {}
+ mod_auxiliary = {}
+
+ if(not (@module_cache and filter == /.*/))
+
+ framework.exploits.each_module do |mod, obj|
- mod_exploits = {}
- framework.exploits.each_module do |mod, obj|
-
- # SEGV :(
- # while (Gtk.events_pending?)
- # Gtk.main_iteration
- # end
-
-
- parts = mod.split("/")
- name = parts.pop
- ref = mod_exploits
- parts.each do |part|
- ref[part] ||= {}
- ref = ref[part]
+ # SEGV :(
+ # while (Gtk.events_pending?)
+ # Gtk.main_iteration
+ # end
+
+
+ parts = mod.split("/")
+ name = parts.pop
+ ref = mod_exploits
+ parts.each do |part|
+ ref[part] ||= {}
+ ref = ref[part]
+ end
+
+ ins = obj.new
+ if (
+ mod =~ filter or
+ ins.name =~ filter or
+ ins.description.gsub(/\s+/, " ") =~ filter or
+ ins.author_to_s =~ filter or
+ ins.references.map {|x| x.to_s}.join(" ") =~ filter
+ )
+ ref[name] = obj.new
+ end
+ end
+
+ prune_hash("exploits", mod_exploits)
+
+ framework.auxiliary.each_module do |mod, obj|
+
+ # SEGV :(
+ # while (Gtk.events_pending?)
+ # Gtk.main_iteration
+ # end
+
+ parts = mod.split("/")
+ name = parts.pop
+ ref = mod_auxiliary
+ parts.each do |part|
+ ref[part] ||= {}
+ ref = ref[part]
+ end
+
+ ins = obj.new
+ if (
+ mod =~ filter or
+ ins.name =~ filter or
+ ins.description.gsub(/\s+/, " ") =~ filter or
+ ins.author_to_s =~ filter or
+ ins.references.map {|x| x.to_s}.join(" ") =~ filter
+ )
+ ref[name] = obj.new
+ end
+ end
+
+ prune_hash("auxiliary", mod_auxiliary)
+
+ # Cache the entire tree
+ if(filter == /.*/)
+ @module_cache ||= {}
+ @module_cache[:exploits] = mod_exploits
+ @module_cache[:auxiliary] = mod_auxiliary
end
- ins = obj.new
- if (
- mod =~ filter or
- ins.name =~ filter or
- ins.description.gsub(/\s+/, " ") =~ filter or
- ins.author_to_s =~ filter or
- ins.references.map {|x| x.to_s}.join(" ") =~ filter
- )
- ref[name] = obj.new
- end
+ else
+ mod_exploits = @module_cache[:exploits]
+ mod_auxiliary = @module_cache[:auxiliary]
end
- prune_hash("exploits", mod_exploits)
-
- mod_auxiliary = {}
- framework.auxiliary.each_module do |mod, obj|
-
- # SEGV :(
- # while (Gtk.events_pending?)
- # Gtk.main_iteration
- # end
-
- parts = mod.split("/")
- name = parts.pop
- ref = mod_auxiliary
- parts.each do |part|
- ref[part] ||= {}
- ref = ref[part]
- end
-
- ins = obj.new
- if (
- mod =~ filter or
- ins.name =~ filter or
- ins.description.gsub(/\s+/, " ") =~ filter or
- ins.author_to_s =~ filter or
- ins.references.map {|x| x.to_s}.join(" ") =~ filter
- )
- ref[name] = obj.new
- end
- end
-
- prune_hash("auxiliary", mod_auxiliary)
-
-
add_modules_to_store(
@model, nil, "Exploits", mod_exploits,
{
diff --git a/lib/msf/ui/gtk2/search.rb b/lib/msf/ui/gtk2/search.rb
index 611ab8b3af..05534fd750 100644
--- a/lib/msf/ui/gtk2/search.rb
+++ b/lib/msf/ui/gtk2/search.rb
@@ -60,30 +60,6 @@ module Msf
$gtk2driver.module_tree.refresh(filter)
$gtk2driver.module_tree.expand
- return
-
- i_type = Msf::Ui::Gtk2::MyModuleTree::TYPE
- i_type_dir = Msf::Ui::Gtk2::MyModuleTree::DIR
- i_desc = Msf::Ui::Gtk2::MyModuleTree::DESC
- i_name = Msf::Ui::Gtk2::MyModuleTree::NAME
- i_mod = Msf::Ui::Gtk2::MyModuleTree::MOD
-
- $gtk2driver.module_model.each do |model, path, iter|
- next if iter[i_type] == i_type_dir
- if ( iter[i_desc] =~ filter or iter[i_name] =~ filter)
- # Its a keeper
- else
- found.push(iter)
- end
- end
-
- # Colorize the Gtk::Entry
- state(RUNNING)
-
- # pass the found array to the MyModuleTree and remove all not matched iter
- # and finish by expanding the treeview
- $gtk2driver.module_tree.remove(found)
- $gtk2driver.module_tree.expand
end