feat: Add curl
All checks were successful
Build Docker / BuildImage (push) Successful in 35s

This commit is contained in:
2025-02-27 14:14:27 +11:00
parent c4b1be2149
commit 0e56b2609e
4 changed files with 256 additions and 5 deletions

View File

@@ -6,8 +6,8 @@ import binascii
from cryptography import x509
from cryptography.hazmat.backends import default_backend
import datetime
from dns import resolver, dnssec, name, exception
import time
from dns import resolver
import requests
resolver = dns.resolver.Resolver()
resolver.nameservers = ["194.50.5.28","194.50.5.27","194.50.5.26"]
@@ -170,4 +170,23 @@ def validate_dnssec(domain):
if "; fully validated" in result.stdout or "; negative response, fully validated" in result.stdout:
return {"valid": True, "message": "DNSSEC is valid", "output": result.stderr + result.stdout}
else:
return {"valid": False, "message": "DNSSEC is not valid", "output": result.stderr + result.stdout}
return {"valid": False, "message": "DNSSEC is not valid", "output": result.stderr + result.stdout}
def curl(url: str):
if not url.startswith("http"):
url = "http://" + url
try:
# curl --doh-url https://hnsdoh.com/dns-query {url} --insecure
commmand = f"curl --doh-url https://hnsdoh.com/dns-query {url} --insecure --silent"
response = subprocess.run(commmand, shell=True, capture_output=True, text=True)
if response.returncode != 0:
return {"success": False, "error": response.stderr}
else:
return {"success": True, "result": response.stdout}
except:
return {"success": False, "error": "An error occurred"}
# if __name__ == "__main__":
# print(curl("https://dso.dprofile"))