bro_ids-http-log 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/README.md +58 -0
- data/Rakefile +1 -0
- data/bro_ids-http-log.gemspec +24 -0
- data/lib/bro_ids/http/log.rb +2 -0
- data/lib/bro_ids/http/log/log.rb +55 -0
- data/lib/bro_ids/http/log/version.rb +7 -0
- metadata +52 -0
data/.gitignore
ADDED
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# bro_ids-dns-log
|
2
|
+
|
3
|
+
This gem will parse the DNS log files created by BRO IDS (http://www.bro-ids.org/) and prepare the fields to be called by name in your scripts.
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
To install the bro_ids-http-log parsing gem simply run the following command:
|
8
|
+
|
9
|
+
`gem install bro_ids-http-log`
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
`require 'bro_ids/http/log'`
|
14
|
+
`BroIds::Http:Log.parse('YOUR HTTP LOG LOCATION HERE')`
|
15
|
+
|
16
|
+
## Example 1:
|
17
|
+
|
18
|
+
require 'bro_ids/http/log'
|
19
|
+
|
20
|
+
dns_log = File.open("http.log")
|
21
|
+
BroIds::Http::Log.parse(http_log) do |parsed|
|
22
|
+
puts
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
## Example 2:
|
27
|
+
|
28
|
+
load 'lib/parse_http.rb'
|
29
|
+
|
30
|
+
http_log = File.open("http.log")
|
31
|
+
BroIds::Http::Log.parse(http_log) do |parsed|
|
32
|
+
puts parsed[:timestamp]
|
33
|
+
puts parsed[:uid]
|
34
|
+
puts parsed[:id_orig_h]
|
35
|
+
puts parsed[:id_orig_p]
|
36
|
+
puts parsed[:id_resp_h]
|
37
|
+
puts parsed[:id_resp_p]
|
38
|
+
puts parsed[:trans_depth]
|
39
|
+
puts parsed[:method]
|
40
|
+
puts parsed[:host]
|
41
|
+
puts parsed[:uri]
|
42
|
+
puts parsed[:referrer]
|
43
|
+
puts parsed[:request_body_len]
|
44
|
+
puts parsed[:response_body_len]
|
45
|
+
puts parsed[:status_code]
|
46
|
+
puts parsed[:status_msg]
|
47
|
+
puts parsed[:info_code]
|
48
|
+
puts parsed[:info_msg]
|
49
|
+
puts parsed[:filename]
|
50
|
+
puts parsed[:tags]
|
51
|
+
puts parsed[:username]
|
52
|
+
puts parsed[:password]
|
53
|
+
puts parsed[:proxied]
|
54
|
+
puts parsed[:mime_type]
|
55
|
+
puts parsed[:md5]
|
56
|
+
puts parsed[:extraction_file]
|
57
|
+
end
|
58
|
+
|
data/Rakefile
ADDED
@@ -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/http/log/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "bro_ids-http-log"
|
7
|
+
s.version = BroIds::Http::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 HTTP Logs}
|
12
|
+
s.description = %q{Ruby Gem for Parsing Bro IDS HTTP Logs}
|
13
|
+
|
14
|
+
s.rubyforge_project = "bro_ids-http-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,55 @@
|
|
1
|
+
require "bro_ids/http/log/version"
|
2
|
+
|
3
|
+
module BroIds
|
4
|
+
module Http
|
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
|
+
:trans_depth => m[6],
|
21
|
+
:method => m[7],
|
22
|
+
:host => m[8],
|
23
|
+
:uri => m[9],
|
24
|
+
:referrer => m[10],
|
25
|
+
:request_body_len => m[11],
|
26
|
+
:response_body_len => m[12],
|
27
|
+
:status_code => m[13],
|
28
|
+
:status_msg => m[14],
|
29
|
+
:info_code => m[15],
|
30
|
+
:info_msg => m[16],
|
31
|
+
:filename => m[17],
|
32
|
+
:tags => m[18],
|
33
|
+
:username => m[19],
|
34
|
+
:password => m[20],
|
35
|
+
:proxied => m[21],
|
36
|
+
:mime_type => m[22],
|
37
|
+
:md5 => m[23],
|
38
|
+
:extraction_file => m[24]}
|
39
|
+
else
|
40
|
+
{}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.parse_file(filename, &block)
|
45
|
+
File.foreach(filename) do |line|
|
46
|
+
unless line =~ /^\#/
|
47
|
+
parsed = parse_line(line)
|
48
|
+
yield parsed
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
metadata
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bro_ids-http-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-02-02 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
14
|
+
description: Ruby Gem for Parsing Bro IDS HTTP Logs
|
15
|
+
email:
|
16
|
+
- elliott.cutright@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- README.md
|
23
|
+
- Rakefile
|
24
|
+
- bro_ids-http-log.gemspec
|
25
|
+
- lib/bro_ids/http/log.rb
|
26
|
+
- lib/bro_ids/http/log/log.rb
|
27
|
+
- lib/bro_ids/http/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-http-log
|
48
|
+
rubygems_version: 1.8.10
|
49
|
+
signing_key:
|
50
|
+
specification_version: 3
|
51
|
+
summary: Ruby Gem for Parsing Bro IDS HTTP Logs
|
52
|
+
test_files: []
|