pwss 0.5.1 → 0.6.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 +4 -4
- data/.gitignore +9 -18
- data/.travis.yml +4 -0
- data/LICENSE.txt +17 -18
- data/README.md +454 -0
- data/Rakefile +9 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/pwss +6 -0
- data/lib/pwss.rb +17 -127
- data/lib/pwss/cipher.rb +11 -74
- data/lib/pwss/cli/command_semantics.rb +402 -0
- data/lib/pwss/cli/command_syntax.rb +156 -0
- data/lib/pwss/fileops.rb +31 -22
- data/lib/pwss/generators/bank_account.rb +18 -0
- data/lib/pwss/generators/code.rb +13 -0
- data/lib/pwss/generators/credit_card.rb +23 -0
- data/lib/pwss/generators/entry.rb +36 -0
- data/lib/pwss/generators/fields.rb +119 -0
- data/lib/pwss/generators/sim.rb +15 -0
- data/lib/pwss/generators/software_license.rb +19 -0
- data/lib/pwss/password.rb +94 -0
- data/lib/pwss/safe.rb +183 -0
- data/lib/pwss/version.rb +1 -1
- data/pwss.gemspec +19 -13
- metadata +85 -25
- data/README.textile +0 -190
- data/bin/pwss +0 -445
- data/lib/pwss/bank_account.rb +0 -18
- data/lib/pwss/credit_card.rb +0 -23
- data/lib/pwss/entry.rb +0 -69
- data/lib/pwss/software_license.rb +0 -21
data/lib/pwss/bank_account.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'pwss/entry'
|
2
|
-
|
3
|
-
module Pwss
|
4
|
-
class BankAccount < Entry
|
5
|
-
def initialize
|
6
|
-
super
|
7
|
-
@fields = {
|
8
|
-
"title" => ["Readline.readline('title: ')", "'title'"],
|
9
|
-
"name" => ["Readline.readline('name: ')", "'name'"],
|
10
|
-
"iban" => ["Readline.readline('iban: ')", "ITkk xaaa aabb bbbc cccc cccc ccc"],
|
11
|
-
"created_at" => ["", "Date.today"],
|
12
|
-
"updated_at" => ["", "nil"],
|
13
|
-
"url" => ["Readline.readline('url: ')", "''"],
|
14
|
-
"description" => ["get_lines", "''"]
|
15
|
-
}
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/lib/pwss/credit_card.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'pwss/entry'
|
2
|
-
|
3
|
-
module Pwss
|
4
|
-
class CreditCard < Entry
|
5
|
-
def initialize
|
6
|
-
super
|
7
|
-
@fields = {
|
8
|
-
"title" => ["Readline.readline('title: ')", "'title'"],
|
9
|
-
"issuer" => ["Readline.readline('issuer: ')", "MasterCard"],
|
10
|
-
"name_on_card" => ["Readline.readline('name on card: ')", "'john doe'"],
|
11
|
-
"card_number" => ["Readline.readline('number: ')", "000-0000-0000-0000"],
|
12
|
-
"valid_from" => ["Readline.readline('valid from: ')", "Sep 2014"],
|
13
|
-
"valid_till" => ["Readline.readline('valid till: ')", "Sep 2018"],
|
14
|
-
"verification_number" => ["Readline.readline('verification number: ')", "000"],
|
15
|
-
"pin" => ["Readline.readline('pin: ')", "0000"],
|
16
|
-
"created_at" => ["", "Date.today"],
|
17
|
-
"updated_at" => ["", "nil"],
|
18
|
-
"url" => ["Readline.readline('url: ')", "''"],
|
19
|
-
"notes" => ["get_lines", "''"]
|
20
|
-
}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/lib/pwss/entry.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'readline'
|
2
|
-
require 'pwss/cipher'
|
3
|
-
require 'date'
|
4
|
-
|
5
|
-
module Pwss
|
6
|
-
#
|
7
|
-
# Entry manages an entry in the password safe
|
8
|
-
# It is a wrapper to a Hash
|
9
|
-
#
|
10
|
-
class Entry
|
11
|
-
INPUT_F = 0
|
12
|
-
DEFAULT = 1
|
13
|
-
|
14
|
-
attr_reader :entry, :fields
|
15
|
-
|
16
|
-
def initialize
|
17
|
-
@entry = Hash.new
|
18
|
-
|
19
|
-
# the fields of an entry, together with:
|
20
|
-
# - the function to ask the value
|
21
|
-
# - the default value
|
22
|
-
@fields = {
|
23
|
-
"title" => ["Readline.readline('title: ')", "'title'"],
|
24
|
-
"username" => ["Readline.readline('username: ')", "''"],
|
25
|
-
"password" => ["Cipher.check_or_generate('password for entry', length, alnum)", "''"],
|
26
|
-
"created_at" => ["", "Date.today"],
|
27
|
-
"updated_at" => ["", "nil"],
|
28
|
-
"url" => ["Readline.readline('url: ')", "''"],
|
29
|
-
"description" => ["get_lines", "''"]
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
# interactively ask from command line all fields specified in FIELDS
|
34
|
-
# arguments length and alnum are for password generation
|
35
|
-
def ask length = 8, alnum = true, overrides = {}
|
36
|
-
@fields.merge! overrides
|
37
|
-
@fields.keys.each do |key|
|
38
|
-
value = eval @fields[key][INPUT_F]
|
39
|
-
if value == nil or value == "" then
|
40
|
-
@entry[key] = eval @fields[key][DEFAULT]
|
41
|
-
else
|
42
|
-
@entry[key] = value
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
# initialize all fields with the default values
|
48
|
-
# (and set title to the argument)
|
49
|
-
# def set_fields title
|
50
|
-
# fields.keys.each do |k|
|
51
|
-
# @entry[k] = eval(fields[k][DEFAULT])
|
52
|
-
# end
|
53
|
-
# @entry['title'] = title
|
54
|
-
# end
|
55
|
-
|
56
|
-
# read n-lines (terminated by a ".")
|
57
|
-
def get_lines
|
58
|
-
puts "description (terminate with '.'):"
|
59
|
-
lines = []
|
60
|
-
line = ""
|
61
|
-
until line == "."
|
62
|
-
line = Readline.readline
|
63
|
-
lines << line
|
64
|
-
end
|
65
|
-
lines.join("\n")
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'pwss/entry'
|
2
|
-
|
3
|
-
module Pwss
|
4
|
-
class SoftwareLicense < Entry
|
5
|
-
def initialize
|
6
|
-
super
|
7
|
-
@fields = {
|
8
|
-
"title" => ["Readline.readline('title: ')", "'title'"],
|
9
|
-
"version" => ["Readline.readline('version: ')", "0.0.1"],
|
10
|
-
"license_number" => ["Readline.readline('license number: ')", "000-0000-0000-0000"],
|
11
|
-
"licensed_to" => ["Readline.readline('licensed to: ')", "'John Doe'"],
|
12
|
-
"email" => ["Readline.readline('email: ')", "jdoe@example.com"],
|
13
|
-
"purchased_on" => ["Readline.readline('purchased on: ')", "'Date.today'"],
|
14
|
-
"created_at" => ["", "Date.today"],
|
15
|
-
"updated_at" => ["", "nil"],
|
16
|
-
"url" => ["Readline.readline('url: ')", "''"],
|
17
|
-
"notes" => ["get_lines", "''"]
|
18
|
-
}
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|