dvrtools 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/dnsmap +16 -1
  3. data/lib/dvrtools/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ddb800c33e118f64a660d98b3eee2eb80da814c
4
- data.tar.gz: aec02509baece2b80544dbef260250675dd091b3
3
+ metadata.gz: add60494b261950949a033c3839f1d951860f0d9
4
+ data.tar.gz: 37f20949e643e0ad030a7f914995e27decbe619a
5
5
  SHA512:
6
- metadata.gz: 1c87f1fd6bfdec071b10a88f7b6464a3a773b06495e047f7eedf5b134e520149c691f6631b309298fb95706ba324e11657c8a33413aaa890075eb339d2979b5a
7
- data.tar.gz: ce2e281d1400adf211bba648947c0a28e5532e1c9ed5be50e33760f86c61c39e024945cb9a21809891a55ad5c36cef1a2a76f70ed5abb3ffc291ba6583714dc9
6
+ metadata.gz: 32bc6d2f78f5f6b56ba04e67d45a627f62253f4a1f948ecbba714cc5c64a8d1201291005fd9ac43be362bbc9ba24856f4d96fcb9efa80ead73292a57e519c48a
7
+ data.tar.gz: 5105e6527dea53eeec2e517fa7a8e28b25023613a6d7e4e522884f0ac90ed76fa8e2035f8dcfa79500a097fbe811188c3503616922f84599a83cc31aece1278c
data/bin/dnsmap CHANGED
@@ -5,6 +5,7 @@ require 'digest/md5'
5
5
  require 'msgpack'
6
6
  require 'eventmachine'
7
7
  require 'gviz'
8
+ require 'open3'
8
9
  require 'pp'
9
10
 
10
11
  opt = {
@@ -13,6 +14,8 @@ opt = {
13
14
  :aggregate => false,
14
15
  :layout => 'neato',
15
16
  :verbose => false,
17
+ :pcapfile => nil,
18
+ :binpath => 'devourer'
16
19
  }
17
20
 
18
21
  optpsr = OptionParser.new
@@ -20,6 +23,8 @@ optpsr.on('-o VAL', 'output file name') {|v| opt[:output] = v }
20
23
  optpsr.on('-i VAL', 'interval (sec)') {|v| opt[:interval] = v.to_i }
21
24
  optpsr.on('-a', 'aggregate IP address by /24') {|v| opt[:aggregate] = v }
22
25
  optpsr.on('-l VAL', 'graphviz layout, default: neato') {|v| opt[:layout] = v}
26
+ optpsr.on('-r VAL', 'specify pcap file') {|v| opt[:pcapfile] = v}
27
+ optpsr.on('-b VAL', 'path of devourer') {|v| opt[:binpath] = v}
23
28
  optpsr.on('-q', 'quiet mode') {|v| $VERBOSE = nil}
24
29
  optpsr.on('-v', 'verbose mode') {|v| opt[:verbose] = v }
25
30
 
@@ -141,7 +146,17 @@ end
141
146
 
142
147
  if args.size == 0
143
148
  EM.run do
144
- dm = EM.attach(STDIN, DnsMap, opt)
149
+ if opt[:pcapfile].nil?
150
+ warn 'stdin'
151
+ input_stream = STDIN
152
+ else
153
+ warn 'popen'
154
+ stdin, stdout, stderr = Open3.popen3("#{opt[:binpath]} -r #{opt[:pcapfile]} -o -")
155
+ stdout.sync = true
156
+ input_stream = stdout;
157
+ end
158
+
159
+ dm = EM.attach(input_stream, DnsMap, opt)
145
160
 
146
161
  if opt[:interval] > 0
147
162
  pt = EventMachine::PeriodicTimer.new(interval) do
@@ -1,3 +1,3 @@
1
1
  module Dvrtools
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dvrtools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masayoshi Mizutani