Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -35,7 +35,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
35 |
|
36 |
@tool
|
37 |
def subfinder_tool(domain: str, subdomains: str) -> str:
|
38 |
-
"""A tool that checks which subdomains of a given domain exist by
|
39 |
Args:
|
40 |
domain: The main domain (e.g., 'example.com').
|
41 |
subdomains: A comma-separated list of subdomains to check (e.g., 'www,mail,blog').
|
@@ -49,11 +49,13 @@ def subfinder_tool(domain: str, subdomains: str) -> str:
|
|
49 |
continue
|
50 |
full_domain = f"{sub}.{domain}"
|
51 |
try:
|
52 |
-
#
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
57 |
except Exception as e:
|
58 |
return f"Error checking {full_domain}: {str(e)}"
|
59 |
|
|
|
35 |
|
36 |
@tool
|
37 |
def subfinder_tool(domain: str, subdomains: str) -> str:
|
38 |
+
"""A tool that checks which subdomains of a given domain exist by querying a public DNS API.
|
39 |
Args:
|
40 |
domain: The main domain (e.g., 'example.com').
|
41 |
subdomains: A comma-separated list of subdomains to check (e.g., 'www,mail,blog').
|
|
|
49 |
continue
|
50 |
full_domain = f"{sub}.{domain}"
|
51 |
try:
|
52 |
+
# Query Google's DNS-over-HTTPS API
|
53 |
+
response = requests.get(
|
54 |
+
f"https://dns.google/resolve?name={full_domain}&type=A"
|
55 |
+
)
|
56 |
+
data = response.json()
|
57 |
+
if "Answer" in data:
|
58 |
+
valid_subdomains.append(full_domain)
|
59 |
except Exception as e:
|
60 |
return f"Error checking {full_domain}: {str(e)}"
|
61 |
|