Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -33,6 +33,35 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
final_answer = FinalAnswerTool()
|
| 38 |
|
|
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 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 performing DNS lookups.
|
| 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').
|
| 42 |
+
"""
|
| 43 |
+
valid_subdomains = []
|
| 44 |
+
subdomain_list = subdomains.split(',')
|
| 45 |
+
|
| 46 |
+
for sub in subdomain_list:
|
| 47 |
+
sub = sub.strip()
|
| 48 |
+
if not sub:
|
| 49 |
+
continue
|
| 50 |
+
full_domain = f"{sub}.{domain}"
|
| 51 |
+
try:
|
| 52 |
+
# Perform DNS lookup
|
| 53 |
+
socket.gethostbyname(full_domain)
|
| 54 |
+
valid_subdomains.append(full_domain)
|
| 55 |
+
except socket.gaierror:
|
| 56 |
+
continue # If domain doesn't resolve
|
| 57 |
+
except Exception as e:
|
| 58 |
+
return f"Error checking {full_domain}: {str(e)}"
|
| 59 |
+
|
| 60 |
+
if valid_subdomains:
|
| 61 |
+
return f"Valid subdomains: {', '.join(valid_subdomains)}"
|
| 62 |
+
else:
|
| 63 |
+
return "No valid subdomains found"
|
| 64 |
+
|
| 65 |
|
| 66 |
final_answer = FinalAnswerTool()
|
| 67 |
|