SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Support Bitcoin as a scan target.
smicallef4525efc55d84
diff --git a/dyn/newscan.tmpl b/dyn/newscan.tmplindex 248272a4..f74feab5 100644--- a/dyn/newscan.tmpl+++ b/dyn/newscan.tmpl@@ -23,7 +23,7 @@</div><div class='row'><div class='col-sm-6'>- <b>Domain Name</b>: e.g. <i>example.com</i><br><b>IPv4 Address</b>: e.g. <i>1.2.3.4</i><br><b>IPv6 Address</b>: e.g. <i>2606:4700:4700::1111</i><br><b>Hostname/Sub-domain</b>: e.g. <i>abc.example.com</i><br><b>Subnet</b>: e.g. <i>1.2.3.0/24</i>+ <b>Domain Name</b>: e.g. <i>example.com</i><br><b>IPv4 Address</b>: e.g. <i>1.2.3.4</i><br><b>IPv6 Address</b>: e.g. <i>2606:4700:4700::1111</i><br><b>Hostname/Sub-domain</b>: e.g. <i>abc.example.com</i><br><b>Subnet</b>: e.g. <i>1.2.3.0/24</i><br><b>Bitcoin Address</b>: e.g. 1HesYJSP1QqcyPEjnQ9vzBL1wujruNGe7R</div><div class='col-sm-6'><b>E-mail address</b>: e.g. <i>[email protected]</i><br><b>Phone Number</b>: e.g. <i>+12345678901</i> (E.164 format)<br><b>Human Name</b>: e.g. <i>"John Smith"</i> (must be in quotes)<br><b>Username</b>: e.g. <i>"jsmith2000"</i> (must be in quotes)<br><b>Network ASN</b>: e.g. <i>1234</i></div>diff --git a/sflib.py b/sflib.pyindex c634c146..5514fd79 100644--- a/sflib.py+++ b/sflib.py@@ -824,7 +824,8 @@ class SpiderFoot:{r"^\".+\"$": "USERNAME"},{r"^[0-9]+$": "BGP_AS_OWNER"},{r"^[0-9a-f:]+$": "IPV6_ADDRESS"},- {r"^(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)+([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$": "INTERNET_NAME"}+ {r"^(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)+([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$": "INTERNET_NAME"},+ {r"^([13][a-km-zA-HJ-NP-Z1-9]{25,34})$": "BITCOIN_ADDRESS"}]# Parse the target and set the targetTypediff --git a/sfwebui.py b/sfwebui.pyindex 9c0980c4..6178b0da 100644--- a/sfwebui.py+++ b/sfwebui.py@@ -436,7 +436,7 @@ class SpiderFootWebUi:# target type again.targetType = sf.targetType(f'"{scantarget}"')- if targetType != "HUMAN_NAME":+ if targetType not in ["HUMAN_NAME", "BITCOIN_ADDRESS"]:scantarget = scantarget.lower()# Start running a new scan@@ -488,7 +488,7 @@ class SpiderFootWebUi:targetType = sf.targetType(scantarget)if targetType is None:# Should never be triggered for a re-run scan..- return self.error("Invalid target type. Could not recognize it as a human name, IP address, IP subnet, ASN, domain name or host name.")+ return self.error("Invalid target type. Could not recognize it as a target SpiderFoot supports.")# Start running a new scanscanId = sf.genScanInstanceId()@@ -1052,14 +1052,14 @@ class SpiderFootWebUi:cherrypy.response.headers['Content-Type'] = "application/json; charset=utf-8"return json.dumps(["ERROR", "Unrecognised target type."]).encode('utf-8')- return self.error("Invalid target type. Could not recognize it as a human name, IP address, IP subnet, ASN, domain name or host name.")+ return self.error("Invalid target type. Could not recognize it as a target SpiderFoot supports.")# Delete the stdout module in case it crept inif "sfp__stor_stdout" in modlist:modlist.remove("sfp__stor_stdout")# Start running a new scan- if targetType in ["HUMAN_NAME", "USERNAME"]:+ if targetType in ["HUMAN_NAME", "USERNAME", "BITCOIN_ADDRESS"]:scantarget = scantarget.replace("\"", "")else:scantarget = scantarget.lower()diff --git a/spiderfoot/target.py b/spiderfoot/target.pyindex d37d3f88..73a5b84d 100644--- a/spiderfoot/target.py+++ b/spiderfoot/target.py@@ -12,7 +12,8 @@ class SpiderFootTarget():"""_validTypes = ["IP_ADDRESS", 'IPV6_ADDRESS', "NETBLOCK_OWNER", "INTERNET_NAME",- "EMAILADDR", "HUMAN_NAME", "BGP_AS_OWNER", 'PHONE_NUMBER', "USERNAME"]+ "EMAILADDR", "HUMAN_NAME", "BGP_AS_OWNER", 'PHONE_NUMBER', "USERNAME",+ "BITCOIN_ADDRESS"]_targetType = None_targetValue = None_targetAliases = list()@@ -180,17 +181,15 @@ class SpiderFootTarget():if not isinstance(value, str) and not isinstance(value, bytes):return False- value = value.lower()-if isinstance(value, bytes):value = value.decode("utf-8")if not value:return False- # We can't really say anything about names, username or phone numbers,- # so everything matches- if self.targetType in ["HUMAN_NAME", "PHONE_NUMBER", "USERNAME"]:+ # We can't really say anything about names, username, bitcoin addresses+ # or phone numbers, so everything matches+ if self.targetType in ["HUMAN_NAME", "PHONE_NUMBER", "USERNAME", "BITCOIN_ADDRESS"]:return True# TODO: review handling of other potential self.targetType target types:diff --git a/test/unit/test_spiderfoot.py b/test/unit/test_spiderfoot.pyindex 0fe3ed52..9fc20c7a 100644--- a/test/unit/test_spiderfoot.py+++ b/test/unit/test_spiderfoot.py@@ -373,6 +373,8 @@ class TestSpiderFoot(unittest.TestCase):self.assertEqual('IPV6_ADDRESS', target_type)target_type = sf.targetType("spiderfoot.net")self.assertEqual('INTERNET_NAME', target_type)+ target_type = sf.targetType("1HesYJSP1QqcyPEjnQ9vzBL1wujruNGe7R")+ self.assertEqual('BITCOIN_ADDRESS', target_type)def test_target_type_invalid_seed_should_return_none(self):"""diff --git a/test/unit/test_spiderfoottarget.py b/test/unit/test_spiderfoottarget.pyindex 4e112075..3cdd5899 100644--- a/test/unit/test_spiderfoottarget.py+++ b/test/unit/test_spiderfoottarget.py@@ -11,7 +11,8 @@ class TestSpiderFootTarget(unittest.TestCase):valid_target_types = ['IP_ADDRESS', 'IPV6_ADDRESS', 'NETBLOCK_OWNER', 'INTERNET_NAME',- 'EMAILADDR', 'HUMAN_NAME', 'BGP_AS_OWNER', 'PHONE_NUMBER', "USERNAME"+ 'EMAILADDR', 'HUMAN_NAME', 'BGP_AS_OWNER', 'PHONE_NUMBER', "USERNAME",+ 'BITCOIN_ADDRESS']def test_init_argument_targetValue_invalid_type_should_raise_TypeError(self):@@ -306,6 +307,17 @@ class TestSpiderFootTarget(unittest.TestCase):matches = target.matches('something else entirely')self.assertTrue(matches)+ def test_matches_argument_value_any_bitcoin_address_should_return_True(self):+ """+ Test matches(self, value, includeParents=False, includeChildren=True)+ """+ target_value = 'SpiderFoot'+ target_type = 'BITCOIN_ADDRESS'+ target = SpiderFootTarget(target_value, target_type)++ matches = target.matches('something else entirely')+ self.assertTrue(matches)+def test_matches_argument_value_any_username_should_return_True(self):"""Test matches(self, value, includeParents=False, includeChildren=True)