Skip to content

Instantly share code, notes, and snippets.

@the-eater the-eater/details.md
Last active Aug 16, 2018

Embed
What would you like to do?
Create a visual graph of your gpg trust network!

The following script creates a dot graph from your trust network (who signed who).

Run the following to generate

gpg --list-sigs --with-colons | awk -Egpg2dot.awk > gpg.dot

Then you can render the graph to png or svg

dot -Tsvg gpg.dot > gpg.svg
function print_part(id, label, paths, expired, unknown) {
if (id != "") {
gsub(/\"/, "\\\"", label)
attr = ""
if (unknown) {
label = "[UNKNOWN]\\n" label
attr = "color=yellow,"
}
if (expired) {
label = "[EXPIRED]\\n" label
attr = "color=red,"
}
print " item_" id " [" attr "label=\"" label "\"];";
print paths;
}
};
BEGIN {
FS=":"
print "digraph gpg {"
print " graph [splines=true overlap=false];\n"
};
$1 == "pub" {
print_part(current_uid, current_label, current_paths, expired);
current_uid = $5;
current_paths="";
next_is_id=0;
current_label=current_uid;
known_id[current_uid] = 1
expired=($2 == "e");
delete unknown_id[current_uid]
};
$1 == "sig" {
if ($5 == current_uid) {
next;
}
if (!($5 in known_paths)) {
current_paths=current_paths " item_" $5 " -> item_" current_uid ";\n";
known_paths[$5] = 1;
if (!($5 in known_id)) {
unknown_id[$5] = $5;
}
}
};
$1 == "uid" && $10 ~ /^\[(jpeg|unknown)/ {
next;
}
$1 == "uid" {
current_label=current_label "\\n" $10;
};
END {
print_part(current_uid, current_label, current_paths, expired);
for (uid in unknown_id) {
print_part(uid, uid, "", 0, 1);
}
print "}";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.