Added /32 and /128 at the end of the file
This commit is contained in:
52
code/test.py
Normal file
52
code/test.py
Normal file
@@ -0,0 +1,52 @@
|
||||
from typing import Optional, Annotated
|
||||
import dns, dns.resolver, socket
|
||||
|
||||
|
||||
|
||||
|
||||
def ermWhatATheIpFromDomainYaCrazy(inpDomainNameOrSomething: Annotated[str, "Domain name to lookup IP for"]):
|
||||
#dns_query = Nslookup()
|
||||
"""
|
||||
Tells you what IPv4 address/es a domain point to.
|
||||
Returns:
|
||||
dict: A dictionary with IP addresses associated with that domain.
|
||||
|
||||
"""
|
||||
|
||||
# i = 0
|
||||
outDict = {}
|
||||
|
||||
#result = dns_query.dns_lookup("example.com")
|
||||
#result = Nslookup.dns_lookup(inpDomainNameOrSomething)
|
||||
result = dns.resolver.resolve(inpDomainNameOrSomething, 'A')
|
||||
# result = dns.resolver.resolve_name(inpDomainNameOrSomething)
|
||||
for i, something in enumerate(result):
|
||||
outDict[i] = something.to_text()
|
||||
# i += 1
|
||||
|
||||
return outDict
|
||||
|
||||
|
||||
# print(socket.getaddrinfo(url, "443"))
|
||||
|
||||
url = "https://data.fubukus.net/assets/"
|
||||
# url = "http://ftp.eq.uc.pt/software/Linux/debian/"
|
||||
|
||||
if "https://" in url:
|
||||
url = url[8:]
|
||||
elif "http://" in url:
|
||||
url = url[7:]
|
||||
i = 0
|
||||
for char in url:
|
||||
# print(char)
|
||||
i += 1
|
||||
if char == "/":
|
||||
url = url[:i]
|
||||
# i = 0
|
||||
|
||||
# print("skibidi")
|
||||
if char == "/":
|
||||
url = url[:-1]
|
||||
|
||||
print(url)
|
||||
# print(ermWhatATheIpFromDomainYaCrazy(url))
|
||||
Reference in New Issue
Block a user