shh 0.1.0 → 0.1.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.
- data/README.rdoc +14 -14
- data/lib/shh/entries_menu.rb +5 -4
- data/lib/shh/entry_menu.rb +38 -12
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -6,7 +6,7 @@ This is a command line utility for managing secure information such as accounts,
|
|
6
6
|
|
7
7
|
You won't be hiding anything from the NSA with this level of encryption so it isn't recommended that you make your repository publicly accessible.
|
8
8
|
|
9
|
-
Now with more tab completion!
|
9
|
+
Now with more tab completion and multi line editing!
|
10
10
|
|
11
11
|
= Usage
|
12
12
|
|
@@ -48,40 +48,41 @@ This mode allows you to view and edit 'entries' (which are encrypted hashes stor
|
|
48
48
|
rememberthemilk (a499f612-d034-4e49-82a8-6967d29653a1)
|
49
49
|
|
50
50
|
* list - list entries
|
51
|
-
* edit
|
52
|
-
* view
|
51
|
+
* edit <name> - edit or create entry
|
52
|
+
* view <name> - view entry
|
53
53
|
* quit
|
54
54
|
|
55
55
|
== Viewing mode
|
56
56
|
|
57
57
|
This mode allows you to view (but not edit) an existing entry
|
58
58
|
|
59
|
-
> view
|
59
|
+
> view bitbucket
|
60
60
|
(bitbucket) > list
|
61
61
|
id,name,password,username
|
62
|
-
(bitbucket) > view
|
62
|
+
(bitbucket) > view username
|
63
63
|
markryall
|
64
64
|
|
65
65
|
list keys, show key, copy key or quit? c password
|
66
66
|
|
67
67
|
* list - show entry keys
|
68
|
-
* view
|
69
|
-
* copy
|
70
|
-
* launch
|
68
|
+
* view <key> - view entry value on screen
|
69
|
+
* copy <key> - copy entry value to clipboard
|
70
|
+
* launch <key> - launch entry value in default browser (available if it starts with http)
|
71
71
|
* quit
|
72
72
|
|
73
73
|
== Editing mode
|
74
74
|
|
75
75
|
This mode is viewing mode plus some editing commands
|
76
76
|
|
77
|
-
> edit
|
78
|
-
(bitbucket) >
|
77
|
+
> edit bitbucket
|
78
|
+
(bitbucket) > set foo
|
79
79
|
Enter new value for foo
|
80
80
|
bar
|
81
|
-
(bitbucket) > delete
|
81
|
+
(bitbucket) > delete foo
|
82
82
|
|
83
|
-
* edit
|
84
|
-
*
|
83
|
+
* edit <key> - edit or create key using text editor (notepad or EDITOR)
|
84
|
+
* set <key> - edit or create key from prompt
|
85
|
+
* delete <key> - remove a key
|
85
86
|
|
86
87
|
== Quitting mode
|
87
88
|
|
@@ -91,6 +92,5 @@ You don't want to be a quitter
|
|
91
92
|
|
92
93
|
* Add some color
|
93
94
|
* Add help
|
94
|
-
* Add multi line values (edit with default text editor)
|
95
95
|
* Include uuid as part of encryption key (and upgrade encryption on existing entries)
|
96
96
|
* add some source control (hg/git) commands
|
data/lib/shh/entries_menu.rb
CHANGED
@@ -22,9 +22,9 @@ module Shh
|
|
22
22
|
refresh
|
23
23
|
when 'list'
|
24
24
|
@entries.sort.each {|entry| say entry }
|
25
|
-
when /^view
|
25
|
+
when /^view (.*)/
|
26
26
|
view $1
|
27
|
-
when /^edit
|
27
|
+
when /^edit (.*)/
|
28
28
|
edit $1
|
29
29
|
end
|
30
30
|
puts
|
@@ -40,12 +40,13 @@ module Shh
|
|
40
40
|
@entries = []
|
41
41
|
@repository.each_entry do |entry|
|
42
42
|
@entries << "#{entry['name']} (#{entry['id']})"
|
43
|
-
commands << "edit
|
44
|
-
commands << "view
|
43
|
+
commands << "edit #{entry['name']}"
|
44
|
+
commands << "view #{entry['name']}"
|
45
45
|
end
|
46
46
|
Readline.completion_proc = lambda do |text|
|
47
47
|
commands.grep( /^#{Regexp.escape(text)}/ ).sort
|
48
48
|
end
|
49
|
+
Readline.completer_word_break_characters = ''
|
49
50
|
end
|
50
51
|
|
51
52
|
def edit name
|
data/lib/shh/entry_menu.rb
CHANGED
@@ -20,15 +20,17 @@ module Shh
|
|
20
20
|
return @hash
|
21
21
|
when 'list'
|
22
22
|
say(@hash.keys.sort.join(','))
|
23
|
-
when /^
|
23
|
+
when /^set (.*)/
|
24
|
+
set $1
|
25
|
+
when /^edit (.*)/
|
24
26
|
edit $1
|
25
|
-
when /^copy
|
27
|
+
when /^copy (.*)/
|
26
28
|
copy $1
|
27
|
-
when /^launch
|
29
|
+
when /^launch (.*)/
|
28
30
|
launch $1
|
29
|
-
when /^delete
|
31
|
+
when /^delete (.*)/
|
30
32
|
delete $1
|
31
|
-
when /^view
|
33
|
+
when /^view (.*)/
|
32
34
|
view $1
|
33
35
|
end
|
34
36
|
end
|
@@ -62,9 +64,16 @@ private
|
|
62
64
|
@clipboard.content = @hash[key] if can_copy?(key)
|
63
65
|
end
|
64
66
|
|
67
|
+
def set key
|
68
|
+
if can_edit?
|
69
|
+
set_value key
|
70
|
+
refresh
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
65
74
|
def edit key
|
66
75
|
if can_edit?
|
67
|
-
|
76
|
+
edit_value key
|
68
77
|
refresh
|
69
78
|
end
|
70
79
|
end
|
@@ -83,19 +92,36 @@ private
|
|
83
92
|
def refresh
|
84
93
|
commands = ['list', 'quit']
|
85
94
|
@hash.keys.each do |key|
|
86
|
-
commands << "edit
|
87
|
-
commands << "
|
88
|
-
commands << "
|
89
|
-
commands << "
|
90
|
-
commands << "
|
95
|
+
commands << "edit #{key}" if can_edit?
|
96
|
+
commands << "set #{key}" if can_edit?
|
97
|
+
commands << "delete #{key}" if can_edit?
|
98
|
+
commands << "view #{key}"
|
99
|
+
commands << "copy #{key}" if can_copy?(key)
|
100
|
+
commands << "launch #{key}" if can_launch?(key)
|
91
101
|
end
|
92
102
|
Readline.completion_proc = lambda do |text|
|
93
103
|
commands.grep( /^#{Regexp.escape(text)}/ ).sort
|
94
104
|
end
|
105
|
+
Readline.completer_word_break_characters = ''
|
95
106
|
end
|
96
107
|
|
97
108
|
def new_value key
|
98
|
-
@prompt.get
|
109
|
+
new_value = @prompt.get("Enter new value for #{key}", :silent => (key =~ /pass/))
|
110
|
+
@hash[key] = new_value if new_value.length > 0
|
111
|
+
end
|
112
|
+
|
113
|
+
def edit_value key
|
114
|
+
tmp_file = Pathname.new("key.tmp")
|
115
|
+
begin
|
116
|
+
tmp_file.open('w') { |out| out.print @hash[key] }
|
117
|
+
editor = ENV["EDITOR"] || "notepad"
|
118
|
+
system("#{editor} key.tmp")
|
119
|
+
return unless $?.to_i == 0
|
120
|
+
new_value = tmp_file.read
|
121
|
+
@hash[key] = new_value if new_value.length > 0
|
122
|
+
ensure
|
123
|
+
tmp_file.unlink
|
124
|
+
end
|
99
125
|
end
|
100
126
|
end
|
101
127
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Ryall
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-29 00:00:00 +11:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|