this_ip 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/{services/aws.rb → this_ip/services/aws/ec2.rb} +0 -36
- data/lib/this_ip/services/aws/rds.rb +41 -0
- data/lib/this_ip/version.rb +1 -1
- data/lib/this_ip.rb +4 -3
- data/this_ip.gemspec +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3710bca8e48027ff1c6367f7ebce8d6423cc86c8
|
4
|
+
data.tar.gz: abfa5c98f92789cd29759a50ddfafba6f46c8de4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dee5dfd0dacf8b4ff0a7e62587a16e2a346f3e196075e2f10d68dd29fccf8c2284576e8214700f1bb79fb60c42c8d283f41b91b4d2f1d0dd6da8785b5d0cb6d
|
7
|
+
data.tar.gz: 6abf5e684be6a2ccbdb30783c3eb04d6ae87a05bf831cf260eb8ac56e066edd3076edfa10b39c3d89fc1b202eb8da301e0053567bf1f96fb79576fbfd5edacf4
|
@@ -40,41 +40,5 @@ module ThisIp
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
44
|
-
class RDS
|
45
|
-
def self.defaults
|
46
|
-
{
|
47
|
-
db_security_group_name: 'default',
|
48
|
-
}
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.auth(ip_address, config)
|
52
|
-
puts "AWS::RDS\n"
|
53
|
-
|
54
|
-
begin
|
55
|
-
result = ::AWS::RDS::Client.new.authorize_db_security_group_ingress(
|
56
|
-
::ThisIp::AWS::RDS.defaults.merge(config).merge(cidrip: ::ThisIp::Main.masked_ip_address(ip_address))
|
57
|
-
)
|
58
|
-
puts " Authorized \"#{ip_address}\""
|
59
|
-
rescue Exception => e
|
60
|
-
puts " Failed to authorize \"#{ip_address}\""
|
61
|
-
puts " Reason: \"#{e.message}\""
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.deauth(ip_address, config)
|
66
|
-
puts "AWS::RDS\n"
|
67
|
-
|
68
|
-
begin
|
69
|
-
result = ::AWS::RDS::Client.new.revoke_db_security_group_ingress(
|
70
|
-
::ThisIp::AWS::RDS.defaults.merge(config).merge(cidrip: ::ThisIp::Main.masked_ip_address(ip_address))
|
71
|
-
)
|
72
|
-
puts " Deauthorized \"#{ip_address}\""
|
73
|
-
rescue Exception => e
|
74
|
-
puts " Failed to deauthorize \"#{ip_address}\""
|
75
|
-
puts " Reason: \"#{e.message}\""
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
43
|
end
|
80
44
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'aws-sdk'
|
2
|
+
|
3
|
+
module ThisIp
|
4
|
+
module AWS
|
5
|
+
class RDS
|
6
|
+
def self.defaults
|
7
|
+
{
|
8
|
+
db_security_group_name: 'default',
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.auth(ip_address, config)
|
13
|
+
puts "AWS::RDS\n"
|
14
|
+
|
15
|
+
begin
|
16
|
+
result = ::AWS::RDS::Client.new.authorize_db_security_group_ingress(
|
17
|
+
::ThisIp::AWS::RDS.defaults.merge(config).merge(cidrip: ::ThisIp::Main.masked_ip_address(ip_address))
|
18
|
+
)
|
19
|
+
puts " Authorized \"#{ip_address}\""
|
20
|
+
rescue Exception => e
|
21
|
+
puts " Failed to authorize \"#{ip_address}\""
|
22
|
+
puts " Reason: \"#{e.message}\""
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.deauth(ip_address, config)
|
27
|
+
puts "AWS::RDS\n"
|
28
|
+
|
29
|
+
begin
|
30
|
+
result = ::AWS::RDS::Client.new.revoke_db_security_group_ingress(
|
31
|
+
::ThisIp::AWS::RDS.defaults.merge(config).merge(cidrip: ::ThisIp::Main.masked_ip_address(ip_address))
|
32
|
+
)
|
33
|
+
puts " Deauthorized \"#{ip_address}\""
|
34
|
+
rescue Exception => e
|
35
|
+
puts " Failed to deauthorize \"#{ip_address}\""
|
36
|
+
puts " Reason: \"#{e.message}\""
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/this_ip/version.rb
CHANGED
data/lib/this_ip.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
require 'this_ip/version'
|
2
2
|
require 'faraday'
|
3
|
+
require 'require_all'
|
3
4
|
|
4
|
-
|
5
|
+
require_all 'lib/this_ip/services'
|
5
6
|
|
6
7
|
module ThisIp
|
7
8
|
class Main
|
8
|
-
attr_accessor :action
|
9
|
+
attr_accessor :action, :ip_address
|
9
10
|
|
10
11
|
def initialize(action)
|
11
12
|
@action ||= action
|
12
13
|
end
|
13
14
|
|
14
15
|
def ip_address
|
15
|
-
Faraday.get('http://checkip.amazonaws.com/').body.strip
|
16
|
+
@ip_address ||= Faraday.get('http://checkip.amazonaws.com/').body.strip
|
16
17
|
end
|
17
18
|
|
18
19
|
def self.masked_ip_address(ip_address)
|
data/this_ip.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: this_ip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Caught
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: require_all
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: Auth and deauth your current IP address.
|
70
84
|
email:
|
71
85
|
- rcaught@gmail.com
|
@@ -81,8 +95,9 @@ files:
|
|
81
95
|
- README.md
|
82
96
|
- Rakefile
|
83
97
|
- bin/this_ip
|
84
|
-
- lib/services/aws.rb
|
85
98
|
- lib/this_ip.rb
|
99
|
+
- lib/this_ip/services/aws/ec2.rb
|
100
|
+
- lib/this_ip/services/aws/rds.rb
|
86
101
|
- lib/this_ip/version.rb
|
87
102
|
- this_ip.gemspec
|
88
103
|
homepage: https://github.com/rcaught/this_ip
|