password 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +109 -0
- data/bin/password +50 -0
- data/lib/password.rb +33 -0
- data/password-1.0.gem +0 -0
- data/password.gemspec +16 -0
- metadata +67 -0
data/README.txt
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
password: brain-dead simple password storage
|
2
|
+
by Giles Bowkett
|
3
|
+
http://gilesbowkett.blogspot.com/2008/02/sudo-gem-install-password.html
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
password is a simple command-line tool to store your INESSENTIAL passwords.
|
8
|
+
|
9
|
+
All passwords stored with password are stored as plain text in a file called
|
10
|
+
".they_stole_my_facebook_login_oh_noez" in your home directory.
|
11
|
+
|
12
|
+
If you store vitally essential personal information using password, you are a
|
13
|
+
dumb motherfucker. (Or, at least, much braver than smart.)
|
14
|
+
|
15
|
+
password exists because I could not give a flying fuck if somebody steals my
|
16
|
+
Twitter login and because I discovered research which indicates removing
|
17
|
+
registration requirements from online communities actually IMPROVES the
|
18
|
+
signal-to-noise ratio, consistently, by a nontrivial margin.
|
19
|
+
|
20
|
+
OpenID is not the solution. Not giving a fuck is the solution. Therefore I
|
21
|
+
present password - the crucial tool for people who don't give a fuck.
|
22
|
+
|
23
|
+
== CODE EXAMPLES:
|
24
|
+
|
25
|
+
password -g twitter
|
26
|
+
password --get twitter
|
27
|
+
|
28
|
+
Prints your Twitter username and password to the terminal.
|
29
|
+
|
30
|
+
password -a
|
31
|
+
|
32
|
+
Prints every known username/password combo to the terminal.
|
33
|
+
|
34
|
+
password -s twitter wilbur s3cr3t
|
35
|
+
password --set twitter wilbur s3cr3t
|
36
|
+
|
37
|
+
Sets your password entry for "twitter" to username "wilbur" and password
|
38
|
+
"s3cr3t".
|
39
|
+
|
40
|
+
password -G twitter wilbur
|
41
|
+
password --generating_set twitter wilbur
|
42
|
+
|
43
|
+
Sets your password entry for "twitter" to username "wilbur" and a 10-digit
|
44
|
+
autogenerated password, and prints the new username/password combo.
|
45
|
+
|
46
|
+
password -l 23 -G twitter wilbur
|
47
|
+
password --length 23 --generating_set twitter wilbur
|
48
|
+
|
49
|
+
Sets your password entry for "twitter" to username "wilbur" and a 23-digit
|
50
|
+
autogenerated password, and prints the new username/password combo.
|
51
|
+
|
52
|
+
All password really does is store a hash as YAML, so if you store a password
|
53
|
+
as "twitter" you won't be able to retrieve it as "Twitter." That's the bad
|
54
|
+
news; the good news is that if you really care about security, you can use
|
55
|
+
nicknames for sites, instead of their literal names, and combine that with
|
56
|
+
password's ability to create arbitrary-length autogenerated random passwords.
|
57
|
+
|
58
|
+
You could even do this:
|
59
|
+
|
60
|
+
password -l 235_000 -G username_for_site_that_joe_told_me_about_that_one_day_at_the_ramen_place x
|
61
|
+
password -l 235_000 -G password_for_site_that_joe_told_me_about_that_one_day_at_the_ramen_place x
|
62
|
+
|
63
|
+
The output would be:
|
64
|
+
|
65
|
+
username_for_site_that_joe_told_me_about_that_one_day_at_the_ramen_place
|
66
|
+
username: x
|
67
|
+
password: [235,000-character randomly-generated string]
|
68
|
+
password_for_site_that_joe_told_me_about_that_one_day_at_the_ramen_place
|
69
|
+
username: x
|
70
|
+
password: [235,000-character randomly-generated string]
|
71
|
+
|
72
|
+
Blam. Usernames and passwords that can stand up to rainbow hashes. Secure forever
|
73
|
+
against everybody but Joe, and whoever you guys went to the ramen place with that
|
74
|
+
one day. (And maybe your waiter or waitress, depending on the status of their
|
75
|
+
eavesdropping skills.)
|
76
|
+
|
77
|
+
== REQUIREMENTS:
|
78
|
+
|
79
|
+
* ActiveSupport
|
80
|
+
* Must not be an idiot
|
81
|
+
|
82
|
+
== INSTALL:
|
83
|
+
|
84
|
+
* sudo gem install password
|
85
|
+
|
86
|
+
== LICENSE:
|
87
|
+
|
88
|
+
(The MIT License)
|
89
|
+
|
90
|
+
Copyright (c) 2008 Giles Bowkett
|
91
|
+
|
92
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
93
|
+
a copy of this software and associated documentation files (the
|
94
|
+
'Software'), to deal in the Software without restriction, including
|
95
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
96
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
97
|
+
permit persons to whom the Software is furnished to do so, subject to
|
98
|
+
the following conditions:
|
99
|
+
|
100
|
+
The above copyright notice and this permission notice shall be
|
101
|
+
included in all copies or substantial portions of the Software.
|
102
|
+
|
103
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
104
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
105
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
106
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
107
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
108
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
109
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/bin/password
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
%w{rubygems activesupport optparse}.each {|library| require library}
|
3
|
+
|
4
|
+
require "#{File.dirname(__FILE__)}/../lib/password"
|
5
|
+
include Password
|
6
|
+
|
7
|
+
load_passwords
|
8
|
+
|
9
|
+
# command-line args
|
10
|
+
option_parser = OptionParser.new do |option_parser|
|
11
|
+
option_parser.on("-a") do
|
12
|
+
@action = :all
|
13
|
+
end
|
14
|
+
option_parser.on("-s", "--set site", String) do |site|
|
15
|
+
@site = site
|
16
|
+
@action = :set
|
17
|
+
end
|
18
|
+
option_parser.on("-g", "--get site", String) do |site|
|
19
|
+
@site = site
|
20
|
+
@action = :get
|
21
|
+
end
|
22
|
+
option_parser.on("-l", "--length length") do |length|
|
23
|
+
@length = length.to_i
|
24
|
+
end
|
25
|
+
option_parser.on("-G", "--generating_set site") do |site|
|
26
|
+
@site = site
|
27
|
+
@action = :set
|
28
|
+
@length ||= 10
|
29
|
+
@generated = generate(@length)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
username, password = option_parser.parse(ARGV)
|
33
|
+
password ||= @generated
|
34
|
+
|
35
|
+
def show_credentials_for(site)
|
36
|
+
puts site
|
37
|
+
puts " username: #{Password::SITES[site][:username]}"
|
38
|
+
puts " password: #{Password::SITES[site][:password]}"
|
39
|
+
end
|
40
|
+
|
41
|
+
case @action
|
42
|
+
when :get
|
43
|
+
show_credentials_for(@site)
|
44
|
+
when :all
|
45
|
+
Password::SITES.keys.each {|site| show_credentials_for(site)}
|
46
|
+
when :set
|
47
|
+
Password::SITES[@site] = {:username => username, :password => password}
|
48
|
+
show_credentials_for(@site) if @generated
|
49
|
+
save_passwords
|
50
|
+
end
|
data/lib/password.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'activesupport'
|
2
|
+
module Password
|
3
|
+
VERSION = '1.0.0'
|
4
|
+
FILENAME = "#{ENV['HOME']}/.they_stole_my_facebook_login_oh_noez" # honestly, "security", who gives a shit
|
5
|
+
SITES = {}
|
6
|
+
def set(credentials)
|
7
|
+
SITES[credentials[:site]] = {:username => credentials[:username],
|
8
|
+
:password => credentials[:password]}
|
9
|
+
end
|
10
|
+
def username(site)
|
11
|
+
SITES[site][:username]
|
12
|
+
end
|
13
|
+
def password(site)
|
14
|
+
SITES[site][:password]
|
15
|
+
end
|
16
|
+
def save_passwords
|
17
|
+
File.open(FILENAME, "w") {|file| file.puts SITES.to_yaml}
|
18
|
+
end
|
19
|
+
def load_passwords
|
20
|
+
if File.exists?(FILENAME)
|
21
|
+
SITES.merge!(YAML::load(File.open(FILENAME)))
|
22
|
+
else
|
23
|
+
{}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
def generate(length = 23)
|
27
|
+
# how to make this elegant?
|
28
|
+
password = ""
|
29
|
+
possible = %w{0 1 2 3 4 5 6 7 8 9 0 a b c d e f g h i j k l M N O P Q R S T U V W X Y Z ! $ # @ & * . ' =}
|
30
|
+
length.times {password << possible[rand(possible.size)]}
|
31
|
+
password
|
32
|
+
end
|
33
|
+
end
|
data/password-1.0.gem
ADDED
File without changes
|
data/password.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
SPEC = Gem::Specification.new do |s|
|
3
|
+
s.name = "password"
|
4
|
+
s.version = "1.0"
|
5
|
+
s.author = "Giles Bowkett"
|
6
|
+
s.email = "gilesb@gmail.com"
|
7
|
+
s.homepage = "http://gilesbowkett.blogspot.com/2008/02/sudo-gem-install-password.html"
|
8
|
+
s.rubyforge_project = "password"
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.summary = "Brain-dead simple password storage."
|
11
|
+
s.files = Dir.glob("**/*")
|
12
|
+
s.executables << "password"
|
13
|
+
s.require_path = "lib"
|
14
|
+
s.has_rdoc = false
|
15
|
+
s.add_dependency("activesupport", ">= 2.0.2")
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: password
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "1.0"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Giles Bowkett
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-02-15 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activesupport
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.0.2
|
23
|
+
version:
|
24
|
+
description:
|
25
|
+
email: gilesb@gmail.com
|
26
|
+
executables:
|
27
|
+
- password
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files: []
|
31
|
+
|
32
|
+
files:
|
33
|
+
- bin
|
34
|
+
- bin/password
|
35
|
+
- lib
|
36
|
+
- lib/password.rb
|
37
|
+
- password-1.0.gem
|
38
|
+
- password.gemspec
|
39
|
+
- README.txt
|
40
|
+
has_rdoc: false
|
41
|
+
homepage: http://gilesbowkett.blogspot.com/2008/02/sudo-gem-install-password.html
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: "0"
|
52
|
+
version:
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "0"
|
58
|
+
version:
|
59
|
+
requirements: []
|
60
|
+
|
61
|
+
rubyforge_project: password
|
62
|
+
rubygems_version: 1.0.0
|
63
|
+
signing_key:
|
64
|
+
specification_version: 2
|
65
|
+
summary: Brain-dead simple password storage.
|
66
|
+
test_files: []
|
67
|
+
|