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 +1 -0
- data/lib/pcapr/pcapr.rb +3 -4
- data/lib/pcapr/version.rb +1 -1
- data/spec/pcapr_spec.rb +5 -0
- metadata +2 -2
data/bin/pcapr
CHANGED
data/lib/pcapr/pcapr.rb
CHANGED
@@ -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
|
72
|
+
rescue =>e
|
74
73
|
logger.error " save fail: #{$!}"
|
75
74
|
end
|
76
75
|
end
|
data/lib/pcapr/version.rb
CHANGED
data/spec/pcapr_spec.rb
CHANGED