Initial commit
This commit is contained in:
commit
efde1d5264
|
@ -0,0 +1,8 @@
|
||||||
|
all:
|
||||||
|
gpg --list-sigs > sigs
|
||||||
|
python3 sigs2dot.py sigs > out.dot
|
||||||
|
neato out.dot -Tsvg > out.svg
|
||||||
|
convert out.svg out.png
|
||||||
|
xdg-open out.png
|
||||||
|
clean:
|
||||||
|
rm sigs out.dot out.svg out.png||:
|
|
@ -0,0 +1,11 @@
|
||||||
|
# A sucessor of sig2dot
|
||||||
|
|
||||||
|
The similarly named project [sig2dot](http://www.chaosreigns.com/code/sig2dot/) was last updated in 2002, and it does not currently function.
|
||||||
|
|
||||||
|
This is a small replacement project. Simply run `make` and you're all set.
|
||||||
|
|
||||||
|
For more fine grained control, the usage is as follows
|
||||||
|
|
||||||
|
python3 sigs2dot.py [sigsfile] > graph.dot
|
||||||
|
|
||||||
|
where sigsfile contains the output of `gpg --list-sigs`
|
|
@ -0,0 +1,41 @@
|
||||||
|
import string, sys
|
||||||
|
def sanitize(s):
|
||||||
|
final = ''
|
||||||
|
for char in s:
|
||||||
|
if char in string.ascii_letters:
|
||||||
|
final += char
|
||||||
|
return final
|
||||||
|
def get(label, second = False):
|
||||||
|
# return sanitize(label) + " [label=\"" + label + "\"]"
|
||||||
|
s = "\"" + label + "\""
|
||||||
|
if not second: return s
|
||||||
|
# return s + " [minlen=2]"
|
||||||
|
return s
|
||||||
|
f = open(sys.argv[1], "r").read().split('\n')
|
||||||
|
inuid = False
|
||||||
|
print("digraph test {")
|
||||||
|
# print("\tsize=\"24,24\";")
|
||||||
|
# print("\tratio=1;")
|
||||||
|
print("\tgraph [overlap = false];")
|
||||||
|
for line in f:
|
||||||
|
if "User ID not found" in line:
|
||||||
|
continue
|
||||||
|
if line[:3] == 'uid':
|
||||||
|
inuid = True
|
||||||
|
current_id = " ".join(line.split()[1:])
|
||||||
|
continue
|
||||||
|
elif line[:3] == 'sub':
|
||||||
|
inuid = False
|
||||||
|
continue
|
||||||
|
if inuid:
|
||||||
|
if line[:3] == "sig":
|
||||||
|
currentsig = line[42:]
|
||||||
|
if currentsig in current_id:
|
||||||
|
# Its a selfsig
|
||||||
|
continue
|
||||||
|
if "PGP Global Directory Verification Key" in currentsig:
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
print("\t" + get(currentsig) + " -> " + get(current_id, True) + ";")
|
||||||
|
print("}")
|
Loading…
Reference in New Issue