sks_dump_parser 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sks_parser.rb +13 -24
- 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: 523b6e3ed43a257cccc18c99597c2742799a500b
|
4
|
+
data.tar.gz: ef7c860a0b3c780752d5cb46edc83b8e48698585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b56af18ad9066d3e6f259aec7848da53d8357334dc9b712831bb3b9572c9e73be3e0a04983e4443249897acca7e06e66ab859e40f97e3d85d1de40772e26d172
|
7
|
+
data.tar.gz: 32db228481463025a5f90a23f52d3076dc81903449bc8bb02a03e05d62567d9dee925053924a195dafbc6e72e72234162d3d3eee986d06f41f3d27f76b5fb12e
|
data/lib/sks_parser.rb
CHANGED
@@ -11,9 +11,8 @@ class SksParser
|
|
11
11
|
|
12
12
|
# enumerate states
|
13
13
|
S_READING_UID = 0
|
14
|
-
|
15
|
-
|
16
|
-
S_READING_SUBS = 3
|
14
|
+
S_READING_USER_OR_SIGS = 1
|
15
|
+
S_READING_SUBS = 2
|
17
16
|
|
18
17
|
def self.get_dump_hash_from(dump)
|
19
18
|
sm = StateMachine.new
|
@@ -31,10 +30,8 @@ class SksParser
|
|
31
30
|
case @state
|
32
31
|
when S_READING_UID
|
33
32
|
process_uid_line(line)
|
34
|
-
when
|
35
|
-
|
36
|
-
when S_READING_SIGS
|
37
|
-
process_sig_line(line)
|
33
|
+
when S_READING_USER_OR_SIGS
|
34
|
+
process_user_or_sig_line(line)
|
38
35
|
when S_READING_SUBS
|
39
36
|
process_sub_line(line)
|
40
37
|
else
|
@@ -45,29 +42,20 @@ class SksParser
|
|
45
42
|
def process_uid_line(line)
|
46
43
|
if line.start_with?("\tkeyid")
|
47
44
|
@keyid = line.split(' ')[1]
|
48
|
-
@dump_hash[@keyid] = {}
|
49
|
-
self.state =
|
50
|
-
else
|
51
|
-
return
|
45
|
+
@dump_hash[@keyid] = {:sigs => []}
|
46
|
+
self.state = S_READING_USER_OR_SIGS
|
52
47
|
end
|
53
48
|
end
|
54
49
|
|
55
|
-
def
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
def process_sig_line(line)
|
62
|
-
if line.start_with?(':signature')
|
50
|
+
def process_user_or_sig_line(line)
|
51
|
+
if line.start_with?(":user")
|
52
|
+
@dump_hash[@keyid][:user] = line.split(' ', 4)[3][1..-2]
|
53
|
+
elsif line.start_with?(":sig")
|
63
54
|
@dump_hash[@keyid][:sigs] << line.split(' ')[5]
|
64
|
-
|
65
|
-
if line.start_with?(':public sub')
|
55
|
+
elsif line.start_with?(':public sub')
|
66
56
|
self.state = S_READING_SUBS
|
67
57
|
elsif line.start_with?(':public key')
|
68
58
|
self.state = S_READING_UID
|
69
|
-
elsif line.start_with?(':user')
|
70
|
-
self.state = S_READING_UID
|
71
59
|
end
|
72
60
|
end
|
73
61
|
|
@@ -83,6 +71,7 @@ class SksParser
|
|
83
71
|
output = []
|
84
72
|
files = Dir.glob("#{directory}/*")
|
85
73
|
files.each do |file|
|
74
|
+
puts file
|
86
75
|
IO.popen("gpg --list-packets #{file}").each do |line|
|
87
76
|
output << line
|
88
77
|
end
|
@@ -90,6 +79,6 @@ class SksParser
|
|
90
79
|
StateMachine.get_dump_hash_from(output)
|
91
80
|
end
|
92
81
|
|
93
|
-
puts SksParser.parse_dump('
|
82
|
+
#puts SksParser.parse_dump('/Users/sue/IdeaProjects/sks/')
|
94
83
|
|
95
84
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sks_dump_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sue White
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: sue@mailworks.org
|