-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/bit domain ownership pending (#3290)
Co-authored-by: ammar92 <[email protected]> Co-authored-by: stephanie0x00 <[email protected]> Co-authored-by: Benny <[email protected]> Co-authored-by: noamblitz <[email protected]>
- Loading branch information
1 parent
2579e35
commit 2583519
Showing
5 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from bits.definitions import BitDefinition | ||
from octopoes.models.ooi.dns.records import DNSNSRecord | ||
|
||
BIT = BitDefinition( | ||
id="domain-owner-verification", | ||
consumes=DNSNSRecord, | ||
parameters=[], | ||
module="bits.domain_owner_verification.domain_owner_verification", | ||
) |
25 changes: 25 additions & 0 deletions
25
octopoes/bits/domain_owner_verification/domain_owner_verification.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from collections.abc import Iterator | ||
|
||
from octopoes.models import OOI | ||
from octopoes.models.ooi.dns.records import DNSNSRecord | ||
from octopoes.models.ooi.findings import Finding, KATFindingType | ||
|
||
INDICATORS = [ | ||
"NS1.REGISTRANT-VERIFICATION.ISPAPI.NET", | ||
"NS2.REGISTRANT-VERIFICATION.ISPAPI.NET", | ||
"NS3.REGISTRANT-VERIFICATION.ISPAPI.NET", | ||
] | ||
|
||
|
||
def run(nameserver_record: DNSNSRecord, additional_oois, config: dict[str, str]) -> Iterator[OOI]: | ||
"""Checks to see if a domain has a specific set of dns servers which would indicate domain registrant verification. | ||
https://support.dnsimple.com/articles/icann-domain-validation/ | ||
""" | ||
if nameserver_record.name_server_hostname.tokenized.name.rstrip(".").upper() in INDICATORS: | ||
finding_type = KATFindingType(id="KAT-DOMAIN-OWNERSHIP-PENDING") | ||
yield finding_type | ||
yield Finding( | ||
finding_type=finding_type.reference, | ||
ooi=nameserver_record.hostname, | ||
description="This domain requires ownership verification and is currently pending.", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from bits.domain_owner_verification.domain_owner_verification import run | ||
|
||
from octopoes.models.ooi.dns.records import DNSNSRecord | ||
from octopoes.models.ooi.dns.zone import Hostname | ||
from octopoes.models.ooi.network import Network | ||
|
||
|
||
def test_verification_pending(): | ||
network = Network(name="fake") | ||
hostname = Hostname(name="example.com", network=network.reference) | ||
ns_hostname = Hostname(name="ns1.registrant-verification.ispapi.net", network=network.reference) | ||
ns_record = DNSNSRecord(hostname=hostname.reference, name_server_hostname=ns_hostname.reference, value="x") | ||
results = list(run(ns_record, [], {})) | ||
|
||
assert len(results) == 2 | ||
|
||
|
||
def test_no_verification_pending(): | ||
network = Network(name="fake") | ||
hostname = Hostname(name="example.com", network=network.reference) | ||
ns_hostname = Hostname(name="ns1.example.com", network=network.reference) | ||
ns_record = DNSNSRecord(hostname=hostname.reference, name_server_hostname=ns_hostname.reference, value="x") | ||
results = list(run(ns_record, [], {})) | ||
|
||
assert len(results) == 0 |