sesame-cli 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8946385f1c8994446d910c37ecab7b3fe5497d7753f156c47ba9f3d70d655631
4
+ data.tar.gz: 515d7680020974e60217383d1245e829ff8b0486e915b072a0950c2acf41ad1c
5
+ SHA512:
6
+ metadata.gz: 1796899e14a5bbc257b7ad781be05a64ede3e2b3c673bf44fd49ff67b7dc5fa40d5b45e40fe7f82140a3553f61628e761a49e790ebb072e3dc8d4d51f1882b58
7
+ data.tar.gz: bcbefe388969f696f1dfc778837991543b0fdc1f6811ae7e968529ac353a514ec2ce74c267c09204f93d4239f93e32182555dfb2c1beebc2456331adf0b9e5d8
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ UNLICENSE
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'bases', '~> 1.0'
4
+ gem 'clipboard', '~> 1.1'
5
+ gem 'digest-crc', '~> 0.4'
6
+ gem 'highline', '~> 1.7'
7
+ gem 'i18n', '~> 1.0'
8
+ gem 'rbnacl', '~> 5.0'
9
+ gem 'rbnacl-libsodium', '~> 1.0'
10
+ gem 'slop', '~> 4.6'
11
+
12
+ group :development do
13
+ gem 'awesome_print', '~> 1.8.0'
14
+ gem 'byebug', '~> 10.0.1'
15
+ gem 'jeweler', '~> 2.3.9'
16
+ gem 'rdoc', '~> 6.0'
17
+ gem 'rspec', '~> 3.7'
18
+ gem 'simplecov', '~> 0.15'
19
+ gem 'yard', '~> 0.9'
20
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,109 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ addressable (2.4.0)
5
+ awesome_print (1.8.0)
6
+ bases (1.0.2)
7
+ builder (3.2.3)
8
+ byebug (10.0.2)
9
+ clipboard (1.1.1)
10
+ concurrent-ruby (1.0.5)
11
+ descendants_tracker (0.0.4)
12
+ thread_safe (~> 0.3, >= 0.3.1)
13
+ diff-lcs (1.3)
14
+ digest-crc (0.4.1)
15
+ docile (1.3.0)
16
+ faraday (0.9.2)
17
+ multipart-post (>= 1.2, < 3)
18
+ ffi (1.9.23)
19
+ git (1.3.0)
20
+ github_api (0.16.0)
21
+ addressable (~> 2.4.0)
22
+ descendants_tracker (~> 0.0.4)
23
+ faraday (~> 0.8, < 0.10)
24
+ hashie (>= 3.4)
25
+ mime-types (>= 1.16, < 3.0)
26
+ oauth2 (~> 1.0)
27
+ hashie (3.5.7)
28
+ highline (1.7.10)
29
+ i18n (1.0.1)
30
+ concurrent-ruby (~> 1.0)
31
+ jeweler (2.3.9)
32
+ builder
33
+ bundler
34
+ git (>= 1.2.5)
35
+ github_api (~> 0.16.0)
36
+ highline (>= 1.6.15)
37
+ nokogiri (>= 1.5.10)
38
+ psych
39
+ rake
40
+ rdoc
41
+ semver2
42
+ json (2.1.0)
43
+ jwt (1.5.6)
44
+ mime-types (2.99.3)
45
+ mini_portile2 (2.3.0)
46
+ multi_json (1.13.1)
47
+ multi_xml (0.6.0)
48
+ multipart-post (2.0.0)
49
+ nokogiri (1.8.2)
50
+ mini_portile2 (~> 2.3.0)
51
+ oauth2 (1.4.0)
52
+ faraday (>= 0.8, < 0.13)
53
+ jwt (~> 1.0)
54
+ multi_json (~> 1.3)
55
+ multi_xml (~> 0.5)
56
+ rack (>= 1.2, < 3)
57
+ psych (3.0.2)
58
+ rack (2.0.4)
59
+ rake (12.3.1)
60
+ rbnacl (5.0.0)
61
+ ffi
62
+ rbnacl-libsodium (1.0.16)
63
+ rbnacl (>= 3.0.1)
64
+ rdoc (6.0.3)
65
+ rspec (3.7.0)
66
+ rspec-core (~> 3.7.0)
67
+ rspec-expectations (~> 3.7.0)
68
+ rspec-mocks (~> 3.7.0)
69
+ rspec-core (3.7.1)
70
+ rspec-support (~> 3.7.0)
71
+ rspec-expectations (3.7.0)
72
+ diff-lcs (>= 1.2.0, < 2.0)
73
+ rspec-support (~> 3.7.0)
74
+ rspec-mocks (3.7.0)
75
+ diff-lcs (>= 1.2.0, < 2.0)
76
+ rspec-support (~> 3.7.0)
77
+ rspec-support (3.7.1)
78
+ semver2 (3.4.2)
79
+ simplecov (0.16.1)
80
+ docile (~> 1.1)
81
+ json (>= 1.8, < 3)
82
+ simplecov-html (~> 0.10.0)
83
+ simplecov-html (0.10.2)
84
+ slop (4.6.2)
85
+ thread_safe (0.3.6)
86
+ yard (0.9.12)
87
+
88
+ PLATFORMS
89
+ ruby
90
+
91
+ DEPENDENCIES
92
+ awesome_print (~> 1.8.0)
93
+ bases (~> 1.0)
94
+ byebug (~> 10.0.1)
95
+ clipboard (~> 1.1)
96
+ digest-crc (~> 0.4)
97
+ highline (~> 1.7)
98
+ i18n (~> 1.0)
99
+ jeweler (~> 2.3.9)
100
+ rbnacl (~> 5.0)
101
+ rbnacl-libsodium (~> 1.0)
102
+ rdoc (~> 6.0)
103
+ rspec (~> 3.7)
104
+ simplecov (~> 0.15)
105
+ slop (~> 4.6)
106
+ yard (~> 0.9)
107
+
108
+ BUNDLED WITH
109
+ 1.16.1
data/README.md ADDED
@@ -0,0 +1,234 @@
1
+ [![Gem Version](https://badge.fury.io/rb/sesame-cli.svg)](http://badge.fury.io/rb/sesame-cli)
2
+ [![Dependency Status](https://gemnasium.com/badges/github.com/kranzky/sesame-cli.svg)](https://gemnasium.com/github.com/kranzky/sesame-cli)
3
+ [![Codeship Status for kranzky/sesame-cli](https://app.codeship.com/projects/01008000-26b3-0136-297f-36c36926d30f/status?branch=master)](https://app.codeship.com/projects/286882)
4
+
5
+ Sesame
6
+ ======
7
+
8
+ Sesame is a simple password manager for the command-line.
9
+
10
+ Creating a Cave
11
+ ---------------
12
+
13
+ Your passwords are stored in a secure cave, guarded by a Jinn that will only
14
+ grant access if the correct magic words are uttered. These words also known as a
15
+ passphrase, or a sesame seed 😩
16
+
17
+ To get started, install Sesame and create a new cave. Note that the `--echo`
18
+ argument is used to display sensitive information such as the generated
19
+ passphrase; omit `--echo` to have this copied to the clipboard instead.
20
+
21
+ ```
22
+ $ gem install sesame
23
+ $ sesame --echo
24
+ ╔═════════════════════════════════════╗
25
+ ║ ┏━━━┓ ┏━━━┓ ┏━━━┓ ┏━┓ ┏┓ ┏┓ ┏━━━┓ ║
26
+ ║ ┗━╋━┓ ┣━━┫ ┗━╋━┓ ┏┻━┻┓ ┃┗┳┛┃ ┣━━┫ ║
27
+ ║ ┗━━━┛ ┗━━━┛ ┗━━━┛ ┗ ┛ ┗ ┛ ┗━━━┛ ║
28
+ ╚═════════════════════════════════════╝
29
+
30
+ 🧞 - "Your new cave is ready, master. Please commit these magic words to memory..."
31
+ mammal glue wage paper store detail weave date
32
+
33
+ 🧞 - "What is your command?"
34
+ 1. list
35
+ 2. add
36
+ 3. get
37
+ 4. next
38
+ 5. delete
39
+ 6. exit
40
+ 7. help
41
+
42
+ > exit
43
+ 🧞 - "I have secured your treasure with this key..."
44
+ sky tea ant ice
45
+ ```
46
+
47
+ You will notice that Sesame enters interactive mode, allowing you to issue
48
+ multiple commands in a single session. When you exit from interactive mode, the
49
+ cave will be locked with a short code.
50
+
51
+ Remembering the Passphrase
52
+ --------------------------
53
+
54
+ By default, Sesame generates an eight-word passphrase that is used to secure
55
+ your cave. Try to remember it in groups of two or three consecutive words, and
56
+ associate those words with something you know well (such as walking through your
57
+ home, from the front door to the bathroom).
58
+
59
+ * I enter the front door. On the side table a mammal is glueing their wages together.
60
+ * Turning left into the kitchen, I see the drawer where I store my paper.
61
+ * Looking down the corridor, I notice a detailed weave of a date on the bathroom door.
62
+
63
+ Lame perhaps, but easier to remember than `58qWT6jHpA566MX` (and just as
64
+ secure).
65
+
66
+ If you must write the passphrase down, please make sure to store the paper that
67
+ you write it on securely (ideally in a safe).
68
+
69
+ Unlocking the Cave
70
+ ------------------
71
+
72
+ Upon exiting interactive mode for the first time, Sesame will lock your cave
73
+ with a short code. In the example above, that code is `sky tea ant ice`. The
74
+ next time you run Sesame, you will be prompted to enter the short code instead
75
+ of your eight-word passphrase.
76
+
77
+ Instead of entering the full code, you may also enter just the first letter of
78
+ each word. For the example above, entering `stai` as the unlock code will also
79
+ work.
80
+
81
+ Keeping your cave locked this way is convenient, but anyone with access to your
82
+ computer would be able to crack the lock with a small amount of effort. It is
83
+ therefore recommended to expunge the lock when you don't need it. You can do
84
+ this with the `--expunge` argument.
85
+
86
+ Adding a Service
87
+ ----------------
88
+
89
+ You can add, list, retrieve and delete passwords for different services.
90
+
91
+ ```
92
+ > add twitter kranzky
93
+ 🧞 - "Your new magic words are..."
94
+ nylon sand slice party
95
+ ```
96
+
97
+ Listing Services
98
+ ----------------
99
+
100
+ ```
101
+ > list
102
+ 🧞 - "Behold! Tremble in awe at the greatness of these heroes!"
103
+ twitter
104
+ facebook
105
+ google (2)
106
+ ```
107
+
108
+ If several user accounts exist for the same service, a number will be displayed
109
+ in brackets. View all accounts by listing the service.
110
+
111
+ ```
112
+ > list google
113
+ 🧞 - "Behold! Tremble in awe at the greatness of these heroes!"
114
+ lloyd@kranzky.com
115
+ pazu@kranzky.com
116
+ ```
117
+
118
+ Retrieving a Password
119
+ ---------------------
120
+
121
+ You can retrieve a password for an existing service. You only need to specify
122
+ the name of the user account if more than one exists for the service.
123
+
124
+ ```
125
+ > get google lloyd@kranzky.com
126
+ 🧞 - "Master, the magic words for lloyd@kranzky.com of google are..."
127
+ rainy area rough feather
128
+ ```
129
+
130
+ Updating a Password
131
+ -------------------
132
+
133
+ From time-to-time you may wish to update the password that you use for a
134
+ particular service. The `next` command allows you to do that.
135
+
136
+ ```
137
+ > next google lloyd@kranzky.com
138
+ ```
139
+
140
+ Removing a Service
141
+ ------------------
142
+
143
+ You can delete services from your cave.
144
+
145
+ ```
146
+ > delete google pazu@kranzky.com
147
+ ```
148
+
149
+ Recovering a Lost Cave
150
+ ----------------------
151
+
152
+ Sesame stores your cave in an encrypted file named `sesame.cave`. You should
153
+ keep this file in Dropbox or iCloud or a similar service to ensure that you
154
+ don't lose it. However, if the worst happens and you do lose that file, you may
155
+ recover it by specifying the `--reconstruct` argument when creating a new cave.
156
+
157
+ You will be prompted to enter the passphrase that you wish to use. As long as
158
+ you use the same passphrase as the one you used for your lost cave, the
159
+ passwords generated for the services you add to the cave will be the same.
160
+
161
+ Command-line Options
162
+ --------------------
163
+
164
+ Run with the `--help` argument to view all options.
165
+
166
+ ```
167
+ $ sesame --help
168
+ usage: ./bin/sesame [options]
169
+ -p, --path the path to the sesame cave; overrides $SESAME_PATH and .sesamerc
170
+ -s, --service the name of the service (e.g. Twitter)
171
+ -u, --user the username for the given service (e.g. user@test.com)
172
+ -o, --offset the password index for the service and username (defaults to 0)
173
+ -e, --echo display passwords in plain text instead of adding to the clipboard
174
+ -i, --interactive launch an interactive cli, allowing commands to be issued
175
+ -r, --reconstruct reconstruct a sesame cave from an existing passphrase
176
+ -x, --expunge remove the temporary lock; the full passphrase will be required
177
+ -c, --command the command to execute; one of: list, get, add, next, delete
178
+ -l, --list show all services and usernames
179
+ -a, --add add a new service and username
180
+ -g, --get get the current password for an existing service and username
181
+ -n, --next generate a new password for an existing service and username
182
+ -d, --delete remove an existing service and username
183
+ -q, --quiet silence the jinn
184
+ -v, --version print the version and exit
185
+ -h, --help all of that up there ^
186
+ ```
187
+
188
+ You can issue commands directly, which will suppress interactive mode.
189
+
190
+ ```
191
+ $ sesame -qegs twitter
192
+ Enter unlock code.
193
+ 🔑 ****
194
+ Opened ./sesame.cave
195
+ Password for twitter / kranzky:
196
+ nylon sand slice party
197
+ ```
198
+
199
+ Configuration
200
+ -------------
201
+
202
+ Rather than specifying the `--path` argument, you may set the `$SESAME_PATH`
203
+ environment variable to the location where the `sesame.cave` file should be
204
+ stored.
205
+
206
+ Sesame will also look for a file named `.sesamerc` or `sesame.cfg` in the
207
+ current directory and in your home directory. This file should be in the JSON
208
+ format, and can specify the `path`, `user`, `echo` and `quiet` options. For
209
+ example, here is the configuration file used by Lloyd Kranzky:
210
+
211
+ ```
212
+ {
213
+ "path": "~/Dropbox",
214
+ "user": "lloyd@kranzky.com",
215
+ "echo": "false",
216
+ "quiet": "true"
217
+ }
218
+ ```
219
+
220
+ Contributing
221
+ ------------
222
+
223
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
224
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
225
+ * Fork the project.
226
+ * Start a feature/bugfix branch.
227
+ * Commit and push until you are happy with your contribution.
228
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
229
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
230
+
231
+ Copyright
232
+ ---------
233
+
234
+ Copyright (c) 2018 Jason Hutchens and Jack Casey. See UNLICENSE for further details.
data/Rakefile ADDED
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "sesame-cli"
18
+ gem.homepage = "http://github.com/kranzky/sesame-cli"
19
+ gem.license = "UNLICENSE"
20
+ gem.summary = %Q{Sesame is a simple password manager for the command-line.}
21
+ gem.description = %Q{Sesame is a simple password manager for the command-line.}
22
+ gem.email = "jasonhutchens@gmail.com"
23
+ gem.authors = ["Jason Hutchens", "Jack Casey"]
24
+ gem.required_ruby_version = "~> 2.1"
25
+ # dependencies defined in Gemfile
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rspec/core'
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |spec|
32
+ spec.pattern = FileList['spec/**/*_spec.rb']
33
+ end
34
+
35
+ desc "Code coverage detail"
36
+ task :simplecov do
37
+ ENV['COVERAGE'] = "true"
38
+ Rake::Task['spec'].execute
39
+ end
40
+
41
+ task :default => :spec
42
+
43
+ require 'yard'
44
+ YARD::Rake::YardocTask.new
data/UNLICENSE ADDED
@@ -0,0 +1,24 @@
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
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 NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <http://unlicense.org/>
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/bin/sesame ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'sesame'
4
+ require 'slop'
5
+
6
+ opts =
7
+ begin
8
+ Slop.parse do |o|
9
+ o.string '-p', '--path', 'the path to the sesame cave; overrides $SESAME_PATH and .sesamerc'
10
+ o.string '-s', '--service', 'the name of the service (e.g. Twitter)'
11
+ o.string '-u', '--user', 'the username for the given service (e.g. user@test.com)'
12
+ o.integer '-o', '--offset', 'the password index for the service and username (defaults to 0)'
13
+ o.bool '-e', '--echo', 'display passwords in plain text instead of adding to the clipboard'
14
+ o.bool '-i', '--interactive', 'launch an interactive cli, allowing commands to be issued'
15
+ o.bool '-r', '--reconstruct', 'reconstruct a sesame cave from an existing passphrase'
16
+ o.bool '-x', '--expunge', 'remove the temporary lock; the full passphrase will be required'
17
+ o.string '-c', '--command', 'the command to execute; one of: list, get, add, next, delete'
18
+ o.bool '-l', '--list', 'show all services and usernames'
19
+ o.bool '-a', '--add', 'add a new service and username'
20
+ o.bool '-g', '--get', 'get the current password for an existing service and username'
21
+ o.bool '-n', '--next', 'generate a new password for an existing service and username'
22
+ o.bool '-d', '--delete', 'remove an existing service and username'
23
+ o.bool '-q', '--quiet', 'silence the jinn'
24
+ o.on '-v', '--version', 'print the version and exit' do
25
+ say(File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')))
26
+ exit
27
+ end
28
+ o.on '-h', '--help', 'all of that up there ^' do
29
+ say(o)
30
+ exit
31
+ end
32
+ end
33
+ rescue Slop::Error => e
34
+ say(e.message + " (try --help)")
35
+ exit 1
36
+ end
37
+ if opts.arguments.count > 0
38
+ say("extraneous arguments: #{opts.arguments.join(' ')} (try --help)")
39
+ exit 1
40
+ end
41
+
42
+ Sesame::Jinn.new(opts).process!