SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
sfp_apple_itunes: Fix bundleId match
Brendan Colesf7ab1efe332d
diff --git a/modules/sfp_apple_itunes.py b/modules/sfp_apple_itunes.pyindex da53be7f..86a64d6a 100644--- a/modules/sfp_apple_itunes.py+++ b/modules/sfp_apple_itunes.py@@ -115,7 +115,7 @@ class sfp_apple_itunes(SpiderFootPlugin):self.results[eventData] = True- domain_reversed = '.'.join(list(reversed(eventData.split('.'))))+ domain_reversed = '.'.join(list(reversed(eventData.lower().split('.'))))data = self.query(domain_reversed)if not data:@@ -126,30 +126,41 @@ class sfp_apple_itunes(SpiderFootPlugin):self.notifyListeners(evt)urls = list()+ hosts = list()for result in data:bundleId = result.get('bundleId')++ if not bundleId:+ continue+trackName = result.get('trackName')- trackViewUrl = result.get('trackViewUrl')++ if not trackName:+ continue+version = result.get('version')- if not bundleId:+ if not version:continueapp_full_name = f"{trackName} {version} ({bundleId})"- if not bundleId.startswith(f"{domain_reversed}.") and f".{domain_reversed}." not in bundleId:+ if (+ domain_reversed != bundleId.lower()+ and not bundleId.lower().startswith(f"{domain_reversed}.")+ and not bundleId.lower().endswith(f".{domain_reversed}")+ and f".{domain_reversed}." not in bundleId.lower()+ ):self.sf.debug(f"App {app_full_name} does not match {domain_reversed}, skipping")continue- trackName = result.get('trackName')trackViewUrl = result.get('trackViewUrl')- version = result.get('version')- if not trackName and not trackViewUrl and not version:+ if not trackViewUrl:continue- app_data = f"{trackName} {version}\n<SFURL>{trackViewUrl}</SFURL>"+ app_data = f"{app_full_name}\n<SFURL>{trackViewUrl}</SFURL>"evt = SpiderFootEvent('APPSTORE_ENTRY', app_data, self.__name__, event)self.notifyListeners(evt)@@ -164,9 +175,20 @@ class sfp_apple_itunes(SpiderFootPlugin):for url in set(urls):host = self.sf.urlFQDN(url)+ if not host:+ continue+if self.getTarget().matches(host, includeChildren=True, includeParents=True):evt = SpiderFootEvent('LINKED_URL_INTERNAL', url, self.__name__, event)self.notifyListeners(evt)++ hosts.append(host)++ for host in set(hosts):+ if not host:+ continue++ if self.getTarget().matches(host, includeChildren=True, includeParents=True):evt = SpiderFootEvent('INTERNET_NAME', host, self.__name__, event)self.notifyListeners(evt)else:diff --git a/test/unit/modules/sfp_apple_itunes.py b/test/unit/modules/test_sfp_apple_itunes.pysimilarity index 99%rename from test/unit/modules/sfp_apple_itunes.pyrename to test/unit/modules/test_sfp_apple_itunes.pyindex 61f53fad..4afbbeba 100644--- a/test/unit/modules/sfp_apple_itunes.py+++ b/test/unit/modules/test_sfp_apple_itunes.py@@ -1,4 +1,4 @@-# test_sfp_apple_items.py+# test_sfp_apple_itunes.pyimport unittestfrom modules.sfp_apple_itunes import sfp_apple_itunes