Skip to content

Commit

Permalink
LIKE operator only added for events queries (#1521)
Browse files Browse the repository at this point in the history
  • Loading branch information
KaneBrennan132 authored and delliott90 committed Aug 25, 2023
1 parent a67253d commit d6919c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _parse_mapped_fields(self, expression, value, comparator, stix_field, mapped
value=value)
else:
# There's no aql field for domain-name. using Like operator to find domian name from the url
if mapped_field == 'dnsdomainname' and comparator != ComparisonComparators.Like:
if self.dmm.dialect == 'events' and mapped_field == 'dnsdomainname' and comparator != ComparisonComparators.Like:
comparator = self.comparator_lookup["ComparisonComparators.Like"]
value = self._format_like(expression.value)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def test_md5hash_query(self):
def test_domainname_query(self):
stix_pattern = "[domain-name:value = 'example.com']"
query = _translate_query(stix_pattern)
where_statement = "WHERE dnsdomainname LIKE '%example.com%' {} {}".format(default_limit, default_time)
where_statement = "WHERE dnsdomainname = 'example.com' {} {}".format(default_limit, default_time)
_test_query_assertions(query, selections, from_statement, where_statement)

def test_filename_query(self):
Expand Down Expand Up @@ -235,7 +235,7 @@ def test_tlssni_query(self):
def test_url_query(self):
stix_pattern = "[url:value = 'example.com' ]"
query = _translate_query(stix_pattern)
where_statement = "WHERE (dnsdomainname LIKE '%example.com%' OR tlsservernameindication LIKE '%example.com%' OR httphost LIKE '%example.com%') {} {}".format(default_limit, default_time)
where_statement = "WHERE (dnsdomainname = 'example.com' OR tlsservernameindication = 'example.com' OR httphost = 'example.com') {} {}".format(default_limit, default_time)
_test_query_assertions(query, selections, from_statement, where_statement)

def test_in_operators(self):
Expand Down

0 comments on commit d6919c2

Please sign in to comment.