Skip to content

Commit

Permalink
porting to 1.9, the print command should work properly now.
Browse files Browse the repository at this point in the history
  • Loading branch information
dakrone committed Feb 2, 2010
1 parent 71bdc53 commit 19c9a19
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gentags
Expand Up @@ -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
6 changes: 3 additions & 3 deletions lib/encodelib.rb
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/pcaplib.rb
Expand Up @@ -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"
Expand Down
17 changes: 8 additions & 9 deletions 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
Expand All @@ -16,9 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class PcapParser
LINKTYPE_ETH = 0x0001
LINKTYPE_ETH = 0x0001
LINKTYPE_NULL = 0x0000
LINKTYPE_SLL = 0x0071
LINKTYPE_SLL = 0x0071

def initialize(pcapfh)
@offset = 0
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion nsm
Expand Up @@ -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__))
Expand Down
2 changes: 1 addition & 1 deletion tags
Expand Up @@ -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
Expand Down

0 comments on commit 19c9a19

Please sign in to comment.