pcapr 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/pcapr CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'pcapr'
2
2
  if ARGV[0] == "-h" or ARGV[0] == "--help" or ARGV.size < 2
3
3
  puts "Usage: #{File.basename($0)} user pass [dir]"
4
+ puts "Version: #{Pcapr::VERSION}"
4
5
  exit 0
5
6
  end
6
7
 
@@ -60,17 +60,16 @@ class Pcapr
60
60
  base_dir = dir
61
61
  login
62
62
  protos.each do |proto|
63
- proto_dir = File.join(base_dir, proto)
64
- proto_dir.tr!("<>","")
63
+ proto_dir = File.join(base_dir, proto.tr("\\/:*?\"<>|"," "))
65
64
  FileUtils.mkdir_p(proto_dir) unless File.directory?(proto_dir)
66
65
  logger.info "proto: #{proto}, downloading...(pcap save as: #{proto_dir}"
67
66
  pcap_urls(proto).each do |pcap_url|
68
- file = File.join(proto_dir, File.basename(pcap_url).gsub(/\.html$/,""))
67
+ file = File.join( proto_dir, File.basename(pcap_url).gsub(/\.html$/,"").tr("\\/:*?\"<>|"," ") )
69
68
  logger.info " pcap file: #{file} save at '#{file}'"
70
69
  begin
71
70
  pcap_file(pcap_url, file)
72
71
  logger.debug " save ok"
73
- rescue Exception
72
+ rescue =>e
74
73
  logger.error " save fail: #{$!}"
75
74
  end
76
75
  end
@@ -1,3 +1,3 @@
1
1
  class Pcapr
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -6,6 +6,11 @@ describe Pcapr do
6
6
  pass="sinfor"
7
7
  @o = Pcapr.new(user,pass)
8
8
  end
9
+
10
+ it "should show version" do
11
+ lambda { Pcapr::VERSION }.should_not raise_error
12
+ end
13
+
9
14
  it "should login success" do
10
15
  lambda { @o.login }.should_not raise_error
11
16
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - yafei LI