nameboy 1.0.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.
@@ -0,0 +1,23 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'autotest/restart'
4
+
5
+ # Autotest.add_hook :initialize do |at|
6
+ # at.extra_files << "../some/external/dependency.rb"
7
+ #
8
+ # at.libs << ":../some/external"
9
+ #
10
+ # at.add_exception 'vendor'
11
+ #
12
+ # at.add_mapping(/dependency.rb/) do |f, _|
13
+ # at.files_matching(/test_.*rb$/)
14
+ # end
15
+ #
16
+ # %w(TestA TestB).each do |klass|
17
+ # at.extra_class_map[klass] = "test/test_misc.rb"
18
+ # end
19
+ # end
20
+
21
+ # Autotest.add_hook :run_command do |at|
22
+ # system "rake build"
23
+ # end
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gem "mechanize"
@@ -0,0 +1,12 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ mechanize (1.0.0)
5
+ nokogiri (>= 1.2.1)
6
+ nokogiri (1.4.4)
7
+
8
+ PLATFORMS
9
+ ruby
10
+
11
+ DEPENDENCIES
12
+ mechanize
@@ -0,0 +1,6 @@
1
+ ### 1.0.0 / 2011-03-05
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
@@ -0,0 +1,12 @@
1
+ .autotest
2
+ bin/nameboy
3
+ domains.txt
4
+ Gemfile
5
+ Gemfile.lock
6
+ History.md
7
+ lib/nameboy.rb
8
+ Manifest.txt
9
+ Rakefile
10
+ README.md
11
+ test/test_nameboy.rb
12
+ TODO.md
@@ -0,0 +1,83 @@
1
+ # nameboy
2
+
3
+ http://github.com/veganstraightedge/nameboy
4
+
5
+ ## DESCRIPTION
6
+
7
+ Batch edit passwords for domains managed at
8
+ [http://access.enom.com](http://access.enom.com)
9
+
10
+ ## FEATURES/PROBLEMS
11
+
12
+ * change all of your domain passwords in one command
13
+ * is not interactive
14
+ * all domains passwords must be the same at the start
15
+ * all domains passwords will end up the same
16
+
17
+ ## SYNOPSIS
18
+
19
+ nameboy enom:password current_password new_password https://github.com/veganstraightedge/nameboy/blob/master/domains.txt
20
+
21
+ ## REQUIREMENTS
22
+
23
+ * ruby
24
+ * rubygems
25
+ * mechanize
26
+ * domains at [http://access.enom.com](http://access.enom.com)
27
+ * internet access
28
+
29
+ ## INSTALL
30
+
31
+ * sudo gem install nameboy
32
+
33
+ ## DEVELOPERS
34
+
35
+ After checking out the source, run
36
+
37
+ rake newb
38
+
39
+ This task will install any missing dependencies, run the tests/specs,
40
+ and generate the RDoc.
41
+
42
+ ## LICENSE
43
+
44
+ PUBLIC DOMAIN.
45
+ Your heart is as free as the air you breathe.
46
+ The ground you stand on is liberated territory.
47
+
48
+ ## Usage
49
+
50
+ ### Help
51
+
52
+ nameboy
53
+ nameboy -h
54
+ nameboy help
55
+
56
+ Prints this help text
57
+
58
+ ### Namespace:Action
59
+
60
+ nameboy enom:password
61
+
62
+ For now, this is the only action.
63
+ There are plans for more, thus the namespace.
64
+
65
+ ### Change Passwords
66
+
67
+ nameboy enom:password current_password new_password domains_file_url
68
+
69
+ current_password : what you use to log into access.enom.com
70
+ new_password : what you use to log into access.enom.com
71
+ domains_file_url : publicly accessible url of a plain text listing of domains
72
+
73
+ ### Example domains.txt
74
+
75
+ example.com
76
+ example.org
77
+ example.net
78
+
79
+ **Note** The file name can be anything, not just `domains.txt`.
80
+
81
+ ### Example
82
+
83
+ nameboy enom:password foo bar https://github.com/veganstraightedge/nameboy/blob/master/domains.txt
@@ -0,0 +1,13 @@
1
+ require "rubygems"
2
+ require "hoe"
3
+
4
+ Hoe.plugins.delete :rubyforge
5
+ Hoe.plugin :doofus, :git, :minitest
6
+
7
+ Hoe.spec "nameboy" do
8
+ developer "Shane Becker", "veganstraightedge@example.com"
9
+
10
+ self.extra_rdoc_files = Dir["*.rdoc"]
11
+ self.history_file = "History.md"
12
+ self.readme_file = "README.md"
13
+ end
data/TODO.md ADDED
@@ -0,0 +1,25 @@
1
+ # make it interactive
2
+ if ARGV.length == 1
3
+ puts "I need to use your access.enom.com password"
4
+ puts "I don't save or store your password anywhere"
5
+ puts "Coo? Cool."
6
+ puts
7
+ puts "What is your current password"
8
+ @current_password = gets
9
+ puts "What do you want your new password to be?"
10
+ @new_password = gets
11
+ puts "What was that new password again?"
12
+ confirm_@new_password = gets
13
+
14
+ unless @new_password == @new_password
15
+ puts "OH NOES! You mistyped one of your passwords."
16
+ puts "Start over and try again."
17
+ puts
18
+ exit
19
+ end
20
+
21
+ puts "What is the URL of your domains file?"
22
+ @url = gets
23
+ end
24
+
25
+ # write tests
@@ -0,0 +1,122 @@
1
+ require 'rubygems'
2
+ require 'mechanize'
3
+ require 'logger'
4
+ require 'open-uri'
5
+ require 'nameboy'
6
+
7
+ include Nameboy
8
+
9
+ @current_password = ""
10
+ @new_password = ""
11
+ @url = ""
12
+
13
+ def read_help_text
14
+ readme = File.read("../README.md")
15
+ help_exit = readme.split("## Usage").last.strip
16
+ end
17
+
18
+ def help_exit
19
+ puts
20
+ puts read_help_text
21
+ puts
22
+ exit
23
+ end
24
+
25
+ def loggy?
26
+ ARGV.last == "-l"
27
+ end
28
+
29
+ def check_args
30
+ if ARGV.length.zero? || ARGV[0] == "-h"
31
+ help_exit
32
+ end
33
+
34
+ unless ARGV[0] == "enom:password"
35
+ puts
36
+ puts "I only know how to deal with enom:password"
37
+ help_exit
38
+ end
39
+
40
+ if ARGV.length < 4
41
+ puts
42
+ puts "TOO FEW ARGUMENTS"
43
+ puts
44
+ puts "The format is:"
45
+ puts "nameboy enom:password @current_password @new_password domains_file_url"
46
+ puts
47
+ exit
48
+ end
49
+ end
50
+
51
+ def consume_args
52
+ @current_password = ARGV[1]
53
+ @new_password = ARGV[2]
54
+ @url = ARGV[3]
55
+ end
56
+
57
+ def process_domains
58
+ open(@url) do |f|
59
+ f.each_line do |line|
60
+ domain = line.strip
61
+ change_password(domain)
62
+ end
63
+ end
64
+ end
65
+
66
+ def change_password(domain)
67
+ puts
68
+ puts "*" * 80
69
+ puts "Starting : #{domain}"
70
+
71
+ # Create a new mechanize object
72
+ if loggy?
73
+ agent = Mechanize.new { |a| a.log = Logger.new(STDERR) }
74
+ else
75
+ agent = Mechanize.new
76
+ end
77
+
78
+ # Load the website
79
+ page = agent.get('http://access.enom.com/')
80
+
81
+ # log in
82
+ form = page.form_with(:name => 'frmLogin')
83
+ form.sldtld = domain
84
+ form.DomainPassword = @current_password
85
+
86
+ # submit the form to sign in
87
+ page = agent.submit(form, form.buttons.first)
88
+
89
+ # go to the general settings page
90
+ page = agent.get("http://access.enom.com/domainmain.asp?edit=settings#settings")
91
+
92
+ if page.uri.to_s == "http://access.enom.com/default.asp"
93
+ puts "*" * 80
94
+ puts "!!! : LOGIN FAILED"
95
+ puts "*" * 80
96
+ puts
97
+
98
+ else
99
+ # grab the general settings form
100
+ form = page.form_with(:name => 'frmSettings')
101
+
102
+ # change the password
103
+ form.password1 = @new_password
104
+ form.password2 = @new_password
105
+
106
+ # save the passwords
107
+ page = agent.submit(form)
108
+
109
+ puts "*" * 80
110
+ puts "SUCCESS #{domain} : PASSWORD UPDATED"
111
+ puts "*" * 80
112
+ puts
113
+ end
114
+ end
115
+
116
+ def go!
117
+ check_args
118
+ consume_args
119
+ process_domains
120
+ end
121
+
122
+ go!
@@ -0,0 +1,3 @@
1
+ example.com
2
+ example.org
3
+ example.net
@@ -0,0 +1,3 @@
1
+ class Nameboy
2
+ VERSION = '1.0.0'
3
+ end
@@ -0,0 +1,8 @@
1
+ require "test/unit"
2
+ require "nameboy"
3
+
4
+ class TestNameboy < Test::Unit::TestCase
5
+ def test_sanity
6
+ assert true
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nameboy
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Shane Becker
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-03-05 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: hoe
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 21
30
+ segments:
31
+ - 2
32
+ - 6
33
+ - 1
34
+ version: 2.6.1
35
+ type: :development
36
+ version_requirements: *id001
37
+ description: |-
38
+ Batch edit passwords for domains managed at
39
+ [http://access.enom.com](http://access.enom.com)
40
+ email:
41
+ - veganstraightedge@example.com
42
+ executables:
43
+ - nameboy
44
+ extensions: []
45
+
46
+ extra_rdoc_files:
47
+ - domains.txt
48
+ - Manifest.txt
49
+ files:
50
+ - .autotest
51
+ - bin/nameboy
52
+ - domains.txt
53
+ - Gemfile
54
+ - Gemfile.lock
55
+ - History.md
56
+ - lib/nameboy.rb
57
+ - Manifest.txt
58
+ - Rakefile
59
+ - README.md
60
+ - test/test_nameboy.rb
61
+ - TODO.md
62
+ has_rdoc: true
63
+ homepage: http://github.com/veganstraightedge/nameboy
64
+ licenses: []
65
+
66
+ post_install_message:
67
+ rdoc_options:
68
+ - --main
69
+ - README.md
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 3
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ requirements: []
91
+
92
+ rubyforge_project: nameboy
93
+ rubygems_version: 1.4.0
94
+ signing_key:
95
+ specification_version: 3
96
+ summary: Batch edit passwords for domains managed at [http://access.enom.com](http://access.enom.com)
97
+ test_files:
98
+ - test/test_nameboy.rb