apigeoloc 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2f875c86ce7b65f5536870d43dbcb12b7c007888
4
+ data.tar.gz: ff417a014a78f4778aeef0141cb5d69e4faa8ca9
5
+ SHA512:
6
+ metadata.gz: fec6f0bdc08cc99162ec07d1084a44d60e40d1e962de3e6e037dda81b7d306178892d5e89994323d9a4eb1d8d436f0c7bf74a6af8de305d602ca69d200e145d7
7
+ data.tar.gz: b48a68b1c4a01e6e8799cd3ccdc36a4c7e9bc9e856e888a9ce1ef618a7648ebef1fe8c4990213947c12b645b9fd1cb218e0fd094159e010726123840a8c8be54
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ apigeoloc*.gem
2
+ test-*
3
+ Gemfile.lock
4
+ coverage
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,66 @@
1
+ image: yueyehua/debian-ruby
2
+
3
+ rubocop:
4
+ tags:
5
+ - docker
6
+ image: yueyehua/debian-ruby
7
+ stage: test
8
+ script:
9
+ - rubocop
10
+
11
+ lines_length:
12
+ stage: test
13
+ script:
14
+ - >
15
+ bash <(curl -s
16
+ https://gitlab.com/yue-script/checks/raw/master/check_lines_length.sh)
17
+ 80 README.md spec/files/*
18
+
19
+ git_history:
20
+ stage: test
21
+ script:
22
+ - >
23
+ bash <(curl -s
24
+ https://gitlab.com/yue-script/checks/raw/master/check_git_history.sh)
25
+
26
+ before_script:
27
+ - bundle install
28
+
29
+ rspec:
30
+ tags:
31
+ - docker
32
+ stage: test
33
+ script:
34
+ - rspec
35
+ artifacts:
36
+ paths:
37
+ - coverage/
38
+
39
+ pages:
40
+ tags:
41
+ - docker
42
+ stage: deploy
43
+ dependencies:
44
+ - rspec
45
+ script:
46
+ - mv coverage/ public/
47
+ artifacts:
48
+ paths:
49
+ - public
50
+ expire_in: 30 days
51
+ only:
52
+ - develop
53
+
54
+ gem_push:
55
+ tags:
56
+ - docker
57
+ stage: deploy
58
+ script:
59
+ - >
60
+ echo -e "---\n:rubygems_api_key: ${RUBYGEM_API_KEY}" > ~/.gem/credentials
61
+ - chmod 0600 ~/.gem/credentials
62
+ - gem build apigeoloc.gemspec
63
+ - gem push apigeoloc-*.gem
64
+ only:
65
+ - master
66
+ when: manual
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/CHANGELOG ADDED
@@ -0,0 +1,7 @@
1
+ Changelog
2
+ =========
3
+
4
+ 1.0.0
5
+ -----
6
+
7
+ - Initial version
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,38 @@
1
+ Contributing
2
+ ------------
3
+
4
+ You are more than welcome to submit issues and merge requests to this project.
5
+
6
+ ### Tests
7
+
8
+ Your commits must not break any tests.
9
+
10
+ ### Commits format
11
+
12
+ Your commits must pass `git log --check` and messages should be formated
13
+ like this (based on this excellent
14
+ [post](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)):
15
+
16
+ ```
17
+ Summarize change in 50 characters or less
18
+
19
+ Provide more detail after the first line. Leave one blank line below the
20
+ summary and wrap all lines at 72 characters or less.
21
+
22
+ If the change fixes an issue, leave another blank line after the final
23
+ paragraph and indicate which issue is fixed in the specific format
24
+ below.
25
+
26
+ Fix #42
27
+ ```
28
+
29
+ Also do your best to factor commits appropriately, ie not too large with
30
+ unrelated things in the same commit, and not too small with the same small
31
+ change applied N times in N different commits. If there was some accidental
32
+ reformatting or whitespace changes during the course of your commits, please
33
+ rebase them away before submitting the MR.
34
+
35
+ ### Files
36
+
37
+ All files must be 80 columns width formatted (actually 79), exception only
38
+ when it is really not possible.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/License ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # APIGeoloc
2
+ ![License][license-img]
3
+ [![build status](https://gitlab.com/vp-noc/apigeoloc/badges/develop/build.svg)](https://gitlab.com/vp-noc/apigeoloc/commits/develop)
4
+ [![coverage report](https://gitlab.com/vp-noc/apigeoloc/badges/develop/coverage.svg)](https://vp-noc.gitlab.io/apigeoloc/)
5
+ [![Gem Version](https://badge.fury.io/rb/apigeoloc.svg)](https://badge.fury.io/rb/apigeoloc)
6
+
7
+ 1. [Overview](#overview)
8
+ 2. [Description](#role-description)
9
+ 3. [Setup](#setup)
10
+ 4. [Usage](#usage)
11
+ 5. [Limitations](#limitations)
12
+ 6. [Development](#development)
13
+ 7. [Miscellaneous](#miscellaneous)
14
+
15
+ ## Overview
16
+
17
+ `APIGeoloc` is a simple tool to match a subnet with a location.
18
+
19
+ ## Description
20
+
21
+ This tool request the reference tool containing the datas to match an ip with a
22
+ location.
23
+
24
+ ## Setup
25
+
26
+ $ gem install apigeoloc
27
+
28
+ ## Usage
29
+
30
+ An interactive help is available with:
31
+
32
+ $ apigeoloc help
33
+
34
+ ## Examples
35
+
36
+ To match a subnet with a location:
37
+
38
+ $ apigeoloc match "<API_URL>" "<CIDR_SUBNET>" -u "<USER>" -p "<PASSWORD>"
39
+
40
+ ## Limitations
41
+
42
+ It is currently only available to request phpipam.
43
+
44
+ ## Development
45
+
46
+ Please read carefully [CONTRIBUTING.md](CONTRIBUTING.md) before making a merge
47
+ request.
48
+
49
+ ```
50
+ ╚⊙ ⊙╝
51
+ ╚═(███)═╝
52
+ ╚═(███)═╝
53
+ ╚═(███)═╝
54
+ ╚═(███)═╝
55
+ ╚═(███)═╝
56
+ ╚═(███)═╝
57
+ ```
58
+
59
+ [license-img]: https://img.shields.io/badge/license-Apache-blue.svg
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ #
2
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'bundler/gem_tasks'
18
+ require 'rspec/core/rake_task'
19
+
20
+ RSpec::Core::RakeTask.new(:spec) { |task| task.verbose = false }
21
+
22
+ task default: :spec
data/apigeoloc.gemspec ADDED
@@ -0,0 +1,62 @@
1
+ #
2
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ lib = File.expand_path('../lib', __FILE__)
18
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
19
+ require 'apigeoloc/version'
20
+
21
+ dev_deps = {
22
+ 'bundler' => '~> 1.12',
23
+ 'rspec' => '~> 3.5',
24
+ 'rake' => '~> 11.2',
25
+ 'rubocop' => '~> 0.41',
26
+ 'webmock' => '~> 2.0.2',
27
+ 'simplecov' => '~> 0.12'
28
+ }
29
+
30
+ deps = {
31
+ 'json-schema' => '~> 1.2',
32
+ 'thor' => '~> 0.19'
33
+ }
34
+
35
+ Gem::Specification.new do |s|
36
+ s.name = 'apigeoloc'
37
+ s.version = APIGeoloc::VERSION
38
+ s.authors = ['Richard Delaplace']
39
+ s.email = 'rdelaplace@vente-privee.com'
40
+ s.license = 'Apache-2.0'
41
+
42
+ s.summary = 'Tool to request and check an API.'
43
+ s.description = 'APIGeoloc is a simple tool to get location from a subnet.'
44
+ s.homepage = 'https://git.vpgrp.io/noc/apigeoloc'
45
+
46
+ s.files = `git ls-files`.lines.map(&:chomp)
47
+ s.bindir = 'bin'
48
+ s.executables = `git ls-files bin/*`.lines.map do |exe|
49
+ File.basename(exe.chomp)
50
+ end
51
+ s.require_paths = ['lib']
52
+
53
+ s.required_ruby_version = '>= 1.9.3'
54
+
55
+ dev_deps.each_pair do |deps_gem, deps_version|
56
+ s.add_development_dependency deps_gem, deps_version
57
+ end
58
+
59
+ deps.each_pair do |deps_gem, deps_version|
60
+ s.add_dependency deps_gem, deps_version
61
+ end
62
+ end
data/bin/apigeoloc ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/ruby
2
+ #
3
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ Signal.trap('INT') { exit 1 }
19
+
20
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w[.. lib])
21
+ require 'rubygems'
22
+ require 'apigeoloc'
23
+
24
+ APIGeoloc.start
data/lib/apigeoloc.rb ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/ruby
2
+ #
3
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ # APIGeoloc class
19
+ module APIGeoloc
20
+ class << self
21
+ Dir[File.join(File.dirname(__FILE__), '*', '*.rb')].each do |file|
22
+ require file
23
+ end
24
+
25
+ def start(args = ARGV)
26
+ APIGeoloc::CLI.start(args)
27
+ rescue => e
28
+ $stderr.puts e
29
+ exit(1)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/ruby
2
+ #
3
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'thor'
19
+
20
+ module APIGeoloc
21
+ # Simple CLI for apigeoloc
22
+ class CLI < Thor
23
+ desc 'version', 'Print apigeoloc current version'
24
+ def version
25
+ puts "APIGeoloc version #{APIGeoloc::VERSION}"
26
+ end
27
+
28
+ desc('match URL SUBNET [options]',
29
+ 'Send a request to get the full datas.' \
30
+ ' URL: base url for the requested api.' \
31
+ ' SUBNET: subnet to match as cidr subnet format.')
32
+ option(
33
+ :header,
34
+ aliases: ['-h'],
35
+ desc: 'Http headers used with the request (comma separated). ' \
36
+ '<key>:<value>[,<key>:<value>[,...]]'
37
+ )
38
+ option(
39
+ :data,
40
+ aliases: ['-d'],
41
+ desc: 'Set of data sent with the request. ' \
42
+ 'May be of type www_form or json.' \
43
+ 'If no specific data type is detected, www_form is used.'
44
+ )
45
+ option(
46
+ :user,
47
+ aliases: ['-u'],
48
+ desc: 'User name in order to login. See also password option.'
49
+ )
50
+ option(
51
+ :password,
52
+ aliases: ['-p'],
53
+ desc: 'User password in order to login. See also user option.'
54
+ )
55
+ option(
56
+ :source,
57
+ aliases: ['-S'],
58
+ default: 'phpipam',
59
+ enum: ['phpipam'],
60
+ desc: 'Select the matcher api source.'
61
+ )
62
+ option(
63
+ :insecure,
64
+ aliases: ['-k'],
65
+ type: :boolean,
66
+ default: false,
67
+ desc: 'No Check certificates.'
68
+ )
69
+ option(
70
+ :quiet,
71
+ aliases: ['-q'],
72
+ type: :boolean,
73
+ default: false,
74
+ desc: 'Silently do the job'
75
+ )
76
+ option(
77
+ :simulation,
78
+ aliases: ['-s'],
79
+ type: :boolean,
80
+ default: false,
81
+ desc: 'Simulation mode. Do nothing'
82
+ )
83
+ def match(url, cidr)
84
+ opts = options.dup
85
+ matcher = APIGeoloc::Matcher.new.send(opts['source'], url, cidr, opts) \
86
+ unless opts['simulation']
87
+ matcher.match unless opts['simulation']
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/ruby
2
+ #
3
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'json'
19
+
20
+ module APIGeoloc
21
+ # This is a matcher class used to match ip with geoloc.
22
+ class Matcher
23
+ # APIGeoloc::Phpipam wrapper
24
+ def phpipam(apiurl, subnet, opts)
25
+ APIGeoloc::Phpipam.new(apiurl, subnet, opts)
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/ruby
2
+ #
3
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'json'
19
+
20
+ module APIGeoloc
21
+ # This is a PHPIPAM requester class.
22
+ class Phpipam
23
+ # Class constructor method
24
+ def initialize(apiurl, subnet, opts)
25
+ cidr_regex = '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}' \
26
+ '([0-9]|[1-9][0-9]|1[0-9]\{2\}|2[0-4][0-9]|25[0-5])' \
27
+ '(\/([0-9]|[1-2][0-9]|3[0-2]))$'
28
+ raise 'Invalid cidr subnet format' \
29
+ unless subnet.match(Regexp.new(cidr_regex))
30
+ @apiurl = apiurl.sub(%r{/^(.*)\/$/}, '\1')
31
+ @subnet = subnet
32
+ @opts = opts
33
+ @opts['header'] = "TOKEN:#{receive_user_token}"
34
+ end
35
+
36
+ # Set the user token.
37
+ def receive_user_token
38
+ res = APIGeoloc::Requester.new('POST', "#{@apiurl}/user/", @opts).request
39
+ body = JSON.parse(res.body)
40
+ raise 'Invalid username or password' unless body['code'] == 200
41
+ body['data']['token']
42
+ end
43
+
44
+ # Get Subnet location id.
45
+ def subnet_loc_id
46
+ sn_req_path = "#{@apiurl}/subnets/cidr/#{@subnet}"
47
+ sn_res = APIGeoloc::Requester.new('GET', sn_req_path, @opts).request
48
+ sn_body = JSON.parse(sn_res.body)
49
+ check_subnet_data(sn_body['data'])
50
+ sn_body['data'][0]['location']
51
+ end
52
+
53
+ # Raise error if the data or location id doesn't exist.
54
+ def check_subnet_data(data)
55
+ raise 'Subnet not found' if data.nil?
56
+ raise 'Location unknown' if data[0]['location'].nil?
57
+ end
58
+
59
+ # Get the location data.
60
+ def location_data(id)
61
+ loc_req_path = "#{@apiurl}/tools/locations/#{id}/"
62
+ loc_res = APIGeoloc::Requester.new('GET', loc_req_path, @opts).request
63
+ loc_body = JSON.parse(loc_res.body)
64
+ raise 'Location not found' if loc_body['data'].nil?
65
+ format_location(loc_body['data'])
66
+ end
67
+
68
+ # Transform json to a human readable string.
69
+ def format_location(data)
70
+ name = data['name']
71
+ address = data['address']
72
+ lat = data['lat']
73
+ long = data['long']
74
+ "#{name}, #{address}, [#{lat}, #{long}]"
75
+ end
76
+
77
+ # Match the subnet with a location if possible.
78
+ def match
79
+ location = location_data(subnet_loc_id)
80
+ puts location
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/ruby
2
+ #
3
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'net/http'
19
+ require 'cgi'
20
+ require 'json'
21
+ require 'openssl'
22
+
23
+ module APIGeoloc
24
+ # This is a Net HTTP requester class.
25
+ class Requester
26
+ # Class constructor method
27
+ def initialize(method, url, opts)
28
+ @method = method
29
+ @uri = URI.parse(url)
30
+ @opts = opts
31
+ @http = Net::HTTP.new(@uri.host, @uri.port)
32
+ @http.use_ssl = @uri.scheme.eql?('https')
33
+ @http.verify_mode = OpenSSL::SSL::VERIFY_NONE unless @opts['insecure']
34
+ end
35
+
36
+ # Set the authentication data
37
+ def basic_auth(request)
38
+ unless @opts['user'].nil? || @opts['password'].nil?
39
+ request.basic_auth(@opts['user'], @opts['password'])
40
+ end
41
+ request
42
+ end
43
+
44
+ # Set the headers given as argument
45
+ def format_header(request)
46
+ unless @opts['header'].nil?
47
+ @opts['header'].split(',').each do |h|
48
+ (key, value) = h.split(':')
49
+ request[key] = value
50
+ end
51
+ end
52
+ request
53
+ end
54
+
55
+ # Select request method
56
+ def request
57
+ case @method.upcase
58
+ when 'GET' then rest_request_get
59
+ when 'POST' then rest_request_post
60
+ end
61
+ end
62
+
63
+ # GET method
64
+ def rest_request_get
65
+ req = Net::HTTP::Get.new(@uri.request_uri)
66
+ req = format_header(req)
67
+ @http.request(req)
68
+ end
69
+
70
+ # POST method
71
+ def rest_request_post
72
+ req = Net::HTTP::Post.new(@uri.request_uri)
73
+ req = format_header(req)
74
+ req = basic_auth(req)
75
+ @http.request(req)
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/ruby
2
+ #
3
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ module APIGeoloc
19
+ VERSION = '1.0.0'.freeze
20
+ end
@@ -0,0 +1,39 @@
1
+ #
2
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'spec_helper'
18
+
19
+ describe APIGeoloc::CLI do
20
+ context 'version' do
21
+ it 'prints the version.' do
22
+ out = "APIGeoloc version #{APIGeoloc::VERSION}\n"
23
+ expect { start(self) }.to output(out).to_stdout
24
+ end
25
+ end
26
+
27
+ context 'match http://api.yueyehua.net/ 127.0.0.0/8 -s' do
28
+ it 'Runs the simulation mode and do nothing.' do
29
+ expect { start(self) }.to output('').to_stdout
30
+ end
31
+ end
32
+
33
+ context 'notexistingcmd' do
34
+ it 'is an unknown command and does nothing.' do
35
+ out = "Could not find command \"notexistingcmd\".\n"
36
+ expect { start(self) }.to output(out).to_stderr
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,62 @@
1
+ #
2
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'spec_helper'
18
+
19
+ describe APIGeoloc::Phpipam do # rubocop:disable Metrics/BlockLength
20
+ opts_wsource = '-S notexistingsource'
21
+ opts_auth = '-u user -p passwd'
22
+ opts_wauth = '-u wrong -p passwd'
23
+
24
+ out1 = "Expected '--source' to be one of phpipam; got notexistingsource\n"
25
+ context "match http://api.yueyehua.net 127.0.0.0/8 #{opts_wsource}" do
26
+ it 'tries unimplemented source.' do
27
+ expect { start(self) }.to output(out1).to_stderr
28
+ end
29
+ end
30
+
31
+ context 'match http://api.yueyehua.net 127.0.0.0.24' do
32
+ it 'tries an invalid cidr subnet.' do
33
+ expect { start(self) }.to raise_error(SystemExit)
34
+ end
35
+ end
36
+
37
+ out3 = 'Tour Eiffel, 5 Avenue Anatole France, 75007 Paris, ' \
38
+ "[48.858193, 2.294446]\n"
39
+ context "match http://api.yueyehua.net 127.0.0.0/24 #{opts_auth}" do
40
+ it 'tries a user and a password to get a token.' do
41
+ expect { start(self) }.to output(out3).to_stdout
42
+ end
43
+ end
44
+
45
+ context "match http://api.yueyehua.net 127.0.0.0/24 #{opts_wauth}" do
46
+ it 'tries a wrong user and a password.' do
47
+ expect { start(self) }.to raise_error(SystemExit)
48
+ end
49
+ end
50
+
51
+ context "match http://api.yueyehua.net 128.0.0.0/24 #{opts_auth}" do
52
+ it 'tries an unknown subnet.' do
53
+ expect { start(self) }.to raise_error(SystemExit)
54
+ end
55
+ end
56
+
57
+ context "match http://api.yueyehua.net 129.0.0.0/24 #{opts_auth}" do
58
+ it 'tries a subnet without location.' do
59
+ expect { start(self) }.to raise_error(SystemExit)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,58 @@
1
+ #
2
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'spec_helper'
18
+
19
+ def readf(file)
20
+ dir = File.dirname(__FILE__)
21
+ File.read(File.join(dir, '..', '..', 'files', file))
22
+ end
23
+
24
+ RSpec.configure do |config|
25
+ config.before(:each) do
26
+ # basic requests an API
27
+ stub_request(:post, 'http://api.yueyehua.net/')
28
+ .to_return('status' => 200, 'body' => '{}', 'headers' => {})
29
+ # request token with good credentials
30
+ stub_request(:post, 'http://api.yueyehua.net/user/')
31
+ .with(basic_auth: %w[user passwd])
32
+ .to_return('status' => 200, 'body' => readf('gooduser'), 'headers' => {})
33
+ # request token with wrong credentials
34
+ stub_request(:post, 'http://api.yueyehua.net/user/')
35
+ .with(basic_auth: %w[wrong passwd])
36
+ .to_return('status' => 200, 'body' => readf('wuser'), 'headers' => {})
37
+ # request a cidr
38
+ stub_request(:get, 'http://api.yueyehua.net/subnets/cidr/127.0.0.0/24')
39
+ .with('headers' => { 'Token' => 'THIS_IS_A_FAKE_TOKEN' })
40
+ .to_return('status' => 200, 'body' => readf('cidr_127'), 'headers' => {})
41
+ # request an unknown cidr
42
+ stub_request(:get, 'http://api.yueyehua.net/subnets/cidr/128.0.0.0/24')
43
+ .with('headers' => { 'Token' => 'THIS_IS_A_FAKE_TOKEN' })
44
+ .to_return('status' => 200, 'body' => readf('cidr_128'), 'headers' => {})
45
+ # request a cidr with unknown location
46
+ stub_request(:get, 'http://api.yueyehua.net/subnets/cidr/129.0.0.0/24')
47
+ .with('headers' => { 'Token' => 'THIS_IS_A_FAKE_TOKEN' })
48
+ .to_return('status' => 200, 'body' => readf('cidr_129'), 'headers' => {})
49
+ # request a location
50
+ stub_request(:get, 'http://api.yueyehua.net/tools/locations/7/')
51
+ .with('headers' => { 'Token' => 'THIS_IS_A_FAKE_TOKEN' })
52
+ .to_return('status' => 200, 'body' => readf('loc_7'), 'headers' => {})
53
+ # request an unknown location
54
+ stub_request(:get, 'http://api.yueyehua.net/tools/locations/8/')
55
+ .with('headers' => { 'Token' => 'THIS_IS_A_FAKE_TOKEN' })
56
+ .to_return('status' => 200, 'body' => readf('loc_8'), 'headers' => {})
57
+ end
58
+ end
@@ -0,0 +1,23 @@
1
+ #
2
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'spec_helper'
18
+
19
+ describe APIGeoloc do
20
+ it 'has a version number' do
21
+ expect(APIGeoloc::VERSION).not_to be nil
22
+ end
23
+ end
@@ -0,0 +1 @@
1
+ {"code":200,"success":true,"data":[{"id":"666","subnet":"127.0.0.0","mask":"24","sectionId":"9","description":"Test network","firewallAddressObject":null,"vrfId":"0","masterSubnetId":"3","allowRequests":"0","vlanId":"0","showName":"0","device":"0","permissions":"{\"2\":\"3\",\"3\":\"1\"}","pingSubnet":"1","discoverSubnet":"1","DNSrecursive":"0","DNSrecords":"1","nameserverId":"0","scanAgent":"4","isFolder":"0","isFull":null,"tag":"2","editDate":"0000-00-00 00:00:00","threshold":"0","linked_subnet":null,"location":"7","lastScan":"0000-00-00 00:00:00","lastDiscovery":null}],"time":0.001}
@@ -0,0 +1 @@
1
+ {"code":200,"success":0,"message":"No subnets found","time":0.001}
@@ -0,0 +1 @@
1
+ {"code":200,"success":true,"data":[{"id":"666","subnet":"127.0.0.0","mask":"24","sectionId":"9","description":"Test network","firewallAddressObject":null,"vrfId":"0","masterSubnetId":"3","allowRequests":"0","vlanId":"0","showName":"0","device":"0","permissions":"{\"2\":\"3\",\"3\":\"1\"}","pingSubnet":"1","discoverSubnet":"1","DNSrecursive":"0","DNSrecords":"1","nameserverId":"0","scanAgent":"4","isFolder":"0","isFull":null,"tag":"2","editDate":"0000-00-00 00:00:00","threshold":"0","linked_subnet":null,"location":null,"lastScan":"0000-00-00 00:00:00","lastDiscovery":null}],"time":0.001}
@@ -0,0 +1 @@
1
+ {"code":200,"success":true,"data":{"token":"THIS_IS_A_FAKE_TOKEN","expires":"0000-00-00 00:00:00"},"time":0.001}
data/spec/files/loc_7 ADDED
@@ -0,0 +1 @@
1
+ {"code":200,"success":true,"data":{"id":"7","name":"Tour Eiffel","description":null,"lat":"48.858193","long":"2.294446","address":"5 Avenue Anatole France, 75007 Paris"},"time":0.001}
data/spec/files/loc_8 ADDED
@@ -0,0 +1 @@
1
+ {"code":200,"success":0,"message":"No objects found","time":0.001}
data/spec/files/wuser ADDED
@@ -0,0 +1 @@
1
+ {"code":500,"success":0,"message":"Invalid username or password","time":0.001}
@@ -0,0 +1,47 @@
1
+ #
2
+ # Copyright (c) 2017 Richard Delaplace, Vente-Privee.Com
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ require 'simplecov'
17
+ SimpleCov.start
18
+
19
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
20
+ require 'apigeoloc'
21
+ require 'webmock/rspec'
22
+
23
+ # Force expect syntax over should
24
+ RSpec.configure do |config|
25
+ config.expect_with :rspec do |c|
26
+ c.syntax = :expect
27
+ end
28
+ end
29
+
30
+ dir = File.dirname(__FILE__)
31
+ # Load helpers
32
+ Dir[File.join(dir, 'helpers', '*.rb')].each { |file| require file }
33
+
34
+ def now
35
+ Time.new.strftime('%Y-%m-%dT%H:%M:%S%z').insert(-3, ':')
36
+ end
37
+
38
+ # Load stubs
39
+ files = File.join(dir, 'apigeoloc', 'stubs', '*.rb')
40
+ Dir[files].each { |file| require file }
41
+
42
+ # To test the cli
43
+ def start(caller_object, subcommand = nil)
44
+ cmd = caller_object.class.description.split(' ')
45
+ args = [subcommand, *cmd].compact
46
+ APIGeoloc.start(args)
47
+ end
metadata ADDED
@@ -0,0 +1,185 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: apigeoloc
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Richard Delaplace
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-07-20 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.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '11.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '11.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.41'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.41'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 2.0.2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.0.2
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.12'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.12'
97
+ - !ruby/object:Gem::Dependency
98
+ name: json-schema
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.2'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.2'
111
+ - !ruby/object:Gem::Dependency
112
+ name: thor
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.19'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.19'
125
+ description: APIGeoloc is a simple tool to get location from a subnet.
126
+ email: rdelaplace@vente-privee.com
127
+ executables:
128
+ - apigeoloc
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - ".gitlab-ci.yml"
134
+ - ".rspec"
135
+ - CHANGELOG
136
+ - CONTRIBUTING.md
137
+ - Gemfile
138
+ - License
139
+ - README.md
140
+ - Rakefile
141
+ - apigeoloc.gemspec
142
+ - bin/apigeoloc
143
+ - lib/apigeoloc.rb
144
+ - lib/apigeoloc/cli.rb
145
+ - lib/apigeoloc/matcher.rb
146
+ - lib/apigeoloc/phpipam.rb
147
+ - lib/apigeoloc/requester.rb
148
+ - lib/apigeoloc/version.rb
149
+ - spec/apigeoloc/cli_spec.rb
150
+ - spec/apigeoloc/phpipam_spec.rb
151
+ - spec/apigeoloc/stubs/servers_stubs.rb
152
+ - spec/apigeoloc_spec.rb
153
+ - spec/files/cidr_127
154
+ - spec/files/cidr_128
155
+ - spec/files/cidr_129
156
+ - spec/files/gooduser
157
+ - spec/files/loc_7
158
+ - spec/files/loc_8
159
+ - spec/files/wuser
160
+ - spec/spec_helper.rb
161
+ homepage: https://git.vpgrp.io/noc/apigeoloc
162
+ licenses:
163
+ - Apache-2.0
164
+ metadata: {}
165
+ post_install_message:
166
+ rdoc_options: []
167
+ require_paths:
168
+ - lib
169
+ required_ruby_version: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: 1.9.3
174
+ required_rubygems_version: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
179
+ requirements: []
180
+ rubyforge_project:
181
+ rubygems_version: 2.5.2
182
+ signing_key:
183
+ specification_version: 4
184
+ summary: Tool to request and check an API.
185
+ test_files: []