humpass 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 97e582f2591ac7772c13ed1d8c23c601f07764e8
4
+ data.tar.gz: 9be2259d8ab34ebacafa82642f92d34b31909c25
5
+ SHA512:
6
+ metadata.gz: 11a817352f163a58cfd309bd071d5c6c0283eab67f18f0a96a722e69c0b6b38d401f78c907ff1bf8533d0f8df644f9c9f49c94eb7af9fdaa157f776c66d4ae94
7
+ data.tar.gz: 9801354af968c992bd23b3e2475feb8f5ad2c37f6f0134984ec2172810eb5686620917fbe5934f94b125dad2f41281c2f0f790ada889ef840d46b39c97c6a4f3
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ /lib/humpass/humpass.dat
13
+ /.idea/workspace.xml
14
+ /.idea/humpass.iml
15
+ /humpass.dat
data/.idea/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build humpass-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install humpass-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install humpass-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push humpass-0.1.0.gem to TODO: Set to 'http://mygemserver.com'" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
data/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.4.0" project-jdk-type="RUBY_SDK" />
4
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/humpass.iml" filepath="$PROJECT_DIR$/.idea/humpass.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.16.0.pre.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ghamdan.eng@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in humpass.gemspec
6
+ gemspec
7
+
8
+ gem 'awesome_print'
9
+ gem 'json'
data/Gemfile.lock ADDED
@@ -0,0 +1,39 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ humpass (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ awesome_print (1.8.0)
10
+ diff-lcs (1.3)
11
+ json (2.1.0)
12
+ rake (10.5.0)
13
+ rspec (3.7.0)
14
+ rspec-core (~> 3.7.0)
15
+ rspec-expectations (~> 3.7.0)
16
+ rspec-mocks (~> 3.7.0)
17
+ rspec-core (3.7.0)
18
+ rspec-support (~> 3.7.0)
19
+ rspec-expectations (3.7.0)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.7.0)
22
+ rspec-mocks (3.7.0)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.7.0)
25
+ rspec-support (3.7.0)
26
+
27
+ PLATFORMS
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ awesome_print
32
+ bundler (~> 1.16.a)
33
+ humpass!
34
+ json
35
+ rake (~> 10.0)
36
+ rspec (~> 3.0)
37
+
38
+ BUNDLED WITH
39
+ 1.16.0
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Gabriel Hamdan
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,47 @@
1
+ # Humpass
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/humpass`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ Ruby Application for Creating random passwords and storing them secured.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'humpass'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install humpass
22
+
23
+ ## Usage
24
+
25
+ Type:
26
+ ```
27
+ $ humpass --help
28
+ ```
29
+ To get instructions
30
+
31
+ ## Development
32
+
33
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
34
+
35
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hamdan85/humpass. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
40
+
41
+ ## License
42
+
43
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
44
+
45
+ ## Code of Conduct
46
+
47
+ Everyone interacting in the Humpass project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hamdan85/humpass/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/assets/words.txt ADDED
@@ -0,0 +1,500 @@
1
+ rough
2
+ care
3
+ weight
4
+ ill
5
+ friction
6
+ even
7
+ suggestion
8
+ confuse
9
+ cup
10
+ stain
11
+ tangible
12
+ fade
13
+ auspicious
14
+ untidy
15
+ blush
16
+ voiceless
17
+ gaping
18
+ gaudy
19
+ fumbling
20
+ reproduce
21
+ present
22
+ tank
23
+ jumbled
24
+ clip
25
+ zany
26
+ credit
27
+ piquant
28
+ deer
29
+ envious
30
+ faded
31
+ tramp
32
+ melted
33
+ man
34
+ effect
35
+ willing
36
+ fine
37
+ remarkable
38
+ zipper
39
+ market
40
+ scare
41
+ laugh
42
+ extra-large
43
+ trail
44
+ middle
45
+ children
46
+ milk
47
+ oil
48
+ toy
49
+ drown
50
+ twist
51
+ muscle
52
+ cute
53
+ fanatical
54
+ building
55
+ tasteless
56
+ sack
57
+ tail
58
+ root
59
+ cattle
60
+ elbow
61
+ ragged
62
+ skin
63
+ itch
64
+ careless
65
+ hapless
66
+ impartial
67
+ profit
68
+ search
69
+ sail
70
+ hysterical
71
+ dare
72
+ harmony
73
+ tacit
74
+ spiky
75
+ delay
76
+ first
77
+ reminiscent
78
+ shop
79
+ pan
80
+ war
81
+ sand
82
+ clear
83
+ type
84
+ produce
85
+ cub
86
+ succeed
87
+ rainstorm
88
+ graceful
89
+ sweet
90
+ rate
91
+ recondite
92
+ drain
93
+ fact
94
+ homely
95
+ happy
96
+ aback
97
+ silent
98
+ grandfather
99
+ shrill
100
+ income
101
+ insect
102
+ garrulous
103
+ discreet
104
+ therapeutic
105
+ beef
106
+ miniature
107
+ snotty
108
+ foamy
109
+ large
110
+ periodic
111
+ spiffy
112
+ prepare
113
+ sneeze
114
+ refuse
115
+ fang
116
+ naive
117
+ own
118
+ marvelous
119
+ wine
120
+ minute
121
+ plantation
122
+ dream
123
+ top
124
+ smoggy
125
+ spotted
126
+ flashy
127
+ sofa
128
+ fruit
129
+ outgoing
130
+ flaky
131
+ repeat
132
+ abrasive
133
+ poised
134
+ floor
135
+ current
136
+ upset
137
+ nice
138
+ disapprove
139
+ juicy
140
+ wet
141
+ paste
142
+ whirl
143
+ flow
144
+ warm
145
+ abiding
146
+ wave
147
+ move
148
+ pedal
149
+ servant
150
+ route
151
+ meal
152
+ scandalous
153
+ noise
154
+ carpenter
155
+ anxious
156
+ milk
157
+ jobless
158
+ exultant
159
+ divide
160
+ worried
161
+ encourage
162
+ match
163
+ rejoice
164
+ hang
165
+ condition
166
+ quixotic
167
+ town
168
+ describe
169
+ rambunctious
170
+ vulgar
171
+ charge
172
+ psychedelic
173
+ grouchy
174
+ kick
175
+ festive
176
+ rob
177
+ modern
178
+ complete
179
+ stem
180
+ level
181
+ precede
182
+ rule
183
+ chew
184
+ sign
185
+ guess
186
+ known
187
+ upbeat
188
+ combative
189
+ tiger
190
+ damp
191
+ bounce
192
+ nine
193
+ communicate
194
+ corn
195
+ stingy
196
+ entertaining
197
+ fast
198
+ cover
199
+ icicle
200
+ order
201
+ force
202
+ living
203
+ lush
204
+ motion
205
+ flock
206
+ snow
207
+ eminent
208
+ wriggle
209
+ spiders
210
+ blade
211
+ lamp
212
+ time
213
+ desert
214
+ name
215
+ development
216
+ spectacular
217
+ egg
218
+ shade
219
+ nutty
220
+ nondescript
221
+ waste
222
+ equable
223
+ card
224
+ undress
225
+ callous
226
+ help
227
+ trees
228
+ symptomatic
229
+ cow
230
+ violent
231
+ wobble
232
+ harm
233
+ glove
234
+ premium
235
+ day
236
+ event
237
+ soap
238
+ gentle
239
+ tawdry
240
+ obedient
241
+ flash
242
+ rescue
243
+ grass
244
+ recognise
245
+ dramatic
246
+ test
247
+ vacation
248
+ concentrate
249
+ produce
250
+ flower
251
+ action
252
+ quiet
253
+ brown
254
+ zephyr
255
+ direction
256
+ scattered
257
+ flavor
258
+ flimsy
259
+ jazzy
260
+ workable
261
+ tip
262
+ nippy
263
+ shirt
264
+ tame
265
+ zonked
266
+ superficial
267
+ rely
268
+ boundless
269
+ wistful
270
+ evanescent
271
+ curious
272
+ joyous
273
+ uncle
274
+ far-flung
275
+ post
276
+ scrub
277
+ secretive
278
+ childlike
279
+ cultured
280
+ follow
281
+ inconclusive
282
+ hour
283
+ argument
284
+ ban
285
+ trick
286
+ fertile
287
+ watery
288
+ reaction
289
+ cumbersome
290
+ powder
291
+ voice
292
+ copy
293
+ interest
294
+ brash
295
+ door
296
+ lip
297
+ compete
298
+ inject
299
+ mist
300
+ smile
301
+ separate
302
+ butter
303
+ number
304
+ store
305
+ rot
306
+ dress
307
+ liquid
308
+ boot
309
+ two
310
+ educated
311
+ vigorous
312
+ sordid
313
+ return
314
+ kaput
315
+ fair
316
+ trade
317
+ party
318
+ water
319
+ heap
320
+ mind
321
+ cheese
322
+ freezing
323
+ material
324
+ unfasten
325
+ aboard
326
+ puffy
327
+ minister
328
+ nest
329
+ stiff
330
+ flowers
331
+ gather
332
+ black-and-white
333
+ worm
334
+ employ
335
+ mouth
336
+ majestic
337
+ alert
338
+ license
339
+ pat
340
+ clean
341
+ sassy
342
+ bewildered
343
+ harbor
344
+ sticky
345
+ bit
346
+ agreement
347
+ scissors
348
+ country
349
+ sound
350
+ smash
351
+ expert
352
+ whole
353
+ acceptable
354
+ spicy
355
+ knowledge
356
+ shoe
357
+ trip
358
+ fog
359
+ mere
360
+ tow
361
+ houses
362
+ victorious
363
+ whine
364
+ view
365
+ dapper
366
+ tart
367
+ office
368
+ snake
369
+ end
370
+ wrap
371
+ coil
372
+ linen
373
+ hate
374
+ quaint
375
+ rice
376
+ subdued
377
+ quiver
378
+ tranquil
379
+ start
380
+ turn
381
+ nappy
382
+ selective
383
+ uneven
384
+ incredible
385
+ popcorn
386
+ voyage
387
+ wary
388
+ irritate
389
+ pipe
390
+ shock
391
+ tiresome
392
+ judicious
393
+ window
394
+ dispensable
395
+ front
396
+ tenuous
397
+ chief
398
+ eager
399
+ salt
400
+ belong
401
+ dusty
402
+ travel
403
+ tidy
404
+ noiseless
405
+ needless
406
+ free
407
+ stereotyped
408
+ astonishing
409
+ sister
410
+ shy
411
+ statuesque
412
+ excuse
413
+ things
414
+ straight
415
+ one
416
+ paltry
417
+ huge
418
+ interesting
419
+ evasive
420
+ thankful
421
+ cough
422
+ devilish
423
+ nod
424
+ curvy
425
+ skinny
426
+ excited
427
+ public
428
+ sniff
429
+ pastoral
430
+ past
431
+ extra-small
432
+ call
433
+ realise
434
+ five
435
+ mate
436
+ signal
437
+ quiet
438
+ teeth
439
+ cough
440
+ massive
441
+ blow
442
+ wiggly
443
+ birds
444
+ sleet
445
+ craven
446
+ snakes
447
+ exclusive
448
+ kiss
449
+ witty
450
+ edge
451
+ sigh
452
+ finicky
453
+ chop
454
+ bubble
455
+ spiritual
456
+ glamorous
457
+ suffer
458
+ intend
459
+ future
460
+ unhealthy
461
+ snobbish
462
+ request
463
+ panoramic
464
+ permit
465
+ eggnog
466
+ dear
467
+ school
468
+ agree
469
+ invent
470
+ enchanted
471
+ overflow
472
+ ashamed
473
+ bored
474
+ frightened
475
+ face
476
+ rock
477
+ tempt
478
+ beginner
479
+ wool
480
+ aromatic
481
+ adjustment
482
+ discover
483
+ receptive
484
+ lame
485
+ fluttering
486
+ afterthought
487
+ perpetual
488
+ jelly
489
+ ski
490
+ health
491
+ obsequious
492
+ boat
493
+ reject
494
+ unite
495
+ mysterious
496
+ closed
497
+ fantastic
498
+ belligerent
499
+ overt
500
+ invention
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "humpass"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/humpass ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+
3
+
4
+ require "optionparser"
5
+
6
+ options = {}
7
+
8
+ OptionParser.new do |opts|
9
+ opts.banner = "Usage: humpass [options]"
10
+
11
+ opts.on("-h", "--help", "Prints this help") do
12
+ puts opts
13
+ exit
14
+ end
15
+
16
+ opts.on("-d","--database [DATABASE]", "Initiate a new password DB on specified directory") do |path|
17
+ options[:database_path] = path
18
+ end
19
+
20
+ opts.on("-c","--createpass [PLACE]", "Generates a password for a place") do |place|
21
+ options[:place] = place
22
+ end
23
+
24
+ opts.on("-g","--getepass [PLACE]", "Gets password from place") do |place|
25
+ options[:get_pass] = place
26
+ end
27
+
28
+ opts.on("-l","--list", "List Passwords") do |list|
29
+ options[:list] = list
30
+ end
31
+ end.parse!
32
+
33
+ options[:masterpass] = `read -s -p "Password: " password; echo $password`.chomp
34
+ print "\n"
35
+ abort 'No Password Provided' if options[:masterpass] == ""
36
+
37
+ options[:database_path] ||= __dir__ + '/humpass.dat'
38
+
39
+ require 'humpass'
40
+
41
+ Humpass.configure do |config|
42
+ config.master_password = options[:masterpass]
43
+ config.database_path = options[:database_path]
44
+ end
45
+
46
+ Humpass.set_data_structure
47
+
48
+ if options.has_key?(:place)
49
+ print "#{options[:place]}: #{Humpass.generate_password(options[:place])}\n"
50
+ end
51
+
52
+ if options.has_key?(:get_pass)
53
+ print "#{options[:get_pass]}: #{Humpass.get_password(options[:get_pass])}\n"
54
+ end
55
+
56
+ if options.has_key?(:list)
57
+ Humpass.list_passwords.each do |password|
58
+ print"#{password.first}: #{password.last} \n"
59
+ end
60
+ end
data/humpass.gemspec ADDED
@@ -0,0 +1,36 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "humpass/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "humpass"
8
+ spec.version = Humpass::VERSION
9
+ spec.authors = ["Gabriel Hamdan"]
10
+ spec.email = ["ghamdan.eng@gmail.com"]
11
+
12
+ spec.summary = %q{Ruby Application for Storing Passwords}
13
+ spec.description = %q{Ruby Application for Creating random passwords and storing them secured.}
14
+ spec.homepage = "https://github.com/Hamdan85/humpass"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "'https://rubygems.org'"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against " \
23
+ # "public gem pushes."
24
+ # end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.16.a"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rspec", "~> 3.0"
36
+ end
@@ -0,0 +1,22 @@
1
+ module Humpass
2
+ class << self
3
+ attr_accessor :configuration
4
+ end
5
+
6
+ def self.initial_setup(master_password = nil)
7
+ set_database(configuration.database_path)
8
+ set_data_structure
9
+ self
10
+ end
11
+
12
+ def self.configure
13
+ self.configuration ||= Configuration.new
14
+ yield(configuration)
15
+ initial_setup(configuration.master_password)
16
+ end
17
+
18
+ # Configuration
19
+ class Configuration
20
+ attr_accessor :master_password, :database_path
21
+ end
22
+ end
@@ -0,0 +1,113 @@
1
+ module Humpass
2
+
3
+ class << self
4
+ attr_accessor :data_structure
5
+ end
6
+
7
+ def self.set_data_structure
8
+ self.data_structure = DataStructure.new
9
+ end
10
+
11
+ class DataStructure
12
+ attr_accessor :structure
13
+
14
+ def initialize
15
+ raise 'Configuration not sat!' if Humpass.configuration.nil?
16
+ new_database_initialize if database.read.empty?
17
+ get_structure_from_database
18
+ Humpass.set_lock_words(self.lock_words)
19
+ end
20
+
21
+ def new_database_initialize
22
+ @structure = init_structure
23
+ update_database
24
+ end
25
+
26
+ def init_structure
27
+ {
28
+ master_password: Digest::SHA2.new(256).hexdigest(Humpass.configuration.master_password),
29
+ lock_words: Humpass::LockWord.new.words,
30
+ passwords: []
31
+ }
32
+ end
33
+
34
+ def master_password=(master_password)
35
+ @structure["master_password"] = Digest::SHA2.new(256).hexdigest(master_password)
36
+ update_database
37
+ end
38
+
39
+ def master_password
40
+ @structure["master_password"]
41
+ end
42
+
43
+ def lock_words=(lock_words)
44
+ @structure["lock_words"] = lock_words
45
+ update_database
46
+ end
47
+
48
+ def lock_words
49
+ @structure["lock_words"]
50
+ end
51
+
52
+ def passwords=(passwords)
53
+ @structure["passwords"] = passwords
54
+ update_database
55
+ end
56
+
57
+ def passwords
58
+ @structure["passwords"]
59
+ end
60
+
61
+ def add_password(place, password)
62
+ if self.passwords.select { |password| password.first.eql?(place) }.empty?
63
+ self.passwords << [place, password.encrypt(self.master_password)]
64
+ update_database
65
+ else
66
+ if authorize_replacement?
67
+ remove_place(place)
68
+ add_password(place, password)
69
+ else
70
+ abort('OK!')
71
+ end
72
+ end
73
+ end
74
+
75
+ def get_password(place)
76
+ place = self.passwords.detect { |password| password.first.eql?(place) }
77
+ if place
78
+ place.last.decrypt(self.master_password)
79
+ else
80
+ "Place Not Found!"
81
+ end
82
+ end
83
+
84
+ def list_passwords
85
+ passwords.map{|password| [password.first, password.last.decrypt(self.master_password)]}
86
+ end
87
+
88
+ def get_structure_from_database
89
+ database_read = database.read
90
+ @structure = database_read.empty? ? '' : JSON.parse(database.read)
91
+ end
92
+
93
+ def remove_place(place)
94
+ self.passwords.delete_if { |password| password.first.eql?(place) }
95
+ update_database
96
+ end
97
+
98
+ def update_database
99
+ database.write(@structure.to_json)
100
+ end
101
+
102
+ def database
103
+ Humpass.database
104
+ end
105
+
106
+ def authorize_replacement?
107
+ puts "This place seems to be already registered. Overwrite?[Y/n]"
108
+ overwrite = gets.chomp
109
+ authorize_replacement? unless %w[Y n].include?(overwrite)
110
+ overwrite.eql?('Y') ? true : false
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,58 @@
1
+ require "base64"
2
+ require "json"
3
+
4
+ module Humpass
5
+
6
+ class << self
7
+ attr_accessor :database
8
+ end
9
+
10
+ def self.set_database(file_path = nil)
11
+ self.database ||= Database.new(file_path)
12
+ end
13
+
14
+ class Database
15
+ attr_accessor :file_path
16
+ def initialize(file_path = __dir__ + '/humpass.dat')
17
+ raise 'Configuration not sat!' if Humpass.configuration.nil?
18
+ @file_path = file_path
19
+ end
20
+
21
+ def write(data)
22
+ File.open(file_path, 'w+') { |file|
23
+ file.write(encrypt(database_password, Base64.encode64(data)))
24
+ }
25
+ end
26
+
27
+ def read
28
+ begin
29
+ Base64.decode64(decrypt(database_password, File.open(file_path, 'r').read))
30
+ rescue
31
+ ''
32
+ end
33
+ end
34
+
35
+ def database_password
36
+ Humpass.configuration.master_password = gets.chomp if Humpass.configuration.master_password.nil?
37
+ Humpass.configuration.master_password
38
+ end
39
+
40
+ def encrypt(key, data)
41
+ cipher = OpenSSL::Cipher::AES.new(128, :CBC).encrypt
42
+ cipher.key = Digest::SHA2.hexdigest(key)[0..15]
43
+ cipher.update(data) + cipher.final
44
+ end
45
+
46
+ def decrypt(key, data)
47
+ cipher = OpenSSL::Cipher::AES.new(128, :CBC).decrypt
48
+ cipher.key = Digest::SHA2.hexdigest(key)[0..15]
49
+ s = data.unpack("C*").pack("c*")
50
+
51
+ begin
52
+ s.empty? ? "" : cipher.update(s) + cipher.final
53
+ rescue
54
+ abort("Wrong Master Password!")
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,19 @@
1
+ require 'openssl'
2
+
3
+ class String
4
+ def encrypt(key)
5
+ cipher = OpenSSL::Cipher::AES.new(128, :CBC).encrypt
6
+ cipher.key = Digest::SHA2.hexdigest(key)[0..15]
7
+ s = cipher.update(self) + cipher.final
8
+
9
+ s.unpack('H*')[0].upcase
10
+ end
11
+
12
+ def decrypt(key)
13
+ cipher = OpenSSL::Cipher::AES.new(128, :CBC).decrypt
14
+ cipher.key = Digest::SHA2.hexdigest(key)[0..15]
15
+ s = [self].pack("H*").unpack("C*").pack("c*")
16
+
17
+ cipher.update(s) + cipher.final
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Humpass
2
+ class << self
3
+ attr_accessor :lockwords
4
+ end
5
+
6
+ def self.set_lock_words(lock_words)
7
+ self.lockwords = lock_words
8
+ end
9
+
10
+ # LockWord
11
+ class LockWord
12
+ attr_reader :words
13
+ def initialize
14
+ @words = File.readlines('assets/words.txt')
15
+ .sample(15)
16
+ .map { |w| w.strip }
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,8 @@
1
+ require 'securerandom'
2
+ module Humpass
3
+ module PasswordGenerator
4
+ def self.generate_password
5
+ SecureRandom.base64(15)
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module Humpass
2
+ VERSION = "0.1.0"
3
+ end
data/lib/humpass.rb ADDED
@@ -0,0 +1,30 @@
1
+ require "humpass/version"
2
+ require "awesome_print"
3
+
4
+ module Humpass
5
+ require "humpass/configuration"
6
+ require "humpass/encrypter"
7
+ require "humpass/password_generator"
8
+ require "humpass/lock_word"
9
+ require "humpass/database"
10
+ require "humpass/data_structure"
11
+
12
+ def self.generate_password(place)
13
+ password = Humpass::PasswordGenerator.generate_password
14
+ Humpass.data_structure.add_password(place, password)
15
+ password
16
+ end
17
+
18
+ def self.get_password(place)
19
+ Humpass.data_structure.get_password(place)
20
+ end
21
+
22
+ def self.list_passwords
23
+ Humpass.data_structure.list_passwords
24
+ end
25
+ end
26
+
27
+ # Humpass.configure do |config|
28
+ # config.master_password = '1234567890'
29
+ # config.database_path = './humpass.dat'
30
+ # end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: humpass
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gabriel Hamdan
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-12-11 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.16.a
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.16.a
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: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: Ruby Application for Creating random passwords and storing them secured.
56
+ email:
57
+ - ghamdan.eng@gmail.com
58
+ executables:
59
+ - humpass
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".DS_Store"
64
+ - ".gitignore"
65
+ - ".idea/.rakeTasks"
66
+ - ".idea/misc.xml"
67
+ - ".idea/modules.xml"
68
+ - ".idea/vcs.xml"
69
+ - ".rspec"
70
+ - ".travis.yml"
71
+ - CODE_OF_CONDUCT.md
72
+ - Gemfile
73
+ - Gemfile.lock
74
+ - LICENSE.txt
75
+ - README.md
76
+ - Rakefile
77
+ - assets/words.txt
78
+ - bin/console
79
+ - bin/setup
80
+ - exe/humpass
81
+ - humpass.gemspec
82
+ - lib/humpass.rb
83
+ - lib/humpass/configuration.rb
84
+ - lib/humpass/data_structure.rb
85
+ - lib/humpass/database.rb
86
+ - lib/humpass/encrypter.rb
87
+ - lib/humpass/lock_word.rb
88
+ - lib/humpass/password_generator.rb
89
+ - lib/humpass/version.rb
90
+ homepage: https://github.com/Hamdan85/humpass
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.6.13
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Ruby Application for Storing Passwords
114
+ test_files: []