Created
July 1, 2014 15:16
-
-
Save jeffmcfadden/aa4399576b7e7f765ec2 to your computer and use it in GitHub Desktop.
DNS Made Easy Dyanmic DNS Update Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'open-uri' | |
require "net/http" | |
require "uri" | |
# Change this | |
username = "fancypants" | |
# Set these up | |
sites = [ | |
{ name: "secretlair", | |
pass: "sissywiggins", | |
id: "12345678" }, | |
{ name: "bunker", | |
pass: "splatterface", | |
id: "87654321" } | |
] | |
current_ip_address = open( 'http://icanhazip.com' ).read.strip! | |
sites.each do |site| | |
puts "Updating #{site[:name]}" | |
uri = URI.parse( "https://cp.dnsmadeeasy.com/servlet/updateip" ) | |
post_params = {"username" => "#{username}", "password" => "#{site[:pass]}", "id" => "#{site[:id]}", "ip" => "#{current_ip_address}" } | |
puts post_params | |
response = Net::HTTP.post_form(uri, post_params ) | |
puts response.body | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment