nfrb 0.0.1.alpha
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.
- data/.document +5 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +27 -0
- data/LICENSE.txt +32 -0
- data/README.rdoc +56 -0
- data/Rakefile +58 -0
- data/ext/rb_nfrb/README.files +14 -0
- data/ext/rb_nfrb/config.h +37 -0
- data/ext/rb_nfrb/dnc/nffile_inline.c +579 -0
- data/ext/rb_nfrb/extconf.rb +3 -0
- data/ext/rb_nfrb/fts_compat.c +1129 -0
- data/ext/rb_nfrb/fts_compat.h +126 -0
- data/ext/rb_nfrb/lzoconf.h +413 -0
- data/ext/rb_nfrb/lzodefs.h +1545 -0
- data/ext/rb_nfrb/minilzo.h +102 -0
- data/ext/rb_nfrb/nf_common.h +117 -0
- data/ext/rb_nfrb/nffile.c +1167 -0
- data/ext/rb_nfrb/nffile.h +1439 -0
- data/ext/rb_nfrb/nfrb.c +368 -0
- data/ext/rb_nfrb/nfx.c +636 -0
- data/ext/rb_nfrb/nfx.h +83 -0
- data/ext/rb_nfrb/util.c +517 -0
- data/ext/rb_nfrb/util.h +84 -0
- data/lib/nfrb.rb +5 -0
- data/lib/nfrb/version.rb +16 -0
- data/test/helper.rb +18 -0
- data/test/test_nfrb.rb +7 -0
- metadata +184 -0
data/ext/rb_nfrb/util.h
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2009, Peter Haag
|
3
|
+
* Copyright (c) 2004-2008, SWITCH - Teleinformatikdienste fuer Lehre und Forschung
|
4
|
+
* All rights reserved.
|
5
|
+
*
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
7
|
+
* modification, are permitted provided that the following conditions are met:
|
8
|
+
*
|
9
|
+
* * Redistributions of source code must retain the above copyright notice,
|
10
|
+
* this list of conditions and the following disclaimer.
|
11
|
+
* * Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
* this list of conditions and the following disclaimer in the documentation
|
13
|
+
* and/or other materials provided with the distribution.
|
14
|
+
* * Neither the name of SWITCH nor the names of its contributors may be
|
15
|
+
* used to endorse or promote products derived from this software without
|
16
|
+
* specific prior written permission.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
19
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
22
|
+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
23
|
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24
|
+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26
|
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
*
|
30
|
+
* $Author: haag $
|
31
|
+
*
|
32
|
+
* $Id: util.h 39 2009-11-25 08:11:15Z haag $
|
33
|
+
*
|
34
|
+
* $LastChangedRevision: 39 $
|
35
|
+
*
|
36
|
+
*/
|
37
|
+
|
38
|
+
#ifndef _UTIL_H
|
39
|
+
#define _UTIL_H 1
|
40
|
+
|
41
|
+
#define EBUFF_SIZE 256
|
42
|
+
|
43
|
+
#ifdef WORDS_BIGENDIAN
|
44
|
+
# define ntohll(n) (n)
|
45
|
+
# define htonll(n) (n)
|
46
|
+
#else
|
47
|
+
# define ntohll(n) (((uint64_t)ntohl(n)) << 32) + ntohl((n) >> 32)
|
48
|
+
# define htonll(n) (((uint64_t)htonl(n)) << 32) + htonl((n) >> 32)
|
49
|
+
#endif
|
50
|
+
|
51
|
+
typedef struct stringlist_s {
|
52
|
+
uint32_t block_size;
|
53
|
+
uint32_t max_index;
|
54
|
+
uint32_t num_strings;
|
55
|
+
char **list;
|
56
|
+
} stringlist_t;
|
57
|
+
|
58
|
+
void xsleep(long sec);
|
59
|
+
|
60
|
+
int InitLog(char *name, char *facility);
|
61
|
+
|
62
|
+
void LogError(char *format, ...);
|
63
|
+
|
64
|
+
void LogInfo(char *format, ...);
|
65
|
+
|
66
|
+
void InitStringlist(stringlist_t *list, int block_size);
|
67
|
+
|
68
|
+
void InsertString(stringlist_t *list, char *string);
|
69
|
+
|
70
|
+
int ScanTimeFrame(char *tstring, time_t *t_start, time_t *t_end);
|
71
|
+
|
72
|
+
char *TimeString(time_t start, time_t end);
|
73
|
+
|
74
|
+
char *UNIX2ISO(time_t t);
|
75
|
+
|
76
|
+
time_t ISO2UNIX(char *timestring);
|
77
|
+
|
78
|
+
void SetupInputFileSequence(char *multiple_dirs, char *single_file, char *multiple_files);
|
79
|
+
|
80
|
+
char *GetCurrentFilename(void);
|
81
|
+
|
82
|
+
void Setv6Mode(int mode);
|
83
|
+
|
84
|
+
#endif //_UTIL_H
|
data/lib/nfrb/version.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file is part of the nfrb gem for Ruby.
|
2
|
+
#
|
3
|
+
# Copyright (C) 2011 Davide Guerri
|
4
|
+
#
|
5
|
+
# This code is largely derived from nfreader.c of nfdump suite.
|
6
|
+
|
7
|
+
module NfRb
|
8
|
+
module Version
|
9
|
+
MAJOR = 0
|
10
|
+
MINOR = 0
|
11
|
+
PATCH = 1
|
12
|
+
BUILD = 'alpha'
|
13
|
+
|
14
|
+
STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
|
15
|
+
end
|
16
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'nfrb'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
data/test/test_nfrb.rb
ADDED
metadata
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nfrb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: -1851332166
|
5
|
+
prerelease: 6
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
- alpha
|
11
|
+
version: 0.0.1.alpha
|
12
|
+
platform: ruby
|
13
|
+
authors:
|
14
|
+
- Davide Guerri
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2012-03-02 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
version_requirements: *id001
|
32
|
+
name: shoulda
|
33
|
+
prerelease: false
|
34
|
+
type: :development
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 23
|
42
|
+
segments:
|
43
|
+
- 1
|
44
|
+
- 0
|
45
|
+
- 0
|
46
|
+
version: 1.0.0
|
47
|
+
version_requirements: *id002
|
48
|
+
name: bundler
|
49
|
+
prerelease: false
|
50
|
+
type: :development
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ~>
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 7
|
58
|
+
segments:
|
59
|
+
- 1
|
60
|
+
- 6
|
61
|
+
- 4
|
62
|
+
version: 1.6.4
|
63
|
+
version_requirements: *id003
|
64
|
+
name: jeweler
|
65
|
+
prerelease: false
|
66
|
+
type: :development
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
version_requirements: *id004
|
78
|
+
name: rcov
|
79
|
+
prerelease: false
|
80
|
+
type: :development
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 27
|
88
|
+
segments:
|
89
|
+
- 2
|
90
|
+
- 4
|
91
|
+
- 2
|
92
|
+
version: 2.4.2
|
93
|
+
version_requirements: *id005
|
94
|
+
name: rdoc
|
95
|
+
prerelease: false
|
96
|
+
type: :development
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
107
|
+
version_requirements: *id006
|
108
|
+
name: rake-compiler
|
109
|
+
prerelease: false
|
110
|
+
type: :development
|
111
|
+
description: Nfrb is a very simple yet fast gem that can be used to parse nfcapd files.
|
112
|
+
email: davide.guerri@gmail.com
|
113
|
+
executables: []
|
114
|
+
|
115
|
+
extensions:
|
116
|
+
- ext/rb_nfrb/extconf.rb
|
117
|
+
extra_rdoc_files:
|
118
|
+
- LICENSE.txt
|
119
|
+
- README.rdoc
|
120
|
+
files:
|
121
|
+
- .document
|
122
|
+
- Gemfile
|
123
|
+
- Gemfile.lock
|
124
|
+
- LICENSE.txt
|
125
|
+
- README.rdoc
|
126
|
+
- Rakefile
|
127
|
+
- ext/rb_nfrb/README.files
|
128
|
+
- ext/rb_nfrb/config.h
|
129
|
+
- ext/rb_nfrb/dnc/nffile_inline.c
|
130
|
+
- ext/rb_nfrb/extconf.rb
|
131
|
+
- ext/rb_nfrb/fts_compat.c
|
132
|
+
- ext/rb_nfrb/fts_compat.h
|
133
|
+
- ext/rb_nfrb/lzoconf.h
|
134
|
+
- ext/rb_nfrb/lzodefs.h
|
135
|
+
- ext/rb_nfrb/minilzo.h
|
136
|
+
- ext/rb_nfrb/nf_common.h
|
137
|
+
- ext/rb_nfrb/nffile.c
|
138
|
+
- ext/rb_nfrb/nffile.h
|
139
|
+
- ext/rb_nfrb/nfrb.c
|
140
|
+
- ext/rb_nfrb/nfx.c
|
141
|
+
- ext/rb_nfrb/nfx.h
|
142
|
+
- ext/rb_nfrb/util.c
|
143
|
+
- ext/rb_nfrb/util.h
|
144
|
+
- lib/nfrb.rb
|
145
|
+
- lib/nfrb/version.rb
|
146
|
+
- test/helper.rb
|
147
|
+
- test/test_nfrb.rb
|
148
|
+
homepage: http://github.com/dguerri/nfrb
|
149
|
+
licenses:
|
150
|
+
- BSD license
|
151
|
+
post_install_message:
|
152
|
+
rdoc_options: []
|
153
|
+
|
154
|
+
require_paths:
|
155
|
+
- lib
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
none: false
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
hash: 3
|
162
|
+
segments:
|
163
|
+
- 0
|
164
|
+
version: "0"
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
none: false
|
167
|
+
requirements:
|
168
|
+
- - ">"
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
hash: 25
|
171
|
+
segments:
|
172
|
+
- 1
|
173
|
+
- 3
|
174
|
+
- 1
|
175
|
+
version: 1.3.1
|
176
|
+
requirements: []
|
177
|
+
|
178
|
+
rubyforge_project:
|
179
|
+
rubygems_version: 1.8.15
|
180
|
+
signing_key:
|
181
|
+
specification_version: 3
|
182
|
+
summary: "Nfrb: nfcapd files parser."
|
183
|
+
test_files: []
|
184
|
+
|