commit efde1d5264a6dba29cb73121a5598d5d66dfbacb Author: Niles Rogoff Date: Sun Jul 10 22:51:34 2016 -0400 Initial commit diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cb900d4 --- /dev/null +++ b/Makefile @@ -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||: diff --git a/README.md b/README.md new file mode 100644 index 0000000..8eb127a --- /dev/null +++ b/README.md @@ -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` diff --git a/sigs2dot.py b/sigs2dot.py new file mode 100644 index 0000000..d5b28bf --- /dev/null +++ b/sigs2dot.py @@ -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("}")