thieve 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/thieve +13 -3
- data/lib/thieve.rb +18 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c60bd1bbcf6c73e7494c032d3b770810bc0b3344
|
4
|
+
data.tar.gz: a8a1f1d9b24c06b3500b7334e0e9de77475c3e4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb088f7cc57316042955e1d4c58f4b1e515e668c82939f5cf7830b77ce5eda90eeca1a2bbfc725f5ea7008d4133741c9b7a4cefa15fbebb8a8d5156a95b40cef
|
7
|
+
data.tar.gz: e4a33545425fc352078a1f11adab1b604420e9a018d9bc49b8fc64da9536d1645fc53210e31c2f3c8f895141e57aa46042ab528b1ece840429f14f02e92e1c4c
|
data/bin/thieve
CHANGED
@@ -17,6 +17,7 @@ end
|
|
17
17
|
|
18
18
|
def parse(args)
|
19
19
|
options = Hash.new
|
20
|
+
options["binaries"] = false
|
20
21
|
options["export"] = nil
|
21
22
|
options["ignore"] = Array.new
|
22
23
|
options["private"] = false
|
@@ -33,12 +34,20 @@ def parse(args)
|
|
33
34
|
|
34
35
|
opts.on("", "DESCRIPTION")
|
35
36
|
|
36
|
-
info.scan(/\S.{0,
|
37
|
+
info.scan(/\S.{0,66}\S(?=\s|$)|\S+/).each do |line|
|
37
38
|
opts.on(" #{line}")
|
38
39
|
end
|
39
40
|
|
40
41
|
opts.on("", "OPTIONS")
|
41
42
|
|
43
|
+
opts.on(
|
44
|
+
"-b",
|
45
|
+
"--binaries",
|
46
|
+
"Search binary files (may take a long time)"
|
47
|
+
) do
|
48
|
+
options["binaries"] = true
|
49
|
+
end
|
50
|
+
|
42
51
|
opts.on(
|
43
52
|
"-e",
|
44
53
|
"--export=DIRECTORY",
|
@@ -67,7 +76,8 @@ def parse(args)
|
|
67
76
|
opts.on(
|
68
77
|
"-p",
|
69
78
|
"--private-only",
|
70
|
-
"Only export/show private keys and matching
|
79
|
+
"Only export/show private keys and matching",
|
80
|
+
"certificates"
|
71
81
|
) do
|
72
82
|
options["private"] = true
|
73
83
|
end
|
@@ -123,7 +133,7 @@ options = parse(ARGV)
|
|
123
133
|
begin
|
124
134
|
thieve = Thieve.new(!Hilighter.disable?)
|
125
135
|
options["dirs"].each do |dir|
|
126
|
-
thieve.steal_from(dir, options["ignore"])
|
136
|
+
thieve.steal_from(dir, options["ignore"], options["binaries"])
|
127
137
|
end
|
128
138
|
thieve.find_matches
|
129
139
|
|
data/lib/thieve.rb
CHANGED
@@ -181,6 +181,10 @@ class Thieve
|
|
181
181
|
raise Thieve::Error::ExecutableNotFound.new("gpg")
|
182
182
|
end
|
183
183
|
|
184
|
+
if (ScoobyDoo.where_are_you("grep").nil?)
|
185
|
+
raise Thieve::Error::ExecutableNotFound.new("grep")
|
186
|
+
end
|
187
|
+
|
184
188
|
@@hilight = hilight
|
185
189
|
@loot = Hash.new
|
186
190
|
@private = false
|
@@ -190,28 +194,26 @@ class Thieve
|
|
190
194
|
@private = priv
|
191
195
|
end
|
192
196
|
|
193
|
-
def steal_from(filename, ignores = Array.new)
|
194
|
-
|
197
|
+
def steal_from(filename, ignores = Array.new, binaries = false)
|
198
|
+
cmd = ["\\grep"]
|
199
|
+
cmd.push("-a") if (binaries)
|
195
200
|
|
196
|
-
|
197
|
-
|
201
|
+
ignores.each do |ignore|
|
202
|
+
cmd.push("--exclude-dir \"#{ignore}\"")
|
203
|
+
cmd.push("--exclude \"*#{ignore}*\"")
|
198
204
|
end
|
199
|
-
return @loot if (skip)
|
200
205
|
|
201
|
-
if (
|
202
|
-
|
203
|
-
Pathname.new(f).directory? || Pathname.new(f).symlink?
|
204
|
-
end
|
206
|
+
cmd.push("-I") if (!binaries)
|
207
|
+
cmd.push("-lRs -- \"-----BEGIN\" #{filename}")
|
205
208
|
|
206
|
-
|
207
|
-
|
208
|
-
f.to_s.match(%r{#{ignore}})
|
209
|
-
end
|
210
|
-
next if (skip)
|
209
|
+
%x(#{cmd.join(" ")}).each_line do |f|
|
210
|
+
file = Pathname.new(f.strip).expand_path
|
211
211
|
|
212
|
-
|
212
|
+
skip = ignores.any? do |ignore|
|
213
|
+
file.to_s.match(%r{#{ignore}})
|
213
214
|
end
|
214
|
-
|
215
|
+
next if (skip)
|
216
|
+
|
215
217
|
extract_from(file)
|
216
218
|
end
|
217
219
|
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Whittaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|