From 19c9a190e21adc408418daf95d8d9d805cf908aa Mon Sep 17 00:00:00 2001 From: dakrone Date: Mon, 1 Feb 2010 22:59:14 -0700 Subject: [PATCH] porting to 1.9, the print command should work properly now. --- gentags | 2 +- lib/encodelib.rb | 6 +++--- lib/pcaplib.rb | 4 ++-- lib/pcapparser.rb | 17 ++++++++--------- nsm | 2 +- tags | 2 +- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/gentags b/gentags index cb4ecd8..8ef908e 100755 --- a/gentags +++ b/gentags @@ -3,4 +3,4 @@ ## This script is intended to be used in conjuction with exuberant-ctags: ## http://ctags.sourceforge.net/ -/usr/local/bin/ctags -L files -f tags --verbose=yes +ctags -L files -f tags --verbose=yes diff --git a/lib/encodelib.rb b/lib/encodelib.rb index 21a3fad..f5b9abf 100644 --- a/lib/encodelib.rb +++ b/lib/encodelib.rb @@ -71,13 +71,13 @@ def Encoder.decode_urlescape(str) end def Encoder.decode_binary(str) - return str.to_a.pack('B*') + return [str].pack('B*') end def Encoder.decode_binary_MSB(str) - return str.to_a.pack('B*') + return [str].pack('B*') end def Encoder.decode_binary_LSB(str) - return str.to_a.pack('b*') + return [str].pack('b*') end def Encoder.decode_hex(str) diff --git a/lib/pcaplib.rb b/lib/pcaplib.rb index 90d2bb5..a4b943c 100644 --- a/lib/pcaplib.rb +++ b/lib/pcaplib.rb @@ -49,9 +49,9 @@ def print_pkt_payload(p,opts,fullpacket) # If the full packet is requested, print all the data, not just # the payload if fullpacket - data = p.data.unpack('H*').to_s + data = p.data.unpack('H*').join else - data = p.payload.unpack('H*').to_s + data = p.payload.unpack('H*').join end if opts == "full" diff --git a/lib/pcapparser.rb b/lib/pcapparser.rb index 4e4f422..ff31e0e 100644 --- a/lib/pcapparser.rb +++ b/lib/pcapparser.rb @@ -1,5 +1,4 @@ -# vim: set ts=2 sw=2 tw=80 -# FLOWTAG - parses and visualizes pcap data +# DESCRIPTION: is part of the flowtag toolkit and simply parses a pcap file. # Copyright (C) 2007 Christopher Lee # # This program is free software: you can redistribute it and/or modify @@ -16,9 +15,9 @@ # along with this program. If not, see . class PcapParser - LINKTYPE_ETH = 0x0001 + LINKTYPE_ETH = 0x0001 LINKTYPE_NULL = 0x0000 - LINKTYPE_SLL = 0x0071 + LINKTYPE_SLL = 0x0071 def initialize(pcapfh) @offset = 0 @@ -31,7 +30,7 @@ def initialize(pcapfh) @version_major, @version_minor, @zone, @significant_figures, @snaplength, @linktype = @fh.read(20).unpack(endian) @offset += 24 if (@linktype != LINKTYPE_ETH) && (@linktype != LINKTYPE_NULL) - puts "Only ethernet or null are supported, sorry." + puts "Only ethernet is supported, sorry." exit end end @@ -76,8 +75,8 @@ def initialize(time, data, linktype) offset = 4 end if @ip - @ip_hlen = (data[offset] & 0x0f) << 2 - @ip_proto = data[offset+9] + @ip_hlen = (data[offset].ord & 0x0f) << 2 + @ip_proto = data[offset+9].ord @ip_src, @ip_dst = data[offset+12,8].unpack("NN") offset += @ip_hlen @tcp = true if @ip_proto == 0x06 @@ -91,10 +90,10 @@ def initialize(time, data, linktype) @ack_num = data[offset+8,4].unpack("nn").to_s.to_i ## Determine TCP flags - @flags = data[offset+13].to_s + @flags = data[offset+13].ord.to_s @urg, @ack, @psh, @rst, @syn, @fin = parse_flags(@flags) - @tcp_hlen = (data[offset+12]>>4)<<2 + @tcp_hlen = (data[offset+12].ord>>4)<<2 offset += @tcp_hlen elsif @udp @sport, @dport = data[offset,4].unpack("nn") diff --git a/nsm b/nsm index c4f8486..d673e57 100755 --- a/nsm +++ b/nsm @@ -20,7 +20,7 @@ ## ${MODULE_NAME} - The base name (without the .module) of the module ## ${OUTPUT_DIR} - The base output directory -$NSM_VERSION = "0.8-DEVEL" +$NSM_VERSION = "0.8.1-DEVEL" # Add the directory nsm is in to the include path $:.push(File.dirname(__FILE__)) diff --git a/tags b/tags index b1e5edb..cd51709 100644 --- a/tags +++ b/tags @@ -3,7 +3,7 @@ !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ !_TAG_PROGRAM_NAME Exuberant Ctags // !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ -!_TAG_PROGRAM_VERSION 5.7 // +!_TAG_PROGRAM_VERSION 5.8 // Command lib/command_manager.rb /^class Command$/;" c CommandManager lib/command_manager.rb /^class CommandManager$/;" c Encoder lib/encodelib.rb /^class Encoder$/;" c