SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Add sflib extractUrls function to extract all URLs from a string
Brendan Colesb74266f6dee7
diff --git a/sflib.py b/sflib.pyindex eedc9106..c8da973b 100644--- a/sflib.py+++ b/sflib.py@@ -15,6 +15,7 @@ from stem import Signalfrom stem.control import Controllerimport inspectimport hashlib+import htmlimport urllib.request, urllib.parse, urllib.errorimport jsonimport re@@ -1337,6 +1338,11 @@ class SpiderFoot:return ret+ # Extract all URLs from a string+ # https://tools.ietf.org/html/rfc3986#section-3.3+ def extractUrls(self, content):+ return re.findall("(https?://[a-zA-Z0-9-\.:]+/[\-\._~!\$&'\(\)\*\+\,\;=:@/a-zA-Z0-9]*)", html.unescape(content))+# Find all URLs within the supplied content. This does not fetch any URLs!# A dictionary will be returned, where each link will have the keys# 'source': The URL where the link was obtained from