suj-noip 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.md +20 -0
- data/bin/noip +68 -0
- data/lib/suj/noip/version.rb +5 -0
- data/lib/suj/noip.rb +1 -0
- metadata +67 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 R&D SkillupJapan Corp.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# NoIp Updater
|
2
|
+
|
3
|
+
This is a simple tool to test No-Ip.com DDNS updates. This is a one-time update tool that can be used to test your credentials and configured domains.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```
|
8
|
+
sudo gem install suj-noip
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
```
|
14
|
+
$ noip -d my-host.no-ip.org -i <ipaddress> -u <username> -p <password>
|
15
|
+
```
|
16
|
+
|
17
|
+
## Resources
|
18
|
+
|
19
|
+
The No-Ip.com protocol is simple and can be found here: [http://www.noip.com/integrate/request]
|
20
|
+
|
data/bin/noip
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require "base64"
|
5
|
+
require "faraday"
|
6
|
+
require 'suj/noip'
|
7
|
+
|
8
|
+
BANNER = "Usage: noip -d <domain> -i <ipaddress> -u <username> -p <password>"
|
9
|
+
WORKDIR = Dir.pwd
|
10
|
+
|
11
|
+
domain = ""
|
12
|
+
ipaddress = ""
|
13
|
+
username = ""
|
14
|
+
password = ""
|
15
|
+
|
16
|
+
ARGV.options do |opts|
|
17
|
+
opts.banner = BANNER
|
18
|
+
opts.on('-d domain', '--domain domain', String, 'Domain to update') { |h| domain = h }
|
19
|
+
opts.on('-i ipaddress', '--ip ipaddress', String, 'IP address to set') { |i| ipaddress = i }
|
20
|
+
opts.on('-u username', '--user username', String, 'Noip.com username') { |u| username = u }
|
21
|
+
opts.on('-p password', '--pass password', String, 'Noip.com password') { |p| password = p }
|
22
|
+
opts.on('-h', '--help', 'You\'re looking at it.') { puts opts; exit }
|
23
|
+
opts.parse!
|
24
|
+
end
|
25
|
+
|
26
|
+
if domain == "" or ipaddress == "" or username == "" or password == ""
|
27
|
+
puts BANNER
|
28
|
+
exit 1
|
29
|
+
end
|
30
|
+
|
31
|
+
puts domain
|
32
|
+
puts ipaddress
|
33
|
+
puts username
|
34
|
+
puts password
|
35
|
+
|
36
|
+
AGENT = "suj-noip/#{Suj::Noip::VERSION} rd@skillupjapan.co.jp"
|
37
|
+
auth = Base64.encode64("#{username}:#{password}").chop
|
38
|
+
|
39
|
+
conn = Faraday.new(url: "https://dynupdate.no-ip.com") do |faraday|
|
40
|
+
faraday.request :url_encoded
|
41
|
+
faraday.response :logger
|
42
|
+
faraday.adapter Faraday.default_adapter
|
43
|
+
end
|
44
|
+
|
45
|
+
response = conn.get do |req|
|
46
|
+
req.url '/nic/update', { hostname: domain, myip: ipaddress }
|
47
|
+
req.headers["Authorization"] = "Basic #{auth}"
|
48
|
+
req.headers["User-Agent"] = AGENT
|
49
|
+
end
|
50
|
+
|
51
|
+
case response.body.to_s
|
52
|
+
when /good (.+)/
|
53
|
+
puts "IP successfully updated to #{$1}"
|
54
|
+
when /nochg (.+)/
|
55
|
+
puts "IP is updated, no change needed"
|
56
|
+
when "nochg"
|
57
|
+
puts "IP is updated, no change needed"
|
58
|
+
when "badauth"
|
59
|
+
puts "Bad credentials, check your username and password"
|
60
|
+
when "badagent"
|
61
|
+
puts "Ensure you set a correct User-Agent"
|
62
|
+
when "abuse"
|
63
|
+
puts "This account has been banned, contact NoIp.com support to get help."
|
64
|
+
when "911"
|
65
|
+
puts "Fatal error occurred. Contact NoIP.com suppoert to get help."
|
66
|
+
else
|
67
|
+
puts "Unknown response #{response.body}"
|
68
|
+
end
|
data/lib/suj/noip.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'suj/noip/version'
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: suj-noip
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Horacio Sanson
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-03-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: faraday
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: Simple tool to test No-Ip.com DDNS updates
|
31
|
+
email:
|
32
|
+
- rd@skillupjapan.co.jp
|
33
|
+
executables:
|
34
|
+
- noip
|
35
|
+
extensions: []
|
36
|
+
extra_rdoc_files: []
|
37
|
+
files:
|
38
|
+
- LICENSE
|
39
|
+
- README.md
|
40
|
+
- lib/suj/noip.rb
|
41
|
+
- lib/suj/noip/version.rb
|
42
|
+
- bin/noip
|
43
|
+
homepage: https://github.com/sujrd/suj-noip
|
44
|
+
licenses: []
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 1.8.23
|
64
|
+
signing_key:
|
65
|
+
specification_version: 3
|
66
|
+
summary: Simple tool to test No-Ip.com DDNS updates
|
67
|
+
test_files: []
|