sns_utils 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a569b79f304d0060cd3d6c21898000777995042
4
- data.tar.gz: b15db537d09f79751fdca09d94474a90e185fb76
3
+ metadata.gz: 51164a9c017dc73fee16d4748e3a5f51f7216ea1
4
+ data.tar.gz: 4fa3100cb93b679b09eb73d9c1d33faf8fd2ccfd
5
5
  SHA512:
6
- metadata.gz: a6f4bb613fd181471772a0a60886d5d09332724a3a1b29c014a0fea132b6273f68456a3233945fb26bffbe836737682e34592ed7784ce01fbae8ed35e4ab9da9
7
- data.tar.gz: ca7c31915d5669691554b0d46cd6ae448ffef1dc528274a078dc03a8dd09c89d40b805d962fad3e52e1c3d327faf70da91ac968498255ffb40ff966b9ad82219
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}) (?: \s|$)) /xi
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)
@@ -1,3 +1,3 @@
1
1
  module SnsUtils
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,2 @@
1
+ # should match two ips 123.12.12.126-16-2013
2
+ # invalid but should match by truncating last '0' 192.168.1.500
@@ -1,4 +1,4 @@
1
- # blah blah blah VALID 0.0.0.0 xxxx<<> 2001:0000:1234:0000:0000:C1C0:ABCD:0876 VALID >>>
2
- # 3ffe:0b00:0000:0000:0001:0000:0000:000a VALID <<<<<<<<<< INVALID 1.1.1.
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::91::7 xxxx<<> VALID 00:A0:C9:14:C8:29 >>>
4
+ # blah blah blah INVALID a5.91.7 xxxx<<> VALID 00:A0:C9:14:C8:29 >>>
@@ -8,5 +8,4 @@
8
8
  # invalid 1.1.1
9
9
  # invalid 1
10
10
  # invalid 1.1
11
- # invalid 192.168.1.500
12
11
  # invalid 999.1.1.1
@@ -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
- extractor = SnsUtils::IpExtractor.new([file]).run
9
- extractor.ip_addrs.should have(5).entries
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
- extractor = SnsUtils::IpExtractor.new([file]).run
18
- extractor.ip_addrs.should have(61).entries
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
- extractor = SnsUtils::IpExtractor.new([file]).run
27
- extractor.mac_addrs.should have(2).entries
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
- extractor = SnsUtils::IpExtractor.new([file]).run
36
- extractor.ip_addrs.should have(5).entries
37
- extractor.mac_addrs.should have(1).entry
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
- extractor = SnsUtils::IpExtractor.new([file])
54
- extractor.options.mac_threshold.should eql(8)
55
- extractor.options.ip_threshold.should eql(10)
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
- extractor = SnsUtils::IpExtractor.new([file])
60
- extractor.run
60
+ ipex = SnsUtils::IpExtractor.new([file])
61
+ ipex.run
61
62
 
62
- extractor.ip_addrs_log.should have(1).entry
63
- extractor.mac_addrs_log.should have(1).entry
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
- extractor = SnsUtils::IpExtractor.new([file, "-i", "5", "-m", "4"])
68
- extractor.options.mac_threshold.should eql(4)
69
- extractor.options.ip_threshold.should eql(5)
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
- extractor = SnsUtils::IpExtractor.new([file, "-i", "5", "-m", "5"]).run
74
- extractor.ip_addrs_log.should have(2).entries
75
- extractor.mac_addrs_log.should have(2).entries
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
- extractor = SnsUtils::IpExtractor.new([file, "-i", "11", "-m", "11"]).run
78
- extractor.ip_addrs_log.should be_empty
79
- extractor.mac_addrs_log.should be_empty
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.1
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: