authman 1.0.1

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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5de1fbc557d207f62bc3fb747793733a6642f396
4
+ data.tar.gz: d7f5505e8ef497d7b1d0e0e16d672a6244a379aa
5
+ SHA512:
6
+ metadata.gz: 0c72d69a25d48e97d3320edb268f3191484ed8c96af9b53192708a36e0d9a009f5d8222b75634da3cfd25f5f821b12502244f92ea6ad6103325eca158968b369
7
+ data.tar.gz: 35c1346492f611a167029e1fcf474ffba0fd6d314082abe651aa32aeeb65a356a5da5b3210198daf6c5d4f2ce5669b46c75720e099d50f48b80f34291976d1e7
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2014 Paymium
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # Authman
2
+
3
+ Generate time-based OTPs, the ones used by Google Authenticator for example, from the command-line
4
+
5
+ ## Usage
6
+ Install the gem:
7
+ ````
8
+ gem install authman
9
+ ````
10
+
11
+ Create your settings file at `~/.authman.json`
12
+ `````json
13
+ {
14
+ "Paymium": "<secret>",
15
+ "Amazon": "<secret>",
16
+ "Other service": "<secret>"
17
+ }
18
+ ````
19
+
20
+ Encrypt the file with GPG
21
+ ````
22
+ cat ~/.authman.json | gpg -a -e -r <your-key> -s -u <your-key> > ~/.authman.asc
23
+ ````
24
+
25
+ Remove the clear-text version
26
+ ````
27
+ rm ~/.authmane.json
28
+ ````
29
+
30
+ Run `authman`, and here you go, your OTPs are displayed in the shell window and updated as necessary, exit with Ctrl-C.
31
+
@@ -0,0 +1,9 @@
1
+ require 'authman/otp_generator'
2
+
3
+ module Authman
4
+
5
+ def self.cycle_otps
6
+ Authman::OtpGenerator.new.cycle_otps
7
+ end
8
+
9
+ end
@@ -0,0 +1,51 @@
1
+ require 'gpgme'
2
+ require 'json'
3
+ require 'rotp'
4
+
5
+ module Authman
6
+
7
+ class OtpGenerator
8
+
9
+ def initialize(filename = '~/.authman.asc')
10
+ f = File.expand_path(filename)
11
+
12
+ if File.exists?(f)
13
+ @settings = JSON.load(GPGME::Crypto.new.decrypt(open(f).read))
14
+ @totps = @settings.inject({}) { |ts, s| ts[s[0]] = ROTP::TOTP.new(s[1]); ts }
15
+ @max_name_length = @settings.map { |k,v| k.length }.max
16
+ else
17
+ puts <<-EOS
18
+ Unable to open <#{f}> make sure it contains a GPG-encrypted JSON structure of your OTP secrets.
19
+ The cleartext file should look like :
20
+
21
+ {
22
+ "Amazon AWS": "<secret>",
23
+ "Paymium": "<secret>"
24
+ }
25
+ EOS
26
+ end
27
+ end
28
+
29
+ def cycle_otps
30
+ @interrupted = false
31
+ trap('INT') { @interrupted = true }
32
+
33
+ if @settings
34
+ while(!@interrupted) do
35
+ system('clear')
36
+ puts "-- Cycling one-time passwords, <Ctrl-C> to exit"
37
+ print_current_otps
38
+ sleep(1)
39
+ end
40
+
41
+ puts "\nBye!"
42
+ end
43
+ end
44
+
45
+ def print_current_otps
46
+ @totps.each { |name, totp| puts "#{"%-#{@max_name_length}.#{@max_name_length}s" % name} : #{totp.now}" }
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,5 @@
1
+ module Authman
2
+
3
+ VERSION = '1.0.1'
4
+
5
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: authman
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - David François
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gpgme
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rotp
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Software TOTP generator
42
+ email:
43
+ - david.francois@paymium.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - LICENSE
49
+ - README.md
50
+ - lib/authman.rb
51
+ - lib/authman/otp_generator.rb
52
+ - lib/authman/version.rb
53
+ homepage: https://github.com/paymium/authman
54
+ licenses: []
55
+ metadata: {}
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 1.3.6
70
+ requirements: []
71
+ rubyforge_project:
72
+ rubygems_version: 2.4.2
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Software TOTP generator
76
+ test_files: []
77
+ has_rdoc: