embulk-input-pcapng-files 0.1.4 → 0.1.5

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b846df88bec63c3202e1cee8a135ec907ee914e5
4
+ data.tar.gz: 7328186d3f07b67bcb41407df722dcc3c2bb5a3d
5
+ SHA512:
6
+ metadata.gz: 32261a5cbd7dc6852db203e88684fd8be3aab128e335c9614c1a5264a25dbe851cb6919ea65352a36ba57860ea252e3a9d0f5530190494add3c408ef5bbaa1cf
7
+ data.tar.gz: c166a539b0cff2977bb3c045313e91e885036efb7758cb4a3a3a13b526e7975a8307b2f4a0d3512ace1a8646d4ee7584aff4fbc67860b9f90a5f0aec7e74da06
data/README.md CHANGED
@@ -16,10 +16,11 @@ Obsoletes enukane/embulk-plugin-input-pcapng-files
16
16
 
17
17
  |name|type|required?|default|description|
18
18
  |:---|:---|:--------|:------|:----------|
19
- | paths | string | required | [] | paths where pcapng files exist (no recursive searching|
19
+ | paths | array | required | [] | paths where pcapng files exist (no recursive searching|
20
20
  | convertdot | string | optional | nil | convert "." in field name (for outputing into DB who doesn't accept "dot" in schema)|
21
+ | use\_basename | bool | optional | false | use basename (w/o ext) as "path" value |
21
22
  | schema| array of field hash | required | nil | list of field to extract from pcapng file |
22
- |field hash| hash ({name, type}) | required | nil | "name" matches field name for tshakr (-e), "type" should be "long", "double", "string" |
23
+ |field hash| hash ({name, type}) | required | nil | "name" matches field name for tshakr (-e), "type" should be "long", "double", "string", "timestamp" |
23
24
 
24
25
  ## Example
25
26
 
@@ -31,7 +32,7 @@ in:
31
32
  threads: 2
32
33
  schema:
33
34
  - { name: frame.number, type: long }
34
- - { name: frame.time_epoch, type: double }
35
+ - { name: frame.time_epoch, type: timestamp }
35
36
  - { name: frame.len, type: long }
36
37
  - { name: wlan_mgt.ssid, type: string }
37
38
  ```
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "embulk-input-pcapng-files"
4
- spec.version = "0.1.4"
4
+ spec.version = "0.1.5"
5
5
  spec.authors = ["enukane"]
6
6
  spec.summary = "Pcapng Files input plugin for Embulk"
7
7
  spec.description = "Pcapng Files input plugin for Embulk"
@@ -2,6 +2,7 @@
2
2
  module Embulk
3
3
  module Plugin
4
4
  require "csv"
5
+ require "time"
5
6
 
6
7
  class InputPcapngFiles < InputPlugin
7
8
  Plugin.register_input("pcapng_files", self)
@@ -11,6 +12,7 @@ module Embulk
11
12
  'paths' => [],
12
13
  'done' => config.param('done', :array, default: []),
13
14
  'convertdot' => config.param('convertdot', :string, default: nil),
15
+ 'use_basename' => config.param('use_basename', :bool, default: false),
14
16
  }
15
17
 
16
18
  task['paths'] = config.param('paths', :array, default: []).map {|path|
@@ -53,7 +55,9 @@ module Embulk
53
55
  def run
54
56
  path = task['paths'][@index]
55
57
  each_packet(path, schema[1..-1].map{|elm| elm.name}) do |hash|
56
- entry = [ path ] + schema[1..-1].map {|c|
58
+ entry = []
59
+ entry << (task['use_basename'] ? File.basename(path, File.extname(path)) : path)
60
+ entry += schema[1..-1].map {|c|
57
61
  convert(hash[c.name], c.type)
58
62
  }
59
63
  @page_builder.add(entry)
@@ -77,6 +81,8 @@ module Embulk
77
81
  end
78
82
  when :double
79
83
  v = v.to_f
84
+ when :timestamp
85
+ v = Time.at(v.to_f)
80
86
  end
81
87
  return v
82
88
  end
metadata CHANGED
@@ -1,46 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-pcapng-files
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
5
- prerelease:
4
+ version: 0.1.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - enukane
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-09-04 00:00:00.000000000 Z
11
+ date: 2015-12-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '10.0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '10.0'
46
41
  description: Pcapng Files input plugin for Embulk
@@ -50,7 +45,7 @@ executables: []
50
45
  extensions: []
51
46
  extra_rdoc_files: []
52
47
  files:
53
- - .gitignore
48
+ - ".gitignore"
54
49
  - Gemfile
55
50
  - LICENSE.txt
56
51
  - README.md
@@ -60,32 +55,25 @@ files:
60
55
  homepage: https://github.com/enukane/embulk-input-pcapng-files
61
56
  licenses:
62
57
  - MIT
58
+ metadata: {}
63
59
  post_install_message:
64
60
  rdoc_options: []
65
61
  require_paths:
66
62
  - lib
67
63
  required_ruby_version: !ruby/object:Gem::Requirement
68
- none: false
69
64
  requirements:
70
- - - ! '>='
65
+ - - ">="
71
66
  - !ruby/object:Gem::Version
72
67
  version: '0'
73
- segments:
74
- - 0
75
- hash: -4490009824512618125
76
68
  required_rubygems_version: !ruby/object:Gem::Requirement
77
- none: false
78
69
  requirements:
79
- - - ! '>='
70
+ - - ">="
80
71
  - !ruby/object:Gem::Version
81
72
  version: '0'
82
- segments:
83
- - 0
84
- hash: -4490009824512618125
85
73
  requirements: []
86
74
  rubyforge_project:
87
- rubygems_version: 1.8.23
75
+ rubygems_version: 2.4.5
88
76
  signing_key:
89
- specification_version: 3
77
+ specification_version: 4
90
78
  summary: Pcapng Files input plugin for Embulk
91
79
  test_files: []