sns_utils 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/lib/sns_utils/ip_extractor.rb +1 -1
- data/lib/sns_utils/version.rb +1 -1
- data/spec/fixtures/edge_cases.log +2 -0
- data/spec/fixtures/ipv4_ipv6_mac.log +3 -3
- data/spec/fixtures/ipv4_simple.log +0 -1
- data/spec/sns_utils/ip_extractor_spec.rb +26 -25
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51164a9c017dc73fee16d4748e3a5f51f7216ea1
|
4
|
+
data.tar.gz: 4fa3100cb93b679b09eb73d9c1d33faf8fd2ccfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76a58e05f379dc0dec284d1312b8f5f28f22a71ab6ac2006f782bcee6011989f051290840f4410fba6bdc8cb2eafbe9f8e0d4f23e4242051b54cc3bbc62331df
|
7
|
+
data.tar.gz: b300921c8de9956fa5acb06ff3f14a00714f56fec867662b48eafdad5c2410cbd3d22198e02683abc5a60328d02a79047e09427d8d0d1b9bf1a2b64cc30c7404
|
@@ -6,7 +6,7 @@ module SnsUtils
|
|
6
6
|
IPV4_REGEX = ::SnsUtils::IPv4::REGEX
|
7
7
|
IPV6_REGEX = ::SnsUtils::IPv6::REGEX
|
8
8
|
MAC_REGEX = ::SnsUtils::MAC::REGEX
|
9
|
-
IP_REGEX = / ((?: ^|\s) (?: #{IPV6_REGEX} | #{IPV4_REGEX} | #{MAC_REGEX})
|
9
|
+
IP_REGEX = / ((?: ^|\s|[a-zA-Z]) (?: #{IPV6_REGEX} | #{IPV4_REGEX} | #{MAC_REGEX})) /xi
|
10
10
|
|
11
11
|
def initialize(argv)
|
12
12
|
@file, @options = parse_options(argv)
|
data/lib/sns_utils/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# blah blah blah VALID 0.0.0.0 xxxx<<> 2001:0000:1234:0000:0000:C1C0:ABCD:0876
|
2
|
-
# 3ffe:0b00:0000:0000:0001:0000:0000:000a
|
1
|
+
# blah blah blah VALID 0.0.0.0 xxxx<<> VALID 2001:0000:1234:0000:0000:C1C0:ABCD:0876 >>>
|
2
|
+
# VALID 3ffe:0b00:0000:0000:0001:0000:0000:000a <<<<<<<<<< INVALID 1.1.1.
|
3
3
|
# blah blah blah VALID 99.1.1.1 xxxx<<> VALID FF02:0000:0000:0000:0000:0000:0000:0001 >>>
|
4
|
-
# blah blah blah INVALID a5
|
4
|
+
# blah blah blah INVALID a5.91.7 xxxx<<> VALID 00:A0:C9:14:C8:29 >>>
|
@@ -5,8 +5,8 @@ describe SnsUtils::IpExtractor do
|
|
5
5
|
let(:file) { fixture_path("ipv4_simple.log") }
|
6
6
|
|
7
7
|
it "finds valid entries" do
|
8
|
-
|
9
|
-
|
8
|
+
ipex = SnsUtils::IpExtractor.new([file]).run
|
9
|
+
ipex.ip_addrs.should have(5).entries
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -14,8 +14,8 @@ describe SnsUtils::IpExtractor do
|
|
14
14
|
let(:file) { fixture_path("ipv6_simple.log") }
|
15
15
|
|
16
16
|
it "finds valid entries" do
|
17
|
-
|
18
|
-
|
17
|
+
ipex = SnsUtils::IpExtractor.new([file]).run
|
18
|
+
ipex.ip_addrs.should have(92).entries
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -23,8 +23,8 @@ describe SnsUtils::IpExtractor do
|
|
23
23
|
let(:file) { fixture_path("mac_simple.log") }
|
24
24
|
|
25
25
|
it "finds valid entries" do
|
26
|
-
|
27
|
-
|
26
|
+
ipex = SnsUtils::IpExtractor.new([file]).run
|
27
|
+
ipex.mac_addrs.should have(2).entries
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -32,9 +32,10 @@ describe SnsUtils::IpExtractor do
|
|
32
32
|
let(:file) { fixture_path("ipv4_ipv6_mac.log") }
|
33
33
|
|
34
34
|
it "finds valid entries" do
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
ipex = SnsUtils::IpExtractor.new([file]).run
|
36
|
+
pp ipex.ip_addrs
|
37
|
+
ipex.ip_addrs.should have(5).entries
|
38
|
+
ipex.mac_addrs.should have(1).entry
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
@@ -50,33 +51,33 @@ describe SnsUtils::IpExtractor do
|
|
50
51
|
end
|
51
52
|
|
52
53
|
it "has default IP and MAC threshold" do
|
53
|
-
|
54
|
-
|
55
|
-
|
54
|
+
ipex = SnsUtils::IpExtractor.new([file])
|
55
|
+
ipex.options.mac_threshold.should eql(8)
|
56
|
+
ipex.options.ip_threshold.should eql(10)
|
56
57
|
end
|
57
58
|
|
58
59
|
it "uses default IP and MAC threshold" do
|
59
|
-
|
60
|
-
|
60
|
+
ipex = SnsUtils::IpExtractor.new([file])
|
61
|
+
ipex.run
|
61
62
|
|
62
|
-
|
63
|
-
|
63
|
+
ipex.ip_addrs_log.should have(1).entry
|
64
|
+
ipex.mac_addrs_log.should have(1).entry
|
64
65
|
end
|
65
66
|
|
66
67
|
it "adjusts default IP and MAC threshold" do
|
67
|
-
|
68
|
-
|
69
|
-
|
68
|
+
ipex = SnsUtils::IpExtractor.new([file, "-i", "5", "-m", "4"])
|
69
|
+
ipex.options.mac_threshold.should eql(4)
|
70
|
+
ipex.options.ip_threshold.should eql(5)
|
70
71
|
end
|
71
72
|
|
72
73
|
it "uses adjusted IP and MAC threshold" do
|
73
|
-
|
74
|
-
|
75
|
-
|
74
|
+
ipex = SnsUtils::IpExtractor.new([file, "-i", "5", "-m", "5"]).run
|
75
|
+
ipex.ip_addrs_log.should have(2).entries
|
76
|
+
ipex.mac_addrs_log.should have(2).entries
|
76
77
|
|
77
|
-
|
78
|
-
|
79
|
-
|
78
|
+
ipex = SnsUtils::IpExtractor.new([file, "-i", "11", "-m", "11"]).run
|
79
|
+
ipex.ip_addrs_log.should be_empty
|
80
|
+
ipex.mac_addrs_log.should be_empty
|
80
81
|
end
|
81
82
|
end
|
82
83
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sns_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sahglie
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- man/ipex.1.ronn
|
91
91
|
- man/ipex.1.txt
|
92
92
|
- sns_utils.gemspec
|
93
|
+
- spec/fixtures/edge_cases.log
|
93
94
|
- spec/fixtures/ipv4_ipv6_mac.log
|
94
95
|
- spec/fixtures/ipv4_simple.log
|
95
96
|
- spec/fixtures/ipv6_simple.log
|
@@ -122,6 +123,7 @@ signing_key:
|
|
122
123
|
specification_version: 4
|
123
124
|
summary: Find and extract IP and MAC addresses in FILE
|
124
125
|
test_files:
|
126
|
+
- spec/fixtures/edge_cases.log
|
125
127
|
- spec/fixtures/ipv4_ipv6_mac.log
|
126
128
|
- spec/fixtures/ipv4_simple.log
|
127
129
|
- spec/fixtures/ipv6_simple.log
|
@@ -129,4 +131,3 @@ test_files:
|
|
129
131
|
- spec/fixtures/thresholds.log
|
130
132
|
- spec/sns_utils/ip_extractor_spec.rb
|
131
133
|
- spec/spec_helper.rb
|
132
|
-
has_rdoc:
|