jake-scripts 1.8.1 → 1.8.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/exe/ip_geo +75 -38
- data/lib/jake/scripts/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 358c4f16383475ec478e659cb29b759c181c85bb
|
4
|
+
data.tar.gz: ead93a472d3b01d9524e7d2e9c429cbfd1cc5246
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f50328b784ca2f94df658d6ce80d4b637fe04ca28922d450c590076d58759e9a30d462f764327c62f4c03d2f48ab9da1defc582815ff986cc07d1e551c0ccbd
|
7
|
+
data.tar.gz: 96ae76198ae46d488bdac364cba158e1095da64fcf6838f2e4f5cc4570ce7588a0e52423ef0666996ddbd1f1e1d6a355bd5e969dd8af036baa9af4990f213914
|
data/exe/ip_geo
CHANGED
@@ -3,53 +3,90 @@
|
|
3
3
|
|
4
4
|
require 'rest-client'
|
5
5
|
require 'json'
|
6
|
+
require 'optparse'
|
6
7
|
|
7
|
-
|
8
|
+
|
9
|
+
options = {}
|
10
|
+
OptionParser.new do |opts|
|
11
|
+
opts.banner = "Usage: example.rb [options]"
|
12
|
+
|
13
|
+
opts.on("-m", "--machine VARIABLE", "Machine Readable") do |v|
|
14
|
+
options[:var] = v
|
15
|
+
end
|
16
|
+
end.parse!
|
17
|
+
|
18
|
+
# Ex. ip
|
19
|
+
opt = options[:var]
|
20
|
+
|
21
|
+
# Ex. 8.8.8.8
|
22
|
+
*arg = ARGV
|
23
|
+
|
24
|
+
if opt == nil && arg == nil
|
8
25
|
puts
|
9
26
|
print 'IP => '
|
10
27
|
ip = gets.chomp
|
11
28
|
|
12
|
-
|
13
|
-
|
14
|
-
|
29
|
+
url = "http://ip-api.com/json/#{ip}"
|
30
|
+
response = RestClient.get(url)
|
31
|
+
info = JSON.parse(response)
|
32
|
+
|
33
|
+
if info['status'] == 'fail'
|
34
|
+
puts 'No IP found'
|
15
35
|
else
|
36
|
+
puts
|
37
|
+
puts '============================='
|
38
|
+
puts "| IP: #{info['query']}"
|
39
|
+
puts "| City: #{info['city']}"
|
40
|
+
puts "| Region: #{info['region']}"
|
41
|
+
puts "| Country: #{info['country']}"
|
42
|
+
puts "| ZIP: #{info['zip']}"
|
43
|
+
puts "| ISP: #{info['isp']}"
|
44
|
+
puts '============================='
|
45
|
+
puts
|
46
|
+
end
|
47
|
+
elsif opt == nil && arg != nil
|
48
|
+
url = "http://ip-api.com/json/#{arg.join}"
|
49
|
+
response = RestClient.get(url)
|
50
|
+
info = JSON.parse(response)
|
16
51
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
52
|
+
if info['status'] == 'fail'
|
53
|
+
puts 'No IP found'
|
54
|
+
else
|
55
|
+
puts
|
56
|
+
puts '============================='
|
57
|
+
puts "| IP: #{info['query']}"
|
58
|
+
puts "| City: #{info['city']}"
|
59
|
+
puts "| Region: #{info['region']}"
|
60
|
+
puts "| Country: #{info['country']}"
|
61
|
+
puts "| ZIP: #{info['zip']}"
|
62
|
+
puts "| ISP: #{info['isp']}"
|
63
|
+
puts '============================='
|
64
|
+
puts
|
65
|
+
end
|
66
|
+
elsif opt != nil && arg != nil
|
67
|
+
url = "http://ip-api.com/json/#{arg.join}"
|
68
|
+
response = RestClient.get(url)
|
69
|
+
info = JSON.parse(response)
|
27
70
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
puts
|
37
|
-
|
38
|
-
puts
|
39
|
-
|
71
|
+
if info['status'] == 'fail'
|
72
|
+
puts 'No IP info'
|
73
|
+
else
|
74
|
+
if opt == 'ip'
|
75
|
+
puts info['query']
|
76
|
+
elsif opt == 'city'
|
77
|
+
puts info['city']
|
78
|
+
elsif opt == 'region'
|
79
|
+
puts info['region']
|
80
|
+
elsif opt == 'country'
|
81
|
+
puts info['country']
|
82
|
+
elsif opt == 'zip'
|
83
|
+
puts info['zip']
|
84
|
+
elsif opt == 'isp'
|
85
|
+
puts info['isp']
|
40
86
|
else
|
41
|
-
puts
|
42
|
-
puts '============================='
|
43
|
-
puts "| IP: #{ip}"
|
44
|
-
puts "| City: #{city}"
|
45
|
-
puts "| Region: #{region}"
|
46
|
-
puts "| Country: #{country}"
|
47
|
-
puts "| ZIP: #{zip}"
|
48
|
-
puts "| ISP: #{isp}"
|
49
|
-
puts '============================='
|
50
|
-
puts
|
87
|
+
puts 'Bad input'
|
51
88
|
end
|
52
89
|
end
|
90
|
+
else
|
91
|
+
puts 'Bad input'
|
53
92
|
end
|
54
|
-
|
55
|
-
ip_location
|
data/lib/jake/scripts/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jake-scripts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Meyer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|