bro_ids-dns-log 0.0.1

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,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
@@ -0,0 +1 @@
1
+ TODO: Make a readme
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'bro_ids/dns/log/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "bro_ids-dns-log"
7
+ s.version = BroIds::Dns::Log::VERSION
8
+ s.authors = ["Elliott Cutright"]
9
+ s.email = ["elliott.cutright@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Ruby Gem for Parsing Bro IDS DNS Logs}
12
+ s.description = %q{Ruby Gem for Parsing Bro IDS DNS Logs}
13
+
14
+ s.rubyforge_project = "bro_ids-dns-log"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ end
@@ -0,0 +1,2 @@
1
+ require 'bro_ids/dns/log/log'
2
+ require 'bro_ids/dns/log/version'
@@ -0,0 +1,53 @@
1
+ require "bro_ids/dns/log/version"
2
+
3
+ module BroIds
4
+ module Dns
5
+ module Log
6
+ def self.parse(filename, &block)
7
+ parse_file(filename, &block)
8
+ end
9
+
10
+ private
11
+ def self.parse_line(line)
12
+ m = line.split(' ')
13
+ if m
14
+ {:timestamp => m[0],
15
+ :uid => m[1],
16
+ :id_orig_h => m[2],
17
+ :id_orig_p => m[3],
18
+ :id_resp_h => m[4],
19
+ :id_resp_p => m[5],
20
+ :proto => m[6],
21
+ :trans_id => m[7],
22
+ :query => m[8],
23
+ :qclass => m[9],
24
+ :qclass_name => m[10],
25
+ :qtype => m[11],
26
+ :qtype_name => m[12],
27
+ :rcode => m[13],
28
+ :rcode_name => m[14],
29
+ :qr => m[15],
30
+ :aa => m[16],
31
+ :tc => m[17],
32
+ :rd => m[18],
33
+ :ra => m[19],
34
+ :z => m[20],
35
+ :answers => m[21],
36
+ :ttls => m[22]}
37
+ else
38
+ {}
39
+ end
40
+ end
41
+
42
+ def self.parse_file(filename, &block)
43
+ File.foreach(filename) do |line|
44
+ unless line =~ /^\#/
45
+ parsed = parse_line(line)
46
+ yield parsed
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+
@@ -0,0 +1,7 @@
1
+ module BroIds
2
+ module Dns
3
+ module Log
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bro_ids-dns-log
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Elliott Cutright
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-31 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Ruby Gem for Parsing Bro IDS DNS Logs
15
+ email:
16
+ - elliott.cutright@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - README.txt
23
+ - Rakefile
24
+ - bro_ids-dns-log.gemspec
25
+ - lib/bro_ids/dns/log.rb
26
+ - lib/bro_ids/dns/log/log.rb
27
+ - lib/bro_ids/dns/log/version.rb
28
+ homepage: ''
29
+ licenses: []
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubyforge_project: bro_ids-dns-log
48
+ rubygems_version: 1.8.10
49
+ signing_key:
50
+ specification_version: 3
51
+ summary: Ruby Gem for Parsing Bro IDS DNS Logs
52
+ test_files: []