Skip to content

Instantly share code, notes, and snippets.

@jeffmcfadden
Created July 1, 2014 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffmcfadden/aa4399576b7e7f765ec2 to your computer and use it in GitHub Desktop.
Save jeffmcfadden/aa4399576b7e7f765ec2 to your computer and use it in GitHub Desktop.
DNS Made Easy Dyanmic DNS Update Script
#!/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