dash 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  *.gem
2
2
  pkg/*
3
3
  .bundle
4
+ vendor
@@ -1,26 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dash (0.3.1)
5
- clamp
4
+ dash (0.4.0)
6
5
 
7
6
  GEM
8
7
  remote: http://rubygems.org/
9
8
  specs:
10
- clamp (0.2.2)
11
- diff-lcs (1.1.2)
12
- rspec (2.6.0)
13
- rspec-core (~> 2.6.0)
14
- rspec-expectations (~> 2.6.0)
15
- rspec-mocks (~> 2.6.0)
16
- rspec-core (2.6.4)
17
- rspec-expectations (2.6.0)
18
- diff-lcs (~> 1.1.2)
19
- rspec-mocks (2.6.0)
20
9
 
21
10
  PLATFORMS
22
11
  ruby
23
12
 
24
13
  DEPENDENCIES
25
14
  dash!
26
- rspec (~> 2.6)
@@ -0,0 +1,45 @@
1
+ # Dash
2
+
3
+ ## About
4
+
5
+ Let me guess - you're just using one password for every site. You've read that that's not the smartest way to work but you just can't change. If that's the way you work, why not use a tool that lets you work that way?
6
+
7
+ dash will take your one password and combine it with the domain name to give you a secure password. The next time you need that password, just give dash your password and the domain name to recreate the password. No storage needed!
8
+
9
+ ## Install
10
+
11
+ gem install dash
12
+
13
+ ## What do I do?
14
+
15
+ $ dash twitter.com -p my_password
16
+ Create a strong password for twitter.com using "my_password" as your primary password.
17
+
18
+ $ dash twitter.com -p my_password -w
19
+ Create a weak password - it only has numbers and letters.
20
+
21
+ $ dash twitter.com -p my_password -l 8
22
+ Create an 8-character strong password.
23
+
24
+ That's basically it. Take a look at the code to figure out what actually happens. Let's just say that there's some one-way hashing combined with some simple Base64 encoding.
25
+
26
+ ## Bonus
27
+
28
+ Getting tired of typing "-p my_password" all the time? Then stop! Just set the DASH_PASSWORD environment variable to my_password and dash will use it.
29
+
30
+ On a Mac, that looks like this:
31
+
32
+ $ export DASH_PASSWORD=my_password
33
+
34
+ Cool!
35
+
36
+ ## What's next?
37
+
38
+ I'd love to store the rules for passwords in a database of some sort (even just a flat file). For 80% of sites, the basic rules will work. But for those sites with weird rules (I'm looking at you americanexpress.com) for passwords, it would be nice to store the rules to make it easier to regenerate the password.
39
+
40
+ In addition, I've only tested this on OSX Lion using ruby 1.9.2p290. Got it working in a different environment? Let me know!
41
+
42
+ ## Contributing
43
+
44
+ Clone the repository and run `bundle install`. Now you've got all of the gem dependencies. Build some features and then submit a pull request.
45
+
@@ -19,6 +19,5 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency('clamp')
23
- s.add_development_dependency "rspec", "~> 2.6"
22
+ #s.add_development_dependency "rspec", "~> 2.6"
24
23
  end
@@ -1,21 +1,59 @@
1
- require 'clamp'
1
+ require 'optparse'
2
2
  require 'dash/password'
3
3
 
4
4
  module Dash
5
- class CLI < Clamp::Command
6
- option ["-l", "--length"], "N", "make a password of N length", :default => 12 do |s|
7
- Integer(s)
5
+ class CLI
6
+ def self.run
7
+ begin
8
+ password = generate_password
9
+ rescue OptionParser::ParseError,
10
+ OptionParser::InvalidArgument,
11
+ OptionParser::InvalidOption,
12
+ OptionParser::MissingArgument
13
+ puts $!.to_s
14
+ #puts optparse.to_s
15
+ exit
16
+ end
17
+
18
+ puts password
8
19
  end
9
- option ["-w", "--weak"], :flag, "generate a weak password"
10
- parameter "DOMAIN", "the domain that needs a password", :attribute_name => :domain
11
- parameter "[PASSWORD]", "your master password", :attribute_name => :password
12
-
13
- def execute
14
- puts Dash::Password.generate(domain, password, weak?, length)
15
- end
16
20
 
17
- def default_password
18
- ENV['DASH_PASSWORD'] || ''
21
+ def self.generate_password
22
+ options = {}
23
+ optparse = OptionParser.new do|opts|
24
+ # Set a banner, displayed at the top
25
+ # of the help screen.
26
+ opts.banner = "Usage: dash [options] DOMAIN"
27
+
28
+ # Define the options, and what they do
29
+ options[:weak] = false
30
+ opts.on( '-w', '--weak', 'Generate a weak password' ) do
31
+ options[:weak] = true
32
+ end
33
+
34
+ options[:length] = 12
35
+ opts.on( '-l', '--length N', Integer, 'Make a password of N length' ) do |l|
36
+ options[:length] = l
37
+ end
38
+
39
+ options[:password] = ENV['DASH_PASSWORD']
40
+ opts.on( '-p', '--password PASSWORD', 'Your master PASSWORD' ) do |p|
41
+ options[:password] = p
42
+ end
43
+
44
+ # This displays the help screen, all programs are
45
+ # assumed to have this option.
46
+ opts.on( '-h', '--help', 'Display this screen' ) do
47
+ return opts
48
+ exit
49
+ end
50
+ end
51
+
52
+ optparse.parse!
53
+
54
+ domain = ARGV.shift
55
+ return optparse unless domain
56
+ return Dash::Password.generate(domain, options[:password], options[:weak], options[:length])
19
57
  end
20
58
  end
21
59
  end
@@ -1,3 +1,3 @@
1
1
  module Dash
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,53 +1,29 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dash
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
4
5
  prerelease:
5
- version: 0.3.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Michael McClenaghan
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-07-21 00:00:00 -06:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: clamp
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "0"
25
- type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
- prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
31
- none: false
32
- requirements:
33
- - - ~>
34
- - !ruby/object:Gem::Version
35
- version: "2.6"
36
- type: :development
37
- version_requirements: *id002
38
- description: Generates a strong password that is simple to recreate so there is no need to ever store your passwords.
39
- email:
12
+ date: 2012-01-05 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Generates a strong password that is simple to recreate so there is no
15
+ need to ever store your passwords.
16
+ email:
40
17
  - mike@shift81.com
41
- executables:
18
+ executables:
42
19
  - dash
43
20
  extensions: []
44
-
45
21
  extra_rdoc_files: []
46
-
47
- files:
22
+ files:
48
23
  - .gitignore
49
24
  - Gemfile
50
25
  - Gemfile.lock
26
+ - README.md
51
27
  - Rakefile
52
28
  - bin/dash
53
29
  - dash.gemspec
@@ -55,33 +31,29 @@ files:
55
31
  - lib/dash/password.rb
56
32
  - lib/dash/version.rb
57
33
  - spec/dash_spec.rb
58
- has_rdoc: true
59
34
  homepage: https://github.com/shift81/dash
60
35
  licenses: []
61
-
62
36
  post_install_message:
63
37
  rdoc_options: []
64
-
65
- require_paths:
38
+ require_paths:
66
39
  - lib
67
- required_ruby_version: !ruby/object:Gem::Requirement
40
+ required_ruby_version: !ruby/object:Gem::Requirement
68
41
  none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: "0"
73
- required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
47
  none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- version: "0"
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
79
52
  requirements: []
80
-
81
53
  rubyforge_project: dash
82
- rubygems_version: 1.5.0
54
+ rubygems_version: 1.8.7
83
55
  signing_key:
84
56
  specification_version: 3
85
57
  summary: Strong password generator
86
- test_files:
58
+ test_files:
87
59
  - spec/dash_spec.rb