blob: 91677490c9ea2f78fc217cf7367b8352abf01c74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
from generalresearch.models.network.rdns import dig_rdns
import faker
fake = faker.Faker()
def test_dig_rdns():
# Actually runs dig -x. Idk how stable this is
ip = "45.33.32.156"
rdns_result = dig_rdns(ip)
assert rdns_result.primary_hostname == "scanme.nmap.org"
assert rdns_result.primary_org == "nmap"
ip = "65.19.129.53"
rdns_result = dig_rdns(ip)
assert rdns_result.primary_hostname == "in1-smtp.grlengine.com"
assert rdns_result.primary_org == "grlengine"
ip = fake.ipv6()
rdns_result = dig_rdns(ip)
assert rdns_result.primary_hostname is None
assert rdns_result.primary_org is None
print(rdns_result.model_dump_postgres())
|