Improves WebkitResourceLoadStatistics module

This commit is contained in:
tek
2023-04-07 14:43:20 +02:00
parent 0d653be4dd
commit 801fe367ac
3 changed files with 13 additions and 1 deletions

View File

@@ -237,6 +237,8 @@ class Indicators:
# being matched.
if not url:
return None
if not isinstance(url, str):
return None
try:
# First we use the provided URL.

View File

@@ -70,7 +70,15 @@ class WebkitResourceLoadStatistics(IOSExtraction):
cur = conn.cursor()
try:
cur.execute("SELECT * from ObservedDomains;")
# FIXME: table contains extra fields with timestamp here
cur.execute("""
SELECT
domainID,
registrableDomain,
lastSeen,
hadUserInteraction
from ObservedDomains;
""")
except sqlite3.OperationalError:
return

View File

@@ -24,8 +24,10 @@ class TestIndicators:
def test_check_domain(self, indicator_file):
ind = Indicators(log=logging)
ind.load_indicators_files([indicator_file], load_default=False)
assert ind.check_domain(42) is None
assert ind.check_domain("https://www.example.org/foobar")
assert ind.check_domain("http://example.org:8080/toto")
assert ind.check_domain("https://github.com") is None
def test_check_android_property(self, indicator_file):
ind = Indicators(log=logging)