Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

Extract PGP keys

Krishnasis Mandale24f4813961f
diff --git a/modules/sfp_keybase.py b/modules/sfp_keybase.py
index 9415e070..bc1e1609 100644
--- a/modules/sfp_keybase.py
+++ b/modules/sfp_keybase.py
@@ -43,7 +43,8 @@ class sfp_keybase(SpiderFootPlugin):
def producedEvents(self):
return ["RAW_RIR_DATA", "SOCIAL_MEDIA", "USERNAME",
- "HUMAN_NAME", "GEOINFO", "BITCOIN_ADDRESS"]
+ "HUMAN_NAME", "GEOINFO", "BITCOIN_ADDRESS",
+ "PGP_KEY"]
def queryUsername(self, qry):
@@ -221,6 +222,22 @@ class sfp_keybase(SpiderFootPlugin):
continue
evt = SpiderFootEvent("BITCOIN_ADDRESS", str(btcAddress), self.__name__, event)
self.notifyListeners(evt)
+
+ # Extract PGP Keys
+ pgpRegex = "-----BEGIN PGP PUBLIC KEY BLOCK-----(.*?)-----END PGP PUBLIC KEY BLOCK-----"
+
+ pgpKeys = re.findall(pgpRegex, str(content))
+
+ for pgpKey in pgpKeys:
+
+ if len(pgpKey) < 300:
+ self.sf.debug("Likely invalid public key.")
+ continue
+
+ pgpKey = pgpKey.replace("\\n", "")
+
+ evt = SpiderFootEvent("PGP_KEY", pgpKey, self.__name__, event)
+ self.notifyListeners(evt)
return None