• htaccess Tool

    import requests

    def access_htaccess(url):
    """Attempt to access the .htaccess file of the given URL."""
    htaccess_url = url.rstrip('/') + '/.htaccess'
    try:
    response = requests.get(htaccess_url)
    if response.status_code == 200:
    print("Contents of .htaccess file:")
    print(response.text)
    else:
    print(f".htaccess file not found or inaccessible. Status code: {response.status_code}")
    except requests.RequestException as e:
    print(f"An error occurred: {e}")

    def main():
    url = input("Enter the target URL (e.g., http://example.com): ")
    access_htaccess(url)

    if __name__ == "__main__":
    main()
  • Password Strength Visualizer

    import string

    def analyze_password(password):
    """Analyze the strength of the password."""
    length = len(password)
    has_upper = any(c.isupper() for c in password)
    has_lower = any(c.islower() for c in password)
    has_digit = any(c.isdigit() for c in password)
    has_special = any(c in string.punctuation for c in password)

    # Base score increments
    score = 0
    if length >= 12:
    score += 3
    elif length >= 8:
    score += 2
    elif length > 0:
    score += 1

    if has_upper:
    score += 2
    if has_lower:
    score += 2
    if has_digit:
    score += 2
    if has_special:
    score += 2

    return min(score, 10) # Ensure score does not exceed 10

    def display_strength(score):
    """Display password strength based on the score."""
    strength_levels = [
    "Very Weak", "Weak", "Fair", "Moderate", "Strong", "Very Strong", "Excellent"
    ]
    strength = strength_levels[score // 2] # Adjusting for 0-10 scale

    print("\nPassword Strength Analysis:")
    print(f"Strength Level: {strength}")
    print("Visual Representation: " + "█" * score + "░" * (10 - score))

    def main():
    print("Welcome to the Password Strength Visualizer!")
    password = input("Enter a password to analyze: ")
    score = analyze_password(password)
    display_strength(score)

    if __name__ == "__main__":
    main()
  • Network Sniffer Simulator

    import random
    import time

    def generate_packet():
    """Simulate generating a network packet."""
    source_ip = f"192.168.1.{random.randint(1, 254)}"
    dest_ip = f"192.168.1.{random.randint(1, 254)}"
    protocol = random.choice(['TCP', 'UDP', 'ICMP'])
    return {
    'source': source_ip,
    'destination': dest_ip,
    'protocol': protocol
    }

    def display_packet(packet):
    """Display packet information."""
    print(f"Packet captured: {packet['protocol']} | Source: {packet['source']} | Destination: {packet['destination']}")

    def main():
    print("Network Sniffer Simulator")
    print("Capturing packets... (Press Ctrl+C to stop)")

    try:
    while True:
    packet = generate_packet()
    display_packet(packet)
    time.sleep(1) # Simulate delay between packet captures
    except KeyboardInterrupt:
    print("\nStopped packet capture.")

    if __name__ == "__main__":
    main()
  • Hangman

    import random

    def get_password_and_hint():
    """Return a random password with its corresponding hint."""
    passwords = {
    "Alice": "Name",
    "Paris": "Place",
    "Eiffel": "Thing",
    "Python": "Programming Language",
    "Giraffe": "Animal",
    "Mount Everest": "Place",
    "Chocolate": "Food",
    "Titanic": "Historical Event"
    }
    password, hint = random.choice(list(passwords.items()))
    return password, hint

    def display_current_state(password, guessed_letters):
    """Display the current state of the guessed password."""
    return ' '.join(letter if letter in guessed_letters else '_' for letter in password)

    def main():
    password, hint = get_password_and_hint()
    guessed_letters = set()
    attempts = 6 # Number of incorrect guesses allowed

    print("Welcome to the Hangman Password Guessing Game!")
    print(f"Hint: {hint}")

    while attempts > 0:
    print(display_current_state(password, guessed_letters))
    guess = input("Guess a letter: ").strip()

    if len(guess) != 1 or not guess.isalpha():
    print("Please enter a single letter.")
    continue

    if guess in guessed_letters:
    print("You've already guessed that letter.")
    continue

    guessed_letters.add(guess)

    if guess in password:
    print("Good guess!")
    else:
    attempts -= 1
    print(f"Incorrect guess. You have {attempts} attempts left.")

    if all(letter in guessed_letters for letter in password):
    print(f"Congratulations! You've guessed the password '{password}'.")
    break

    if attempts == 0:
    print(f"Game over! The password was '{password}'.")

    if __name__ == "__main__":
    main()
  • Digital Forensics Artifact Generator

    import random
    from datetime import datetime, timedelta

    def generate_artifacts(num_logs, num_history, num_files):
    """Generate log entries, browser history, and file metadata."""
    logs, history, metadata = [], [], []

    urls = [
    "http://example.com",
    "http://malicious-site.com",
    "http://banking-site.com",
    "http://socialmedia.com",
    "http://shopping-site.com"
    ]

    for i in range(num_logs):
    timestamp = datetime.now() - timedelta(days=random.randint(1, 30), hours=random.randint(0, 23))
    logs.append(f"{timestamp.strftime('%Y-%m-%d %H:%M:%S')} - INFO - User logged in")

    for i in range(num_history):
    timestamp = datetime.now() - timedelta(days=random.randint(1, 30), hours=random.randint(0, 23))
    duration = random.randint(1, 300)
    url = random.choice(urls)
    history.append(f"{timestamp.strftime('%Y-%m-%d %H:%M:%S')} - {url} - {duration} seconds")

    for i in range(num_files):
    filename = f"file_{i+1}.txt"
    created_time = datetime.now() - timedelta(days=random.randint(1, 30))
    modified_time = created_time + timedelta(days=random.randint(0, 10))
    size = random.randint(1000, 50000)
    metadata.append(f"Filename: {filename}, Created: {created_time}, Modified: {modified_time}, Size: {size} bytes")

    return logs, history, metadata

    def save_artifacts(logs, history, metadata):
    """Save artifacts to files."""
    with open("log_entries.txt", "w") as log_file:
    log_file.write("\n".join(logs))
    with open("browser_history.txt", "w") as history_file:
    history_file.write("\n".join(history))
    with open("file_metadata.txt", "w") as metadata_file:
    metadata_file.write("\n".join(metadata))

    def main():
    print("Digital Forensics Artifact Generator")

    num_logs = int(input("Enter the number of log entries to generate: "))
    num_history = int(input("Enter the number of browser history entries to generate: "))
    num_files = int(input("Enter the number of file metadata entries to generate: "))

    logs, history, metadata = generate_artifacts(num_logs, num_history, num_files)
    save_artifacts(logs, history, metadata)

    print("\nArtifacts generated and saved to 'log_entries.txt', 'browser_history.txt', and 'file_metadata.txt'.")

    if __name__ == "__main__":
    main()
  • Phishing Email Generator

    import random

    def generate_phishing_email(sender_name, sender_email):
    """Generate a fake phishing email."""
    subjects = [
    "Urgent: Your Account Needs Verification",
    "You've Won a $1000 Gift Card!",
    "Your Invoice is Attached",
    "Action Required: Update Your Payment Information",
    "Congratulations! You've Been Selected!"
    ]

    bodies = [
    f"Dear Customer,\n\nWe noticed suspicious activity in your account. Please click the link below to verify your account:\nhttp://fake-link.com\n\nBest,\n{sender_name}",
    f"Congratulations! You've won a $1000 gift card. Claim your prize by clicking here:\nhttp://fake-link.com\n\nSincerely,\n{sender_name}",
    f"Attached is your invoice. Please review it immediately.\n\nBest,\n{sender_name}",
    f"Your payment information needs to be updated. Click here:\nhttp://fake-link.com\n\nThank you,\n{sender_name}",
    f"You've been selected for a special offer! Click the link to redeem:\nhttp://fake-link.com\n\nCheers,\n{sender_name}"
    ]

    email_subject = random.choice(subjects)
    email_body = random.choice(bodies)

    email = f"From: {sender_name} <{sender_email}>\nSubject: {email_subject}\n\n{email_body}"
    return email

    def main():
    print("Phishing Email Generator")

    sender_name = input("Enter fake sender name: ")
    sender_email = input("Enter fake sender email: ")

    phishing_email = generate_phishing_email(sender_name, sender_email)

    print("\n--- Generated Phishing Email ---")
    print(phishing_email)

    # Save to file
    with open("phishing_email.txt", "w") as file:
    file.write(phishing_email)

    print("\nPhishing email saved to 'phishing_email.txt'.")

    if __name__ == "__main__":
    main()
  • Password Strength Scanner and Breach Checker

    import requests
    import re
    import hashlib # Import hashlib for SHA-1 hashing

    def check_breach(password):
    """Check if the password has been exposed in data breaches using the HIBP API."""
    sha1_password = hashlib.sha1(password.encode()).hexdigest().upper()
    prefix = sha1_password[:5]
    suffix = sha1_password[5:]

    response = requests.get(f'https://api.pwnedpasswords.com/range/{prefix}')
    if response.status_code == 200:
    hashes = (line.split(':') for line in response.text.splitlines())
    return any(suffix == hash_suffix for hash_suffix, count in hashes)
    return False

    def assess_password_strength(password):
    """Assess the strength of the provided password."""
    strength = "Weak"
    if (len(password) >= 12 and
    re.search(r"[A-Z]", password) and
    re.search(r"[a-z]", password) and
    re.search(r"[0-9]", password) and
    re.search(r"[!@#$%^&*()_+]", password)):
    strength = "Strong"
    elif len(password) >= 8:
    strength = "Moderate"
    return strength

    def main():
    password = input("Enter a password to check: ")
    strength = assess_password_strength(password)
    print(f"Password Strength: {strength}")

    if check_breach(password):
    print("This password has been found in data breaches. Consider using a different password.")
    else:
    print("This password has not been found in data breaches.")

    if __name__ == "__main__":
    main()
  • Decoy Account Generator and Monitor

    import random
    import string
    import time

    def generate_creds(num_accounts):
    """Generate a list of decoy account credentials (username, password)."""
    return [(''.join(random.choices(string.ascii_lowercase + string.digits, k=8)),
    ''.join(random.choices(string.ascii_letters + string.digits, k=12))) for _ in range(num_accounts)]

    def monitor_access(accounts):
    """Simulate access attempts on decoy accounts and log unauthorized attempts."""
    with open("access_log.txt", "a") as log_file:
    for account in accounts:
    unauthorized = random.choice([True, False]) # Randomly determine if the attempt is unauthorized
    if unauthorized:
    log_file.write(f"Unauthorized access attempt on {account[0]}\n") # Log the attempt
    time.sleep(1) # Simulate delay for each access attempt

    def main():
    """Main function to prompt user for account count, generate accounts, and monitor access."""
    num_accounts = int(input("Enter the number of decoy accounts to create: ")) # Get user input for account count
    accounts = generate_creds(num_accounts) # Generate the specified number of decoy accounts
    print("Generated Decoy Accounts:", accounts) # Display generated accounts
    monitor_access(accounts) # Monitor access attempts on the generated accounts

    if __name__ == "__main__":
    main() # Execute the main function
  • Automated Threat Intelligence Aggregator

    import requests
    import pandas as pd
    import smtplib
    from email.mime.text import MIMEText

    # Function to fetch threat intelligence data
    def fetch_threat_data(api_url):
    response = requests.get(api_url)
    if response.status_code == 200:
    return response.json()
    else:
    print(f"Failed to fetch data from {api_url}")
    return None

    # Function to analyze threats and generate a report
    def analyze_threats(data):
    threats = pd.DataFrame(data)
    report = threats.describe() # Basic statistical summary
    return report

    # Function to send email alerts
    def send_alert(report):
    sender = "your_email@example.com"
    recipients = ["recipient@example.com"]
    subject = "Threat Intelligence Report"
    body = report.to_string()

    msg = MIMEText(body)
    msg['Subject'] = subject
    msg['From'] = sender
    msg['To'] = ", ".join(recipients)

    with smtplib.SMTP('smtp.example.com', 587) as server:
    server.starttls()
    server.login(sender, "your_password")
    server.sendmail(sender, recipients, msg.as_string())

    # Main function
    def main():
    # Example API endpoints (replace with actual threat intelligence APIs)
    api_urls = [
    "https://api.example.com/threats",
    "https://api.anotherexample.com/threats"
    ]

    all_data = []

    for api_url in api_urls:
    data = fetch_threat_data(api_url)
    if data:
    all_data.extend(data)

    if all_data:
    report = analyze_threats(all_data)
    print(report)
    send_alert(report)

    if __name__ == "__main__":
    main()
  • Incident Response Playbook Generator

    def generate_playbook():
    assets = input("What types of assets do you need to protect? (e.g., servers, databases): ")
    threats = input("What potential threats do you face? (e.g., malware, insider threats): ")
    response_steps = input("Outline your response steps (e.g., isolate affected systems): ")

    playbook = f"""
    Incident Response Playbook
    ---------------------------
    Assets to Protect: {assets}
    Potential Threats: {threats}
    Response Steps: {response_steps}

    Recommended Actions:
    1. Identify the scope of the incident.
    2. Contain the threat.
    3. Eradicate the cause.
    4. Recover affected systems.
    5. Conduct a post-incident review.
    """

    with open("incident_response_playbook.txt", "w") as file:
    file.write(playbook.strip())
    print("Incident response playbook generated as 'incident_response_playbook.txt'.")

    if __name__ == "__main__":
    generate_playbook()