logstash-filter-public_ip 1.0.0 → 1.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/CHANGELOG.md +5 -0
- data/README.md +38 -81
- data/lib/logstash/filters/public_ip.rb +90 -16
- data/logstash-filter-public_ip.gemspec +1 -1
- data/spec/filters/public_ip_spec.rb +17 -0
- metadata +2 -5
- data/CONTRIBUTORS +0 -10
- data/DEVELOPER.md +0 -2
- data/lib/logstash/filters/ipvlookup.rb +0 -114
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8ad958c9975e1979ffd5c6ae16347bbbd47ca0c176b2de570488ca7365ec6ca
|
4
|
+
data.tar.gz: d0103de21ee835e76279455bcf05a1ee4fcf7005ca62a8b4fb3017b3a8667997
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 412020f4480f5967261c1b43d25cc22859fb1ce3e5bfecf6668b881bb0288b3fe77457751da09e0eb4941dbf0cd38559617f9f957d02f8da1e9640e633c92244
|
7
|
+
data.tar.gz: 171a671373fce9490b2c2fe82e4355491050cfc77593bebab3849625ee3c7300fd1a9ebe7443d5f1f5814c6546947fb5e35c5f941f0f8819672a10fac7924e3a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,94 +1,51 @@
|
|
1
|
-
# Logstash Plugin
|
1
|
+
# Logstash Plugin - public_ip
|
2
2
|
|
3
3
|
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
4
4
|
|
5
5
|
It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
|
6
6
|
|
7
|
-
## Documentation
|
8
|
-
|
9
7
|
This Logstash filter plugin is used to determine ip version and if the ip address is public.
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
```
|
47
|
-
|
48
|
-
```
|
49
|
-
|
50
|
-
### 2. Running your unpublished Plugin in Logstash
|
51
|
-
|
52
|
-
#### 2.1 Run in a local Logstash clone
|
53
|
-
|
54
|
-
- Edit Logstash `Gemfile` and add the local plugin path, for example:
|
55
|
-
```ruby
|
56
|
-
gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
|
57
|
-
```
|
58
|
-
- Install plugin
|
59
|
-
```sh
|
60
|
-
bin/logstash-plugin install --no-verify
|
61
|
-
```
|
62
|
-
- Run Logstash with your plugin
|
63
|
-
```sh
|
64
|
-
bin/logstash -e 'filter {awesome {}}'
|
65
|
-
```
|
66
|
-
At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
|
67
|
-
|
68
|
-
#### 2.2 Run in an installed Logstash
|
69
|
-
|
70
|
-
You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using:
|
71
|
-
|
72
|
-
- Build your plugin gem
|
73
|
-
```sh
|
74
|
-
gem build logstash-filter-awesome.gemspec
|
75
|
-
```
|
76
|
-
- Install the plugin from the Logstash home
|
77
|
-
```sh
|
78
|
-
bin/logstash-plugin install /your/local/plugin/logstash-filter-awesome.gem
|
9
|
+
The plugin uses the following cidr ranges to determine if the ipaddress is in a non-public range.
|
10
|
+
```
|
11
|
+
# NON-PUBLIC REASONS
|
12
|
+
# ---------------
|
13
|
+
# 0.0.0.0/8 = RFC1700: reserved as a source address only
|
14
|
+
# 10.0.0.0/8 = RFC1918: reserved for private networking
|
15
|
+
# 100.64.0.0/10 = RFC6598: reserved for service provider shared address space but may be used in a manner similiar to RF1918
|
16
|
+
# 127.0.0.0/8 = RFC1112: assigned for use as the Internet host loopback address
|
17
|
+
# 169.254.0.0/16 = RFC3927: used for link-local addressing in Internet Protocol Version 4
|
18
|
+
# 172.16.0.0/12 = RFC1918: reserved for private networking
|
19
|
+
# 192.0.0.0/24 = RFC6890: IETF Protocol Assignments
|
20
|
+
# 192.0.0.8/32 = RFC7600: IPv4 dummy address
|
21
|
+
# 192.0.2.0/24 = RFC5737: Assigned as TEST-NET-1, documentation and examples
|
22
|
+
# 192.31.196.0/24 = RFC7535: AS112-v4
|
23
|
+
# 192.52.193.0/24 = RFC7450: AMT
|
24
|
+
# 192.88.99.0/24 = RFC7526: Reserved. Formerly used for IPv6 to IPv4 relay (included IPv6 address block 2002::/16
|
25
|
+
# 192.168.0.0/16 = RFC1918: reserved for private networking
|
26
|
+
# 198.18.0.0/15 = RFC2544: Used for benchmark testing of inter-network communications between two separate subnets
|
27
|
+
# 198.51.100.0/24 = RFC5737: Assigned as TEST-NET-2, documentation and examples
|
28
|
+
# 203.0.113.0/24 = RFC5737: Assigned as TEST-NET-3, documentation and examples
|
29
|
+
# 224.0.0.0/4 = RFC1112: In use for IP multicast (Former Class D network)
|
30
|
+
# 240.0.0.0/4 = RFC6890: Reserved for future use. (Former Class E network)
|
31
|
+
# 255.255.255.255/32 = RFC8190: Reserved for the limited broadcast destination address
|
32
|
+
# fc00::/7 = RFC4193: Unique Local Address
|
33
|
+
# fe80::/10 = RFC4291: Link-Local Address
|
34
|
+
# ff00::/8 = RFC4291: Multicast Address
|
35
|
+
# 2001:db8::/32 = RFC3849: Addresses used in documentation and example source code
|
36
|
+
# 2001:20::/28 = RFC7343: Prefix for Overlay Routable Cryptographic Hash Identifiers Version 2
|
37
|
+
# ::1/128 = RFC8190: Loopback address to local host
|
38
|
+
# ::/128 = RFC8190: Unspecified address
|
39
|
+
# 100::/64 = RFC6666: Discard Prefix
|
40
|
+
# 64:ff9b::/96 = RFC6052: IPv4/IPv6 translation
|
41
|
+
```
|
42
|
+
|
43
|
+
## Installation
|
44
|
+
```
|
45
|
+
bin/logstash-plugin install logstash-filter-public_ip
|
79
46
|
```
|
80
47
|
- Start Logstash and proceed to test the plugin
|
81
48
|
|
82
|
-
## Contributing
|
83
|
-
|
84
|
-
All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
|
85
|
-
|
86
|
-
Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
|
87
|
-
|
88
|
-
It is more important to the community that you are able to contribute.
|
89
|
-
|
90
|
-
For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
|
91
|
-
|
92
49
|
#### USAGE
|
93
50
|
```
|
94
51
|
filter {
|
@@ -1,15 +1,41 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "logstash/filters/base"
|
3
|
-
require "logstash/
|
4
|
-
require
|
3
|
+
require "logstash/namespace"
|
4
|
+
require 'ipaddr'
|
5
|
+
|
6
|
+
# NON-PUBLIC CIDRS THIS PLUGIN USES TO VERIFY IF THE IP IS PUBLIC OR PRIVATE
|
7
|
+
# ---------------
|
8
|
+
# 0.0.0.0/8 = RFC1700: reserved as a source address only
|
9
|
+
# 10.0.0.0/8 = RFC1918: reserved for private networking
|
10
|
+
# 100.64.0.0/10 = RFC6598: reserved for service provider shared address space but may be used in a manner similiar to RF1918
|
11
|
+
# 127.0.0.0/8 = RFC1112: assigned for use as the Internet host loopback address
|
12
|
+
# 169.254.0.0/16 = RFC3927: used for link-local addressing in Internet Protocol Version 4
|
13
|
+
# 172.16.0.0/12 = RFC1918: reserved for private networking
|
14
|
+
# 192.0.0.0/24 = RFC6890: IETF Protocol Assignments
|
15
|
+
# 192.0.0.8/32 = RFC7600: IPv4 dummy address
|
16
|
+
# 192.0.2.0/24 = RFC5737: Assigned as TEST-NET-1, documentation and examples
|
17
|
+
# 192.31.196.0/24 = RFC7535: AS112-v4
|
18
|
+
# 192.52.193.0/24 = RFC7450: AMT
|
19
|
+
# 192.88.99.0/24 = RFC7526: Reserved. Formerly used for IPv6 to IPv4 relay (included IPv6 address block 2002::/16
|
20
|
+
# 192.168.0.0/16 = RFC1918: reserved for private networking
|
21
|
+
# 198.18.0.0/15 = RFC2544: Used for benchmark testing of inter-network communications between two separate subnets
|
22
|
+
# 198.51.100.0/24 = RFC5737: Assigned as TEST-NET-2, documentation and examples
|
23
|
+
# 203.0.113.0/24 = RFC5737: Assigned as TEST-NET-3, documentation and examples
|
24
|
+
# 224.0.0.0/4 = RFC1112: In use for IP multicast (Former Class D network)
|
25
|
+
# 240.0.0.0/4 = RFC6890: Reserved for future use. (Former Class E network)
|
26
|
+
# 255.255.255.255/32 = RFC8190: Reserved for the limited broadcast destination address
|
27
|
+
# fc00::/7 = RFC4193: Unique Local Address
|
28
|
+
# fe80::/10 = RFC4291: Link-Local Address
|
29
|
+
# ff00::/8 = RFC4291: Multicast Address
|
30
|
+
# 2001:db8::/32 = RFC3849: Addresses used in documentation and example source code
|
31
|
+
# 2001:20::/28 = RFC7343: Prefix for Overlay Routable Cryptographic Hash Identifiers Version 2
|
32
|
+
# ::1/128 = RFC8190: Loopback address to local host
|
33
|
+
# ::/128 = RFC8190: Unspecified address
|
34
|
+
# 100::/64 = RFC6666: Discard Prefix
|
35
|
+
# 64:ff9b::/96 = RFC6052: IPv4/IPv6 translation
|
5
36
|
|
6
|
-
# This filter will replace the contents of the default
|
7
|
-
# message field with whatever you specify in the configuration.
|
8
|
-
#
|
9
|
-
# It is only intended to be used as an .
|
10
37
|
class LogStash::Filters::PublicIp < LogStash::Filters::Base
|
11
38
|
|
12
|
-
# Setting the config_name here is required. This is how you
|
13
39
|
# configure this filter from your Logstash config.
|
14
40
|
#
|
15
41
|
# filter {
|
@@ -33,20 +59,68 @@ class LogStash::Filters::PublicIp < LogStash::Filters::Base
|
|
33
59
|
|
34
60
|
public
|
35
61
|
def register
|
36
|
-
|
62
|
+
# NON-PUBLIC CIDR ARRAY
|
63
|
+
@cidr = [
|
64
|
+
"0.0.0.0/8",
|
65
|
+
"10.0.0.0/8",
|
66
|
+
"100.64.0.0/10",
|
67
|
+
"127.0.0.0/8",
|
68
|
+
"169.254.0.0/16",
|
69
|
+
"172.16.0.0/12",
|
70
|
+
"192.0.0.0/24",
|
71
|
+
"192.0.0.8/32",
|
72
|
+
"192.0.2.0/24",
|
73
|
+
"192.31.196.0/24",
|
74
|
+
"192.52.193.0/24",
|
75
|
+
"192.88.99.0/24",
|
76
|
+
"192.168.0.0/16",
|
77
|
+
"198.18.0.0/15",
|
78
|
+
"198.51.100.0/24",
|
79
|
+
"203.0.113.0/24",
|
80
|
+
"224.0.0.0/4",
|
81
|
+
"240.0.0.0/4",
|
82
|
+
"255.255.255.255/32",
|
83
|
+
"fc00::/7",
|
84
|
+
"fe80::/10",
|
85
|
+
"ff00::/8",
|
86
|
+
"2001:db8::/32",
|
87
|
+
"2001:20::/28",
|
88
|
+
"::1/128",
|
89
|
+
"::/128",
|
90
|
+
"100::/64",
|
91
|
+
"64:ff9b::/96"
|
92
|
+
]
|
93
|
+
end # def register
|
37
94
|
|
38
|
-
|
39
95
|
public
|
40
96
|
def filter(event)
|
41
|
-
|
42
|
-
|
43
|
-
|
97
|
+
begin
|
98
|
+
ip = event.get(@source)
|
99
|
+
srcip = IPAddr.new(ip)
|
100
|
+
validip = true
|
101
|
+
rescue
|
102
|
+
validip = false
|
103
|
+
end
|
44
104
|
if validip == true
|
45
|
-
|
105
|
+
# ip version
|
106
|
+
if srcip.ipv4?
|
107
|
+
ipv = '4'
|
108
|
+
elsif srcip.ipv6?
|
109
|
+
ipv = '6'
|
110
|
+
end
|
46
111
|
event.set("#{@target_ipv}", ipv)
|
47
|
-
|
112
|
+
|
113
|
+
# public ip check
|
114
|
+
pubip = true
|
115
|
+
@cidr.each do |p|
|
116
|
+
cidr = IPAddr.new(p)
|
117
|
+
if cidr.include?(srcip)
|
118
|
+
pubip = false
|
119
|
+
end
|
120
|
+
end
|
48
121
|
event.set("#{@target_pub_ip}", pubip)
|
49
122
|
end
|
123
|
+
|
50
124
|
# Tag event if invalid ip
|
51
125
|
tag_invalid_ip(event) if validip == false
|
52
126
|
# filter_matched should go in the last line of our successful code
|
@@ -54,8 +128,8 @@ class LogStash::Filters::PublicIp < LogStash::Filters::Base
|
|
54
128
|
end # def filter
|
55
129
|
|
56
130
|
def tag_invalid_ip(event)
|
57
|
-
@logger.debug? && @logger.
|
131
|
+
@logger.debug? && @logger.warn("Invalid IP #{event.get(@source)}", :event => event)
|
58
132
|
@tag_on_invalid_ip.each{|tag| event.tag(tag)}
|
59
|
-
end
|
133
|
+
end # def tag_invalid_ip
|
60
134
|
|
61
135
|
end # class LogStash::Filters::PublicIp
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-public_ip'
|
3
|
-
s.version = '1.0.
|
3
|
+
s.version = '1.0.2'
|
4
4
|
s.licenses = ['Apache-2.0']
|
5
5
|
s.summary = 'IP version and Public check'
|
6
6
|
s.description = 'logstash plugin that checks ip version and if the ip is public'
|
@@ -71,4 +71,21 @@ describe LogStash::Filters::PublicIp do
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
+
describe "no valid source" do
|
75
|
+
let(:config) do <<-CONFIG
|
76
|
+
filter {
|
77
|
+
public_ip {
|
78
|
+
source => "ip"
|
79
|
+
target_ipv => "ipv"
|
80
|
+
target_pub_ip => "pubip"
|
81
|
+
}
|
82
|
+
}
|
83
|
+
CONFIG
|
84
|
+
end
|
85
|
+
|
86
|
+
sample("ip" => nil) do
|
87
|
+
expect(subject.get("tags")).to include("_invalid_ip")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
74
91
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-public_ip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Pananen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,12 +45,9 @@ extensions: []
|
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
47
|
- CHANGELOG.md
|
48
|
-
- CONTRIBUTORS
|
49
|
-
- DEVELOPER.md
|
50
48
|
- Gemfile
|
51
49
|
- LICENSE
|
52
50
|
- README.md
|
53
|
-
- lib/logstash/filters/ipvlookup.rb
|
54
51
|
- lib/logstash/filters/public_ip.rb
|
55
52
|
- logstash-filter-public_ip.gemspec
|
56
53
|
- spec/filters/public_ip_spec.rb
|
data/CONTRIBUTORS
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
The following is a list of people who have contributed ideas, code, bug
|
2
|
-
reports, or in general have helped logstash along its way.
|
3
|
-
|
4
|
-
Contributors:
|
5
|
-
* -
|
6
|
-
|
7
|
-
Note: If you've sent us patches, bug reports, or otherwise contributed to
|
8
|
-
Logstash, and you aren't on the list above and want to be, please let us know
|
9
|
-
and we'll make sure you're here. Contributions from folks like you are what make
|
10
|
-
open source awesome.
|
data/DEVELOPER.md
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'ipaddr'
|
3
|
-
|
4
|
-
# NON-PUBLIC REASONS
|
5
|
-
# ---------------
|
6
|
-
# 0.0.0.0/8 = RFC1700: reserved as a source address only
|
7
|
-
# 10.0.0.0/8 = RFC1918: reserved for private networking
|
8
|
-
# 100.64.0.0/10 = RFC6598: reserved for service provider shared address space but may be used in a manner similiar to RF1918
|
9
|
-
# 127.0.0.0/8 = RFC1112: assigned for use as the Internet host loopback address
|
10
|
-
# 169.254.0.0/16 = RFC3927: used for link-local addressing in Internet Protocol Version 4
|
11
|
-
# 172.16.0.0/12 = RFC1918: reserved for private networking
|
12
|
-
# 192.0.0.0/24 = RFC6890: IETF Protocol Assignments
|
13
|
-
# 192.0.0.8/32 = RFC7600: IPv4 dummy address
|
14
|
-
# 192.0.2.0/24 = RFC5737: Assigned as TEST-NET-1, documentation and examples
|
15
|
-
# 192.31.196.0/24 = RFC7535: AS112-v4
|
16
|
-
# 192.52.193.0/24 = RFC7450: AMT
|
17
|
-
# 192.88.99.0/24 = RFC7526: Reserved. Formerly used for IPv6 to IPv4 relay (included IPv6 address block 2002::/16
|
18
|
-
# 192.168.0.0/16 = RFC1918: reserved for private networking
|
19
|
-
# 198.18.0.0/15 = RFC2544: Used for benchmark testing of inter-network communications between two separate subnets
|
20
|
-
# 198.51.100.0/24 = RFC5737: Assigned as TEST-NET-2, documentation and examples
|
21
|
-
# 203.0.113.0/24 = RFC5737: Assigned as TEST-NET-3, documentation and examples
|
22
|
-
# 224.0.0.0/4 = RFC1112: In use for IP multicast (Former Class D network)
|
23
|
-
# 240.0.0.0/4 = RFC6890: Reserved for future use. (Former Class E network)
|
24
|
-
# 255.255.255.255/32 = RFC8190: Reserved for the limited broadcast destination address
|
25
|
-
# fc00::/7 = RFC4193: Unique Local Address
|
26
|
-
# fe80::/10 = RFC4291: Link-Local Address
|
27
|
-
# ff00::/8 = RFC4291: Multicast Address
|
28
|
-
# 2001:db8::/32 = RFC3849: Addresses used in documentation and example source code
|
29
|
-
# 2001:20::/28 = RFC7343: Prefix for Overlay Routable Cryptographic Hash Identifiers Version 2
|
30
|
-
# ::1/128 = RFC8190: Loopback address to local host
|
31
|
-
# ::/128 = RFC8190: Unspecified address
|
32
|
-
# 100::/64 = RFC6666: Discard Prefix
|
33
|
-
# 64:ff9b::/96 = RFC6052: IPv4/IPv6 translation
|
34
|
-
|
35
|
-
class Ipvlookup
|
36
|
-
def initialize(ipaddress)
|
37
|
-
@ipaddress = ipaddress
|
38
|
-
@cidr = [
|
39
|
-
"0.0.0.0/8",
|
40
|
-
"10.0.0.0/8",
|
41
|
-
"100.64.0.0/10",
|
42
|
-
"127.0.0.0/8",
|
43
|
-
"169.254.0.0/16",
|
44
|
-
"172.16.0.0/12",
|
45
|
-
"192.0.0.0/24",
|
46
|
-
"192.0.0.8/32",
|
47
|
-
"192.0.2.0/24",
|
48
|
-
"192.31.196.0/24",
|
49
|
-
"192.52.193.0/24",
|
50
|
-
"192.88.99.0/24",
|
51
|
-
"192.168.0.0/16",
|
52
|
-
"198.18.0.0/15",
|
53
|
-
"198.51.100.0/24",
|
54
|
-
"203.0.113.0/24",
|
55
|
-
"224.0.0.0/4",
|
56
|
-
"240.0.0.0/4",
|
57
|
-
"255.255.255.255/32",
|
58
|
-
"fc00::/7",
|
59
|
-
"fe80::/10",
|
60
|
-
"ff00::/8",
|
61
|
-
"2001:db8::/32",
|
62
|
-
"2001:20::/28",
|
63
|
-
"::1/128",
|
64
|
-
"::/128",
|
65
|
-
"100::/64",
|
66
|
-
"64:ff9b::/96"
|
67
|
-
]
|
68
|
-
end
|
69
|
-
def validip
|
70
|
-
begin
|
71
|
-
@src = IPAddr.new("#{@ipaddress}")
|
72
|
-
if @src.ipv4?
|
73
|
-
@valid = true
|
74
|
-
@ipv = '4'
|
75
|
-
elsif @src.ipv6?
|
76
|
-
@valid = true
|
77
|
-
@ipv = '6'
|
78
|
-
else
|
79
|
-
@valid = false
|
80
|
-
end
|
81
|
-
rescue
|
82
|
-
@valid = false
|
83
|
-
end
|
84
|
-
return @valid
|
85
|
-
end
|
86
|
-
def ipversion
|
87
|
-
if @valid == true
|
88
|
-
return "#{@ipv}"
|
89
|
-
end
|
90
|
-
end
|
91
|
-
def pubip
|
92
|
-
if @valid == true
|
93
|
-
prvip = @cidr.collect{|p|
|
94
|
-
cnet = IPAddr.new(p)
|
95
|
-
cnet.include?(@src)
|
96
|
-
}
|
97
|
-
if prvip.include? true
|
98
|
-
public_ip = false
|
99
|
-
else
|
100
|
-
public_ip = true
|
101
|
-
end
|
102
|
-
return public_ip
|
103
|
-
|
104
|
-
#public_ip = true
|
105
|
-
#for p in @cidr do
|
106
|
-
# cidr = IPAddr.new(p)
|
107
|
-
# if cidr.include?(@src) == true
|
108
|
-
# public_ip = false
|
109
|
-
# end
|
110
|
-
#end
|
111
|
-
#return public_ip
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|