jake-scripts 1.8.9 → 1.9.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9dd689466787d2e448380ac7af09da69003fff09
4
- data.tar.gz: 15b857609be81d4d9835c261b14e650d9f8e83c1
3
+ metadata.gz: 1dd39241dddfb88825ac80ca4854d56b0c47e87f
4
+ data.tar.gz: eea2004b30be1a7e5ffac7f127cb4ba1446aa082
5
5
  SHA512:
6
- metadata.gz: 2ecdc3038020f12ad2797338f613856a513352fe08babfe5947007c388cbc95fe4375a1d99a2483c78d99ff16541350c9d6718e525c7444d3a86b5fb148ffe0a
7
- data.tar.gz: d44aaf275452cf423515f30d2cdd429d0a081bc8883ff535cb2befc6104fe747f3940d155ba16a094cdc32cef79732e63552342e41f6731c7ec7c2beb6c5919c
6
+ metadata.gz: d63ced4001eb749df36a826d8dff46b638693c84632af15460e3b94233c079b18290555a1e75f9a854f254408522052bbaa597d2e07e84da58a13cf626a8eac1
7
+ data.tar.gz: d997f2707e8714ebc20e1200694fb95d30c082710631103a5528c4675c021898e2946ec6ecfcd822315ee84ba22c4c32336b4eb89c36443ed0f5bfabed530d2c
data/.gitignore CHANGED
@@ -10,3 +10,31 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+
14
+ # General
15
+ *.DS_Store
16
+ .AppleDouble
17
+ .LSOverride
18
+
19
+ # Icon must end with two \r
20
+ Icon
21
+
22
+
23
+ # Thumbnails
24
+ ._*
25
+
26
+ # Files that might appear in the root of a volume
27
+ .DocumentRevisions-V100
28
+ .fseventsd
29
+ .Spotlight-V100
30
+ .TemporaryItems
31
+ .Trashes
32
+ .VolumeIcon.icns
33
+ .com.apple.timemachine.donotpresent
34
+
35
+ # Directories potentially created on remote AFP share
36
+ .AppleDB
37
+ .AppleDesktop
38
+ Network Trash Folder
39
+ Temporary Items
40
+ .apdisk
@@ -1,5 +1,5 @@
1
1
  module Jake
2
2
  module Scripts
3
- VERSION = "1.8.9"
3
+ VERSION = "1.9.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jake-scripts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.9
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Meyer
@@ -175,7 +175,6 @@ executables:
175
175
  - ip-list
176
176
  - ip-location
177
177
  - movie
178
- - netgeo
179
178
  - stock
180
179
  - weather
181
180
  extensions: []
@@ -196,7 +195,6 @@ files:
196
195
  - exe/ip-list
197
196
  - exe/ip-location
198
197
  - exe/movie
199
- - exe/netgeo
200
198
  - exe/stock
201
199
  - exe/weather
202
200
  - jake-scripts.gemspec
data/exe/netgeo DELETED
@@ -1,118 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- #
4
- # Simple CLI app for basic network information
5
- # with options for nice output or simple stdout
6
- # to make all your piping dreams come true.
7
- #
8
-
9
-
10
- require 'slop'
11
- require 'rest-client'
12
- require 'json'
13
- require 'os'
14
- require 'socket'
15
-
16
-
17
- # Contains option parsing logic
18
- def netgeo
19
- opts = Slop.parse suppress_errors: true do |o|
20
- o.banner = 'Usage: netgeo [flag]'
21
-
22
- # Gets WAN address
23
- o.on '-w', '--wan', 'Returns WAN IP' do
24
- url = "https://api.ipify.org"
25
- response = RestClient.get(url)
26
- puts response
27
- end
28
-
29
- # Gets LAN(s)
30
- o.on '-l', '--lan', 'Returns LAN IP(s)' do
31
- lans = Socket.ip_address_list.select{|intf| intf.ipv4_private?}.map { |intf| intf.ip_address }
32
- puts lans.join(', ')
33
- end
34
-
35
- # Gets Router IP
36
- o.on '-r', '--router', 'Returns Router IP' do
37
- if OS.linux?
38
- router = %x[ip route | grep default | head -1 | awk '{print$3}']
39
- elsif OS.mac?
40
- router = %x[netstat -rn | grep default | head -1 | awk '{print$2}']
41
- else
42
- puts "OS not supported!"
43
- exit(1)
44
- end
45
- puts router
46
- end
47
-
48
- # Gets DNS nameserver
49
- o.on '-d', '--dns', 'Returns DNS Nameserver' do
50
- if OS.linux?
51
- dns = %x[cat /etc/resolv.conf | grep nameserver | head -1 | awk '{print$2}']
52
- elsif OS.mac?
53
- dns = %x[scutil --dns | grep nameserver | head -1 | awk '{print$3}']
54
- else
55
- puts "OS not supported!"
56
- exit(1)
57
- end
58
- puts dns
59
- end
60
-
61
- o.string '-m', '--mac [interface]', 'Returns MAC address for interface. Ex. eth0'
62
-
63
-
64
- o.on '-g', '--geo', 'Returns Current IP Geodata' do
65
- url = "http://ip-api.com/json/"
66
- response = RestClient.get(url)
67
- info = JSON.parse(response)
68
- puts info['query']
69
- puts info['city']
70
- puts info['region']
71
- puts info['country']
72
- puts info['zip']
73
- puts info['isp']
74
- end
75
- o.separator ''
76
- o.separator 'Custom Geo Output:'
77
- o.separator '[all] [ip] [city] [region] [country] [zip] [isp]'
78
- o.separator 'Example: netgeo -s ip,city,isp 8.8.8.8'
79
- o.array '-s', '[options] [ip address]', 'Specific Geodata'
80
- o.on '-h', '--help', 'version 1.0.2' do
81
- puts o
82
- exit
83
- end
84
- end
85
-
86
-
87
- # Logic for specific geodata
88
- options = opts[:s]
89
- ip = opts.arguments || ''
90
-
91
- url = "http://ip-api.com/json/#{ip.join}"
92
- response = RestClient.get(url)
93
- info = JSON.parse(response)
94
- if options.include? 'all'
95
- puts info['query']
96
- puts info['city']
97
- puts info['region']
98
- puts info['country']
99
- puts info['zip']
100
- puts info['isp']
101
- else
102
- puts info['query'] if options.include? 'ip'
103
- puts info['city'] if options.include? 'city'
104
- puts info['region'] if options.include? 'region'
105
- puts info['country'] if options.include? 'country'
106
- puts info['zip'] if options.include? 'zip'
107
- puts info['isp'] if options.include? 'isp'
108
- end
109
-
110
-
111
- # Logic for specific MAC address
112
- options = opts[:m]
113
- unless options == nil
114
- puts %x[ifconfig #{options} | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}']
115
- end
116
- end
117
-
118
- netgeo