passfn 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +65 -0
- data/Rakefile +2 -0
- data/bin/passfn +47 -0
- data/lib/passfn.rb +7 -0
- data/lib/passfn/generator.rb +17 -0
- data/lib/passfn/version.rb +3 -0
- data/passfn.gemspec +29 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 00739514c3a496611cd51e33e69038d770440bd6
|
4
|
+
data.tar.gz: 0d4965a1b47c193a354dec15d8a891c68631460d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 190c105f735c193e338dc26563dc2a25b6b54305c901355cf7b3df1518fa5fb21a90b0bf6f7e4822fa4c5dfce860e755788e66ce19d30825bb967164ede321a3
|
7
|
+
data.tar.gz: 7f67a6c783b5352bd0432290131e591206475f43313780552c3c9cad40892050524fc3f467c32e74ea1e85dde0b45437cdf7036ec335d8d96d43231ce1a2c986
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.2
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Yutaka ICHIBANGASE
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Passfn
|
2
|
+
|
3
|
+
`passfn` provides a CLI command to generate a password from a domain and a master passphrase.
|
4
|
+
|
5
|
+
## Caveat
|
6
|
+
|
7
|
+
I'm not a security professional.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'passfn'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install passfn
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Assume the master passphrase is:
|
28
|
+
```
|
29
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
30
|
+
```
|
31
|
+
|
32
|
+
### Without any options
|
33
|
+
|
34
|
+
```sh
|
35
|
+
$ passfn
|
36
|
+
domain? example.com
|
37
|
+
passphrase?
|
38
|
+
[zB#S2^xBT;@q%.X??ec5s"&?5\%IKaN
|
39
|
+
```
|
40
|
+
|
41
|
+
### With domain option
|
42
|
+
|
43
|
+
```sh
|
44
|
+
$ passfn --domain=example.com
|
45
|
+
passphrase?
|
46
|
+
[zB#S2^xBT;@q%.X??ec5s"&?5\%IKaN
|
47
|
+
```
|
48
|
+
|
49
|
+
### Copy to clipboard
|
50
|
+
|
51
|
+
```sh
|
52
|
+
$ passfn --domain=example.com --copy
|
53
|
+
passphrase?
|
54
|
+
password for example.com is copied into clipboard
|
55
|
+
$ pbpaste # I'm using Mac OSX
|
56
|
+
[zB#S2^xBT;@q%.X??ec5s"&?5\%IKaN
|
57
|
+
```
|
58
|
+
|
59
|
+
## Contributing
|
60
|
+
|
61
|
+
1. Fork it ( https://github.com/ichiban/passfn/fork )
|
62
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
63
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
64
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
65
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/passfn
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
3
|
+
require 'thor'
|
4
|
+
require 'clipboard'
|
5
|
+
require 'passfn'
|
6
|
+
|
7
|
+
class PassfnCLI < Thor
|
8
|
+
default_command :apply
|
9
|
+
|
10
|
+
desc 'apply', 'apply master passphrase to domain and get the password'
|
11
|
+
method_option :copy, {
|
12
|
+
type: :boolean,
|
13
|
+
aliases: '-c',
|
14
|
+
desc: 'copy the password to clipboard'
|
15
|
+
}
|
16
|
+
method_option :domain, {
|
17
|
+
type: :string,
|
18
|
+
aliases: '-d',
|
19
|
+
desc: 'specify domain for the password.'
|
20
|
+
}
|
21
|
+
method_option :quiet, {
|
22
|
+
type: :boolean,
|
23
|
+
default: false,
|
24
|
+
aliases: '-q',
|
25
|
+
desc: 'stop showing prompts and newlines for humans'
|
26
|
+
}
|
27
|
+
def apply
|
28
|
+
domain = options[:domain] || (print 'domain? '; STDIN.gets.chomp)
|
29
|
+
if options[:quiet]
|
30
|
+
passphrase = STDIN.gets.chomp
|
31
|
+
else
|
32
|
+
passphrase = (STDOUT.print 'passphrase? '; STDIN.noecho(&:gets).chomp)
|
33
|
+
STDOUT.puts
|
34
|
+
end
|
35
|
+
password = Passfn::Generator.perform(domain, passphrase)
|
36
|
+
if options[:copy]
|
37
|
+
Clipboard.copy password
|
38
|
+
puts "password for #{domain} is copied into clipboard"
|
39
|
+
elsif options[:quiet]
|
40
|
+
STDOUT.print password
|
41
|
+
else
|
42
|
+
STDOUT.puts password
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
PassfnCLI.start
|
data/lib/passfn.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'openssl'
|
2
|
+
|
3
|
+
module Passfn
|
4
|
+
class Generator
|
5
|
+
class << self
|
6
|
+
def perform(domain, passphrase)
|
7
|
+
@digest ||= OpenSSL::Digest.new('sha256')
|
8
|
+
hmac = OpenSSL::HMAC.digest(@digest, domain, passphrase)
|
9
|
+
password = ''
|
10
|
+
hmac.each_byte do |byte|
|
11
|
+
password += Passfn::ALPHABETS[byte % Passfn::ALPHABETS.size]
|
12
|
+
end
|
13
|
+
password
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/passfn.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'passfn/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "passfn"
|
8
|
+
spec.version = Passfn::VERSION
|
9
|
+
spec.authors = ["Yutaka ICHIBANGASE"]
|
10
|
+
spec.email = ["yichiban@gmail.com"]
|
11
|
+
spec.summary = "passfn - tiny password generator"
|
12
|
+
spec.description = <<-EOD
|
13
|
+
passfn provides a cli command to generate a password
|
14
|
+
from a domain and a master passphrase.
|
15
|
+
EOD
|
16
|
+
spec.homepage = "https://github.com/ichiban/passfn"
|
17
|
+
spec.license = "MIT"
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0")
|
20
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
|
27
|
+
spec.add_runtime_dependency "thor", "~> 0.19.1"
|
28
|
+
spec.add_runtime_dependency "clipboard", "~> 1.0.5"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: passfn
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yutaka ICHIBANGASE
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.19.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.19.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: clipboard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.5
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.5
|
69
|
+
description: |2
|
70
|
+
passfn provides a cli command to generate a password
|
71
|
+
from a domain and a master passphrase.
|
72
|
+
email:
|
73
|
+
- yichiban@gmail.com
|
74
|
+
executables:
|
75
|
+
- passfn
|
76
|
+
extensions: []
|
77
|
+
extra_rdoc_files: []
|
78
|
+
files:
|
79
|
+
- ".gitignore"
|
80
|
+
- ".ruby-version"
|
81
|
+
- Gemfile
|
82
|
+
- LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/passfn
|
86
|
+
- lib/passfn.rb
|
87
|
+
- lib/passfn/generator.rb
|
88
|
+
- lib/passfn/version.rb
|
89
|
+
- passfn.gemspec
|
90
|
+
homepage: https://github.com/ichiban/passfn
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.2.2
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: passfn - tiny password generator
|
114
|
+
test_files: []
|