ec2_ip_ranges 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTc3MjY5YTZhNzgwZGU5NjBlY2IxMGE1OWZkMGFmNDYzZjg2Y2RjOQ==
5
+ data.tar.gz: !binary |-
6
+ ZDkwMTVlOTU5YzQxYzcwYTU5N2FkY2Q0NmY0ZDYyZWUxNjY5ZWExYQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YzE2Nzg2OGMwMGUxYWVmNTAwNmZkZThhODFmNDEwOTM5YjdjMjAzNDE5ZmI2
10
+ Njk0ZWMzMTdmZjZjMGIwM2YyOWRhMGI5ZDAyZmFlMDAyOTMzOWY1NTM2Y2Nj
11
+ NTA5OWJhYzQ1ZjNmZDE5MzdmZmFjZTlmNzcwNzBjZGMwMmViYzU=
12
+ data.tar.gz: !binary |-
13
+ YmY0NDhlNWM3ZjE5ZDA0MjA5NzAyMjIzYmFmMzZhOTQ2OWY2YjVjZDMzNTBj
14
+ MWVkZmM2ODE2NGU3MzcyOTVmYzk1NjgxYTUwOGM2OWVhNDQxMzgzMmExMzky
15
+ NDJhMDRlZTJjMzRlZmQ3NThjZTYzNGM1NGRjYzA3NWM3NjI0M2E=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ec2_ip_ranges.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jason Nochlin
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # Ec2IpRanges
2
+
3
+ Check if an IP Address belongs to the Public IP Address Ranges for Amazon EC2
4
+
5
+ ## Installation
6
+
7
+ gem 'ec2_ip_ranges'
8
+
9
+
10
+ ## Usage
11
+
12
+ require 'ec2_ip_ranges'
13
+
14
+ Ec2IpRanges.ec2_ip?('67.202.0.0') # => true
15
+
16
+ ## Data Source
17
+
18
+ The data file in this repository was last updated: Dec 13, 2013 2:52pm
19
+
20
+ Source: https://forums.aws.amazon.com/ann.jspa?annID=1701
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,81 @@
1
+ 72.44.32.0/19
2
+ 67.202.0.0/18
3
+ 75.101.128.0/17
4
+ 174.129.0.0/16
5
+ 204.236.192.0/18
6
+ 184.73.0.0/16
7
+ 184.72.128.0/17
8
+ 184.72.64.0/18
9
+ 50.16.0.0/15
10
+ 50.19.0.0/16
11
+ 107.20.0.0/14
12
+ 23.20.0.0/14
13
+ 54.242.0.0/15
14
+ 54.234.0.0/15
15
+ 54.236.0.0/15
16
+ 54.224.0.0/15
17
+ 54.226.0.0/15
18
+ 54.208.0.0/15
19
+ 54.210.0.0/15
20
+ 54.221.0.0/16
21
+ 54.204.0.0/15
22
+ 54.196.0.0/15
23
+ 54.198.0.0/16
24
+ 54.80.0.0/13
25
+ 50.112.0.0/16
26
+ 54.245.0.0/16
27
+ 54.244.0.0/16
28
+ 54.214.0.0/16
29
+ 54.212.0.0/15
30
+ 54.218.0.0/16
31
+ 54.200.0.0/15
32
+ 54.202.0.0/15
33
+ 54.184.0.0/13
34
+ 204.236.128.0/18
35
+ 184.72.0.0/18
36
+ 50.18.0.0/16
37
+ 184.169.128.0/17
38
+ 54.241.0.0/16
39
+ 54.215.0.0/16
40
+ 54.219.0.0/16
41
+ 54.193.0.0/16
42
+ 79.125.0.0/17
43
+ 46.51.128.0/18
44
+ 46.51.192.0/20
45
+ 46.137.0.0/17
46
+ 46.137.128.0/18
47
+ 176.34.128.0/17
48
+ 176.34.64.0/18
49
+ 54.247.0.0/16
50
+ 54.246.0.0/16
51
+ 54.228.0.0/16
52
+ 54.216.0.0/15
53
+ 54.229.0.0/16
54
+ 54.220.0.0/16
55
+ 54.194.0.0/15
56
+ 54.72.0.0/14
57
+ 175.41.128.0/18
58
+ 122.248.192.0/18
59
+ 46.137.192.0/18
60
+ 46.51.216.0/21
61
+ 54.251.0.0/16
62
+ 54.254.0.0/16
63
+ 54.255.0.0/16
64
+ 54.252.0.0/16
65
+ 54.253.0.0/16
66
+ 54.206.0.0/16
67
+ 54.79.0.0/16
68
+ 175.41.192.0/18
69
+ 46.51.224.0/19
70
+ 176.32.64.0/19
71
+ 103.4.8.0/21
72
+ 176.34.0.0/18
73
+ 54.248.0.0/15
74
+ 54.250.0.0/16
75
+ 54.238.0.0/16
76
+ 54.199.0.0/16
77
+ 177.71.128.0/17
78
+ 54.232.0.0/16
79
+ 54.233.0.0/18
80
+ 54.207.0.0/16
81
+ 96.127.0.0/18
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ec2_ip_ranges/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ec2_ip_ranges"
8
+ spec.version = Ec2IpRanges::VERSION
9
+ spec.authors = ["Jason Nochlin"]
10
+ spec.email = ["hundredwatt@gmail.com"]
11
+ spec.summary = %q{Check if an IP Address belongs to the Public IP Address Ranges for Amazon EC2}
12
+ spec.description = %q{Check if an IP Address belongs to the Public IP Address Ranges for Amazon EC2}
13
+ spec.homepage = "https://github.com/hundredwatt/ec2_ip_ranges"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "minitest"
24
+ end
@@ -0,0 +1,3 @@
1
+ module Ec2IpRanges
2
+ VERSION = "1.0.1"
3
+ end
@@ -0,0 +1,16 @@
1
+ require "ec2_ip_ranges/version"
2
+ require "ipaddr"
3
+
4
+ module Ec2IpRanges
5
+ RAW_DATA = File.read(File.expand_path('../../data/amazon_ec2_public_ip_ranges.txt', __FILE__)).split("\n")
6
+
7
+ def self.ec2_ip?(ip_address_string)
8
+ test_ip = IPAddr.new(ip_address_string)
9
+
10
+ address_ranges.select{ |range| range === test_ip }.any?
11
+ end
12
+
13
+ def self.address_ranges
14
+ @@address_ranges ||= RAW_DATA.map { |i| IPAddr.new(i) }
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ class TestEc2IpRanges < Minitest::Test
4
+ def test_ip_address_not_in_ec2
5
+ assert_equal Ec2IpRanges.ec2_ip?('127.0.0.1'), false
6
+ end
7
+
8
+ def test_ip_address_in_ec2
9
+ assert_equal Ec2IpRanges.ec2_ip?('67.202.0.0'), true
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ $:.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ require 'ec2_ip_ranges'
4
+ require 'minitest/autorun'
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ec2_ip_ranges
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jason Nochlin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Check if an IP Address belongs to the Public IP Address Ranges for Amazon
56
+ EC2
57
+ email:
58
+ - hundredwatt@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - data/amazon_ec2_public_ip_ranges.txt
69
+ - ec2_ip_ranges.gemspec
70
+ - lib/ec2_ip_ranges.rb
71
+ - lib/ec2_ip_ranges/version.rb
72
+ - test/ec2_ip_ranges_test.rb
73
+ - test/test_helper.rb
74
+ homepage: https://github.com/hundredwatt/ec2_ip_ranges
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.2.1
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Check if an IP Address belongs to the Public IP Address Ranges for Amazon
98
+ EC2
99
+ test_files:
100
+ - test/ec2_ip_ranges_test.rb
101
+ - test/test_helper.rb
102
+ has_rdoc: