twofu 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +48 -0
- data/bin/twofu +31 -0
- data/lib/twofu.rb +3 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9e5e1ff5b5d90bee297ba4b4dba507a91cbc3ddd
|
4
|
+
data.tar.gz: 0da946163de23f3b5fa164cd7304594e8526e1e5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8d28f63ef2fef00f1d962640bf57e5eba0b4456cb5a2bc6b3e93e4deeb6fca43c63f6b4e791c41b3bd78885c7aa30542b4809fffa26182707eb3640f4578474a
|
7
|
+
data.tar.gz: ab1d576d35b002799d6b8adabd376ceadb91447a8aa06f54f914a98793fa555c799715e5b5cc8fc7166f07fe351c83f130f44cebcf3fcf4f7d2bd1109982b47d
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Ukaza Perdana
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Twofu: A Two-factor Authenticator Command-line App
|
2
|
+
|
3
|
+
Twofu is a compatible command-line alternative to Google Authenticator which allows you to get 2FA codes when you aren't near your phone, quickly. It will show you current, previous and next codes for each account you have, as well as telling you how many seconds until they expires.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Simply install this gem:
|
8
|
+
|
9
|
+
$ gem install twofu
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
Before using this app, you should prepare a file in which you will store all your secrets:
|
14
|
+
|
15
|
+
$ touch ~/.twofu.yml
|
16
|
+
|
17
|
+
Add your secret in the form of `Account Name: SOMEBASE32SECRET` (notice the space after colon, it's important) e.g.
|
18
|
+
|
19
|
+
$ echo "The TARDIS: BZCZ3OUC5BUJEYYC" >> ~/.twofu.yml
|
20
|
+
$ echo "Bank of Karabraxos: Z44QN4EZK76H5MVG" >> ~/.twofu.yml
|
21
|
+
|
22
|
+
Enjoy the tofu:
|
23
|
+
|
24
|
+
$ twofu
|
25
|
+
+--------------------+--------+--------+--------+
|
26
|
+
| account | prev | now | next |
|
27
|
+
+--------------------+--------+--------+--------+
|
28
|
+
| The TARDIS | 754027 | 907055 | 423897 |
|
29
|
+
| Bank of Karabraxos | 062481 | 361305 | 534213 |
|
30
|
+
+--------------------+--------+--------+--------+
|
31
|
+
[=============== ] 15s
|
32
|
+
|
33
|
+
## Thanks
|
34
|
+
|
35
|
+
Twofu is made possible thanks to these awesome gems:
|
36
|
+
|
37
|
+
- [rotp](https://github.com/mdp/rotp)
|
38
|
+
- [terminal-table](https://github.com/tj/terminal-table)
|
39
|
+
|
40
|
+
Twofu is a clone of [gauth](https://github.com/pcarrier/gauth) (which is not too bad for the first gem that I made, I guess).
|
41
|
+
|
42
|
+
## Contributing
|
43
|
+
|
44
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ukazap/twofu.
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/bin/twofu
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rotp'
|
3
|
+
require 'terminal-table'
|
4
|
+
require 'yaml'
|
5
|
+
require 'twofu'
|
6
|
+
|
7
|
+
if ["-v", "--version"].include? ARGV.first
|
8
|
+
puts "Twofu #{Twofu::VERSION}"
|
9
|
+
exit
|
10
|
+
end
|
11
|
+
|
12
|
+
the_secrets = Dir.home + "/.twofu.yml"
|
13
|
+
|
14
|
+
begin
|
15
|
+
rows = []
|
16
|
+
now = Time.now
|
17
|
+
accounts = File.open(the_secrets) { |io| YAML.load(io) }
|
18
|
+
accounts.each do |label, secret|
|
19
|
+
acct = ROTP::TOTP.new secret
|
20
|
+
rows << [label, acct.at(now - 30), acct.now, acct.at(now + 30)]
|
21
|
+
end
|
22
|
+
|
23
|
+
puts Terminal::Table.new headings: ["account", "prev", "now", "next"], rows: rows
|
24
|
+
|
25
|
+
elapsed = Time.now.to_i % 30
|
26
|
+
remaining = 30 - elapsed
|
27
|
+
puts "[#{"="*elapsed}#{" "*remaining}] #{remaining}s"
|
28
|
+
rescue Exception => e
|
29
|
+
puts "Duh. #{e}"
|
30
|
+
puts "Please store your accounts with correct format: `Account Name: SOMEBASE32SECRET` into #{the_secrets}"
|
31
|
+
end
|
data/lib/twofu.rb
ADDED
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: twofu
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ukaza Perdana
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-22 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.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
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: rotp
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: terminal-table
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.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.5'
|
69
|
+
description: Twofu is a compatible command-line alternative to Google Authenticator
|
70
|
+
which allows you to get 2FA codes when you aren't near your phone, quickly.
|
71
|
+
email:
|
72
|
+
- ukz@programmer.net
|
73
|
+
executables:
|
74
|
+
- twofu
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- bin/twofu
|
81
|
+
- lib/twofu.rb
|
82
|
+
homepage: https://github.com/ukazap/twofu
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata: {}
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 2.4.5.1
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: A two-factor authenticator command-line app.
|
106
|
+
test_files: []
|
107
|
+
has_rdoc:
|