import socket def dns_lookup(domain): try: ip_address = socket.gethostbyname(domain) print(f"Domain: {domain}\nIP Address: {ip_address}") except socket.gaierror: print(f"Error: Unable to resolve domain '{domain}'") if __name__ == "__main__": domain_name = input("Enter a domain name (e.g., example.com): ") dns_lookup(domain_name)
-
Simple DNS Lookup Script
-
Daily Motivational Quote Script
import random def get_daily_quote(): quotes = [ "The only way to do great work is to love what you do. - Steve Jobs", "Success is not the key to happiness. Happiness is the key to success. - Albert Schweitzer", "Don't watch the clock; do what it does. Keep going. - Sam Levenson", "The future belongs to those who believe in the beauty of their dreams. - Eleanor Roosevelt", "Your limitation—it's only your imagination.", "Push yourself, because no one else is going to do it for you.", "Great things never come from comfort zones.", "Dream it. Wish it. Do it." ] return random.choice(quotes) if __name__ == "__main__": daily_quote = get_daily_quote() print("Today's Motivational Quote:") print(daily_quote)
-
Bash Script for Checking HTTP Response
#!/bin/bash URL=$1 if [[ -z "$URL" ]]; then echo "Usage: $0 <url>" exit 1 fi HTTP_RESPONSE=$(curl -o /dev/null -s -w "%{http_code}\n" "$URL") if [[ "$HTTP_RESPONSE" -eq 200 ]]; then echo "The URL is accessible: $URL" else echo "The URL returned status code: $HTTP_RESPONSE" fi
-
Simple Python Port Scanner
import socket def scan_ports(host, start_port, end_port): print(f"Scanning {host} from port {start_port} to {end_port}") for port in range(start_port, end_port + 1): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(1) # Set a timeout for the connection result = sock.connect_ex((host, port)) if result == 0: print(f"Port {port} is open") sock.close() if __name__ == "__main__": target_host = input("Enter the host to scan (e.g., 192.168.1.1): ") scan_ports(target_host, 1, 1024) # Scanning ports 1 to 1024
-
Hello world!
print("Hello world!")