Added support for revocations
This commit is contained in:
parent
efde1d5264
commit
ffa3e44eb2
21
sigs2dot.py
21
sigs2dot.py
|
@ -5,11 +5,14 @@ def sanitize(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]"
|
||||
def sanitize2(s):
|
||||
for char in ["\""]:
|
||||
s = s.replace(char,"")
|
||||
return s
|
||||
def get(label, second = False, rev = False):
|
||||
s = "\"" + sanitize2(label) + "\""
|
||||
if rev:
|
||||
s += '[color="red",label="revocation"]'
|
||||
return s
|
||||
f = open(sys.argv[1], "r").read().split('\n')
|
||||
inuid = False
|
||||
|
@ -22,20 +25,22 @@ for line in f:
|
|||
continue
|
||||
if line[:3] == 'uid':
|
||||
inuid = True
|
||||
current_id = " ".join(line.split()[1:])
|
||||
# current_id = " ".join(line.split()[1:])
|
||||
current_id = line[25:]
|
||||
continue
|
||||
elif line[:3] == 'sub':
|
||||
inuid = False
|
||||
continue
|
||||
if inuid:
|
||||
if line[:3] == "sig":
|
||||
if line[:3] in ["sig", "rev"]:
|
||||
currentsig = line[42:]
|
||||
if currentsig in current_id:
|
||||
# Its a selfsig
|
||||
continue
|
||||
if "PGP Global Directory Verification Key" in currentsig:
|
||||
continue
|
||||
rev = line[:3] == "rev"
|
||||
else:
|
||||
continue
|
||||
print("\t" + get(currentsig) + " -> " + get(current_id, True) + ";")
|
||||
print("\t" + get(currentsig) + " -> " + get(current_id, True, rev) + ";")
|
||||
print("}")
|
||||
|
|
Loading…
Reference in New Issue