nfcollector 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.rvmrc +1 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/lib/nfcollector.rb +41 -0
- data/lib/nfcollector/attribute_validator.rb +59 -0
- data/lib/nfcollector/attributes.rb +99 -0
- data/lib/nfcollector/categoriser.rb +43 -0
- data/lib/nfcollector/category_partition.rb +17 -0
- data/lib/nfcollector/configuration.rb +24 -0
- data/lib/nfcollector/copy_file_writer.rb +47 -0
- data/lib/nfcollector/domain_parser.rb +49 -0
- data/lib/nfcollector/input_definition.rb +31 -0
- data/lib/nfcollector/mapping.rb +7 -0
- data/lib/nfcollector/mapping/categories_processor.rb +36 -0
- data/lib/nfcollector/mapping/column_transpiler.rb +29 -0
- data/lib/nfcollector/mapping/default_output.rb +45 -0
- data/lib/nfcollector/mapping/effective_tld_names.dat +4394 -0
- data/lib/nfcollector/mapping/indexer.rb +21 -0
- data/lib/nfcollector/mapping/mapped_row.rb +21 -0
- data/lib/nfcollector/mapping/output.rb +59 -0
- data/lib/nfcollector/mapping/transpiler.rb +92 -0
- data/lib/nfcollector/nfcollector_exception.rb +4 -0
- data/lib/nfcollector/partition.rb +76 -0
- data/lib/nfcollector/partitioner.rb +37 -0
- data/lib/nfcollector/payload_processor.rb +46 -0
- data/lib/nfcollector/sequence_generator.rb +11 -0
- data/lib/nfcollector/version.rb +3 -0
- data/lib/nfcollector/weblog_partition.rb +26 -0
- data/nfcollector.gemspec +30 -0
- data/spec/attribute_validator_spec.rb +23 -0
- data/spec/attributes_spec.rb +15 -0
- data/spec/command_parser_spec.rb +81 -0
- data/spec/copy_file_writer_spec.rb +95 -0
- data/spec/input_definition_spec.rb +18 -0
- data/spec/nfcollector/category_partitioner_spec.rb +51 -0
- data/spec/nfcollector/date_partitioner_spec.rb +19 -0
- data/spec/nfcollector/input_definition_spec.rb +32 -0
- data/spec/nfcollector/mapping/column_transpiler_spec.rb +26 -0
- data/spec/nfcollector/mapping/output_spec.rb +76 -0
- data/spec/nfcollector/mapping/transpiler_spec.rb +47 -0
- data/spec/payload_job_spec.rb +11 -0
- data/spec/payload_processor_spec.rb +114 -0
- data/spec/spec_helper.rb +89 -0
- data/test/domains_hosts +194826 -0
- data/test/generate_input.rb +79 -0
- data/test/input/input-1000.csv +1000 -0
- data/test/input/input-100000.csv +100000 -0
- data/test/input/input-100000.dat +64039 -0
- data/test/input/input-no-tags.csv +3 -0
- data/test/input/input-no-tags.dat +3 -0
- data/test/input/input-no-tags.gz +0 -0
- data/test/input/input-with-tags.csv.gz +0 -0
- data/test/test_helper.rb +15 -0
- data/test/tester.rb +32 -0
- metadata +252 -0
@@ -0,0 +1,3 @@
|
|
1
|
+
10.1.1.56,A,www.google.com,/search,macbook01.local,2011-07-11 14:56:10.000,ddraper,200,text/html,5576,1
|
2
|
+
10.1.1.56,A,www.google.com,/search,macbook01.local,2011-07-11 14:56:10.000,ddraper,200,text/html,5576,1
|
3
|
+
10.1.1.56,A,www.google.com,/search,macbook01.local,2011-07-12 14:56:10.000,ddraper,200,text/html,5576,1
|
Binary file
|
Binary file
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'byebug'
|
2
|
+
require 'stringio'
|
3
|
+
require 'shoulda'
|
4
|
+
require 'timecop'
|
5
|
+
require 'differ'
|
6
|
+
|
7
|
+
require "test/unit"
|
8
|
+
require "mocha"
|
9
|
+
|
10
|
+
require File.dirname(__FILE__) + '/../lib/nfcollector'
|
11
|
+
|
12
|
+
def assert_strings_equal(expected, actual)
|
13
|
+
message = "Expected:\n#{expected}\n#{"-"*20}\nActual:\n#{actual}\n#{"-"*20}\nDiff:\n#{Differ.diff_by_line(actual, expected).format_as(:color)}"
|
14
|
+
assert(expected == actual, message)
|
15
|
+
end
|
data/test/tester.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Ensure local load path
|
4
|
+
$: << "."
|
5
|
+
|
6
|
+
require "rubygems"
|
7
|
+
require "bundler/setup"
|
8
|
+
|
9
|
+
require 'logger'
|
10
|
+
require 'zlib'
|
11
|
+
|
12
|
+
require 'payload_processor'
|
13
|
+
|
14
|
+
logger = Logger.new(STDOUT)
|
15
|
+
|
16
|
+
begin
|
17
|
+
processor = PayloadProcessor.new
|
18
|
+
|
19
|
+
processor.account_id = 40
|
20
|
+
processor.process_attribute_codes(">a,Rr,Rh,Rp,>A,t,Un,Hs,mt,<s,Cs,Rc")
|
21
|
+
|
22
|
+
contents = File.new('input/input-100000.csv').read
|
23
|
+
contents = Base64.encode64(Zlib::Deflate::deflate(contents)).tr("+/", "-_")
|
24
|
+
processor.io = StringIO.new(contents)
|
25
|
+
|
26
|
+
start_time = Time.now
|
27
|
+
processor.process_payload
|
28
|
+
end_time = Time.now
|
29
|
+
puts "Processing Time: #{end_time - start_time}"
|
30
|
+
rescue
|
31
|
+
logger.error $!
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,252 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nfcollector
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dan Draper
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: test-unit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: shoulda
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: timecop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: differ
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: activerecord
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: domainatrix
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.0.10
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.0.10
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: activesupport
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.2'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '3.2'
|
139
|
+
description: Data collection system for NetFox
|
140
|
+
email:
|
141
|
+
- daniel@codefire.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rspec"
|
148
|
+
- ".rvmrc"
|
149
|
+
- Gemfile
|
150
|
+
- LICENSE.txt
|
151
|
+
- README.md
|
152
|
+
- Rakefile
|
153
|
+
- lib/nfcollector.rb
|
154
|
+
- lib/nfcollector/attribute_validator.rb
|
155
|
+
- lib/nfcollector/attributes.rb
|
156
|
+
- lib/nfcollector/categoriser.rb
|
157
|
+
- lib/nfcollector/category_partition.rb
|
158
|
+
- lib/nfcollector/configuration.rb
|
159
|
+
- lib/nfcollector/copy_file_writer.rb
|
160
|
+
- lib/nfcollector/domain_parser.rb
|
161
|
+
- lib/nfcollector/input_definition.rb
|
162
|
+
- lib/nfcollector/mapping.rb
|
163
|
+
- lib/nfcollector/mapping/categories_processor.rb
|
164
|
+
- lib/nfcollector/mapping/column_transpiler.rb
|
165
|
+
- lib/nfcollector/mapping/default_output.rb
|
166
|
+
- lib/nfcollector/mapping/effective_tld_names.dat
|
167
|
+
- lib/nfcollector/mapping/indexer.rb
|
168
|
+
- lib/nfcollector/mapping/mapped_row.rb
|
169
|
+
- lib/nfcollector/mapping/output.rb
|
170
|
+
- lib/nfcollector/mapping/transpiler.rb
|
171
|
+
- lib/nfcollector/nfcollector_exception.rb
|
172
|
+
- lib/nfcollector/partition.rb
|
173
|
+
- lib/nfcollector/partitioner.rb
|
174
|
+
- lib/nfcollector/payload_processor.rb
|
175
|
+
- lib/nfcollector/sequence_generator.rb
|
176
|
+
- lib/nfcollector/version.rb
|
177
|
+
- lib/nfcollector/weblog_partition.rb
|
178
|
+
- nfcollector.gemspec
|
179
|
+
- spec/attribute_validator_spec.rb
|
180
|
+
- spec/attributes_spec.rb
|
181
|
+
- spec/command_parser_spec.rb
|
182
|
+
- spec/copy_file_writer_spec.rb
|
183
|
+
- spec/input_definition_spec.rb
|
184
|
+
- spec/nfcollector/category_partitioner_spec.rb
|
185
|
+
- spec/nfcollector/date_partitioner_spec.rb
|
186
|
+
- spec/nfcollector/input_definition_spec.rb
|
187
|
+
- spec/nfcollector/mapping/column_transpiler_spec.rb
|
188
|
+
- spec/nfcollector/mapping/output_spec.rb
|
189
|
+
- spec/nfcollector/mapping/transpiler_spec.rb
|
190
|
+
- spec/payload_job_spec.rb
|
191
|
+
- spec/payload_processor_spec.rb
|
192
|
+
- spec/spec_helper.rb
|
193
|
+
- test/domains_hosts
|
194
|
+
- test/generate_input.rb
|
195
|
+
- test/input/input-1000.csv
|
196
|
+
- test/input/input-100000.csv
|
197
|
+
- test/input/input-100000.dat
|
198
|
+
- test/input/input-no-tags.csv
|
199
|
+
- test/input/input-no-tags.dat
|
200
|
+
- test/input/input-no-tags.gz
|
201
|
+
- test/input/input-with-tags.csv.gz
|
202
|
+
- test/test_helper.rb
|
203
|
+
- test/tester.rb
|
204
|
+
homepage: ''
|
205
|
+
licenses: []
|
206
|
+
metadata: {}
|
207
|
+
post_install_message:
|
208
|
+
rdoc_options: []
|
209
|
+
require_paths:
|
210
|
+
- lib
|
211
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ">="
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: '0'
|
221
|
+
requirements: []
|
222
|
+
rubyforge_project:
|
223
|
+
rubygems_version: 2.2.2
|
224
|
+
signing_key:
|
225
|
+
specification_version: 4
|
226
|
+
summary: Data Collection
|
227
|
+
test_files:
|
228
|
+
- spec/attribute_validator_spec.rb
|
229
|
+
- spec/attributes_spec.rb
|
230
|
+
- spec/command_parser_spec.rb
|
231
|
+
- spec/copy_file_writer_spec.rb
|
232
|
+
- spec/input_definition_spec.rb
|
233
|
+
- spec/nfcollector/category_partitioner_spec.rb
|
234
|
+
- spec/nfcollector/date_partitioner_spec.rb
|
235
|
+
- spec/nfcollector/input_definition_spec.rb
|
236
|
+
- spec/nfcollector/mapping/column_transpiler_spec.rb
|
237
|
+
- spec/nfcollector/mapping/output_spec.rb
|
238
|
+
- spec/nfcollector/mapping/transpiler_spec.rb
|
239
|
+
- spec/payload_job_spec.rb
|
240
|
+
- spec/payload_processor_spec.rb
|
241
|
+
- spec/spec_helper.rb
|
242
|
+
- test/domains_hosts
|
243
|
+
- test/generate_input.rb
|
244
|
+
- test/input/input-1000.csv
|
245
|
+
- test/input/input-100000.csv
|
246
|
+
- test/input/input-100000.dat
|
247
|
+
- test/input/input-no-tags.csv
|
248
|
+
- test/input/input-no-tags.dat
|
249
|
+
- test/input/input-no-tags.gz
|
250
|
+
- test/input/input-with-tags.csv.gz
|
251
|
+
- test/test_helper.rb
|
252
|
+
- test/tester.rb
|