thieve 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/thieve +4 -4
- data/lib/thieve/key_info.rb +19 -19
- data/lib/thieve.rb +16 -16
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 296ca24daa54e8188d73f8dfc0dc6b1c13c7fc10
|
4
|
+
data.tar.gz: 503d73205205cd6f28bc23f0b8898ca995b87f5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78d3fb2391a5986023f1b2f01b8e5db51270182bcde302a57c87726e6e96529a60347cef15e122db43428bb7aaa70ddeaeb085869b88429a1f8a3b8775310fbc
|
7
|
+
data.tar.gz: a30840cd25adc12836d75074b4dce8b2d8a948cf8146d721d5332e97e9c5b043d754bec38774c434e8e742809583e3dea3e85887c83badf0367a77525adeedff
|
data/bin/thieve
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "hilighter"
|
4
4
|
require "io/wait"
|
5
5
|
require "optparse"
|
6
6
|
require "thieve"
|
@@ -31,7 +31,7 @@ def parse(args)
|
|
31
31
|
|
32
32
|
opts.on("", "DESCRIPTION")
|
33
33
|
|
34
|
-
info.scan(/\S.{0
|
34
|
+
info.scan(/\S.{0,76}\S(?=\s|$)|\S+/).each do |line|
|
35
35
|
opts.on(" #{line}")
|
36
36
|
end
|
37
37
|
|
@@ -51,7 +51,7 @@ def parse(args)
|
|
51
51
|
end
|
52
52
|
|
53
53
|
opts.on("--nocolor", "Disable colorized output") do
|
54
|
-
|
54
|
+
Hilighter.disable
|
55
55
|
end
|
56
56
|
|
57
57
|
opts.on(
|
@@ -96,7 +96,7 @@ end
|
|
96
96
|
options = parse(ARGV)
|
97
97
|
|
98
98
|
begin
|
99
|
-
thieve = Thieve.new(!
|
99
|
+
thieve = Thieve.new(!Hilighter.disable?)
|
100
100
|
options["dirs"].each do |dir|
|
101
101
|
thieve.steal_from(dir)
|
102
102
|
end
|
data/lib/thieve/key_info.rb
CHANGED
@@ -24,36 +24,36 @@ class Thieve::KeyInfo
|
|
24
24
|
# Type of key/cert
|
25
25
|
attr_reader :type
|
26
26
|
|
27
|
-
def
|
28
|
-
|
27
|
+
def export(directory)
|
28
|
+
FileUtils.mkdir_p(directory)
|
29
|
+
File.open("#{directory}/#{@fingerprint}.#{@ext}", "w") do |f|
|
30
|
+
f.write(@key)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def hilight_file(file = @file)
|
35
|
+
return file if (!Thieve.hilight?)
|
29
36
|
return file.to_s.light_blue
|
30
37
|
end
|
31
|
-
private :
|
38
|
+
private :hilight_file
|
32
39
|
|
33
|
-
def
|
34
|
-
return key if (!Thieve.
|
40
|
+
def hilight_key(key = @key)
|
41
|
+
return key if (!Thieve.hilight?)
|
35
42
|
return key.split("\n").map do |line|
|
36
43
|
line.light_white
|
37
44
|
end.join("\n")
|
38
45
|
end
|
39
|
-
private :
|
46
|
+
private :hilight_key
|
40
47
|
|
41
|
-
def
|
48
|
+
def hilight_match(match = @match)
|
42
49
|
return "" if (match.nil?)
|
43
|
-
return "Matches #{match}" if (!Thieve.
|
50
|
+
return "Matches #{match}" if (!Thieve.hilight?)
|
44
51
|
return [
|
45
52
|
"Matches".light_blue,
|
46
53
|
match.light_green
|
47
54
|
].join(" ")
|
48
55
|
end
|
49
|
-
private :
|
50
|
-
|
51
|
-
def export(directory)
|
52
|
-
FileUtils.mkdir_p(directory)
|
53
|
-
File.open("#{directory}/#{@fingerprint}.#{@ext}", "w") do |f|
|
54
|
-
f.write(@key)
|
55
|
-
end
|
56
|
-
end
|
56
|
+
private :hilight_match
|
57
57
|
|
58
58
|
def initialize(file, type, key)
|
59
59
|
@ext = type.gsub(/ +/, ".").downcase
|
@@ -153,9 +153,9 @@ class Thieve::KeyInfo
|
|
153
153
|
|
154
154
|
def to_s
|
155
155
|
ret = Array.new
|
156
|
-
ret.push(
|
157
|
-
ret.push(
|
158
|
-
ret.push(
|
156
|
+
ret.push(hilight_file)
|
157
|
+
ret.push(hilight_key)
|
158
|
+
ret.push(hilight_match) if (@match)
|
159
159
|
return ret.join("\n")
|
160
160
|
end
|
161
161
|
end
|
data/lib/thieve.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require "
|
1
|
+
require "hilighter"
|
2
2
|
require "io/wait"
|
3
3
|
require "json"
|
4
4
|
require "pathname"
|
@@ -7,17 +7,6 @@ require "scoobydoo"
|
|
7
7
|
class Thieve
|
8
8
|
attr_accessor :loot
|
9
9
|
|
10
|
-
def self.colorize?
|
11
|
-
@@colorize ||= false
|
12
|
-
return @@colorize
|
13
|
-
end
|
14
|
-
|
15
|
-
def colorize_type(type)
|
16
|
-
return type if (!@@colorize)
|
17
|
-
return type.light_cyan
|
18
|
-
end
|
19
|
-
private :colorize_type
|
20
|
-
|
21
10
|
def export_loot(dir)
|
22
11
|
exported = Hash.new
|
23
12
|
@loot.each do |type, keys|
|
@@ -61,7 +50,7 @@ class Thieve
|
|
61
50
|
Thieve::KeyInfo.new(file, type, keydata)
|
62
51
|
)
|
63
52
|
rescue Exception => e
|
64
|
-
if (@@
|
53
|
+
if (@@hilight)
|
65
54
|
$stderr.puts file.to_s.light_blue
|
66
55
|
keydata.each_line do |line|
|
67
56
|
$stderr.puts line.strip.light_yellow
|
@@ -99,12 +88,23 @@ class Thieve
|
|
99
88
|
end
|
100
89
|
end
|
101
90
|
|
102
|
-
def
|
91
|
+
def self.hilight?
|
92
|
+
@@hilight ||= false
|
93
|
+
return @@hilight
|
94
|
+
end
|
95
|
+
|
96
|
+
def hilight_type(type)
|
97
|
+
return type if (!@@hilight)
|
98
|
+
return type.light_cyan
|
99
|
+
end
|
100
|
+
private :hilight_type
|
101
|
+
|
102
|
+
def initialize(hilight = false)
|
103
103
|
if (ScoobyDoo.where_are_you("gpg").nil?)
|
104
104
|
raise Thieve::Error::ExecutableNotFound.new("gpg")
|
105
105
|
end
|
106
106
|
|
107
|
-
@@
|
107
|
+
@@hilight = hilight
|
108
108
|
@loot = Hash.new
|
109
109
|
end
|
110
110
|
|
@@ -129,7 +129,7 @@ class Thieve
|
|
129
129
|
def summarize_loot
|
130
130
|
ret = Array.new
|
131
131
|
@loot.each do |type, keys|
|
132
|
-
ret.push(
|
132
|
+
ret.push(hilight_type(type))
|
133
133
|
keys.each do |key|
|
134
134
|
ret.push("#{key.to_s}\n")
|
135
135
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thieve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Whittaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -31,25 +31,25 @@ dependencies:
|
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 10.5.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: hilighter
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.1'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.1.0
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '0.
|
49
|
+
version: '0.1'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 0.
|
52
|
+
version: 0.1.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: scoobydoo
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|