Got Bored, Made a Python Multi-Tool

Was feeling EXTREMELY bored, so I threw together this Python multi-tool that does random useful(ish) things:

# Basically random utilities
# Made when I had nothing better to do at 1AM
import os, socket, subprocess, etc...

What It Can Do:

  • Scan your network (see who’s connected)
  • Show full system specs (CPU, RAM, disks)
  • Check if websites are down
  • Clean temp files & flush DNS
  • Port scanning (for… research purposes)
  • And like 5 other random things

Why?

  1. Boredom :sob: :broken_heart:
  2. Wanted to practice Python
  3. Now I have a toolbox for when I’m too lazy to Google simple tasks

Fun Features:

  • Fancy loading animation (because why not)
  • Pretends to be β€œhacker tools” but really just runs basic commands
  • Has that nostalgic β€œcoded in one sitting” energy
# How to use:
python {wtv u name the file}.py
# (Requires Python + some courage + brain cells)

Not claiming it’s revolutionary - just a fun little project that might actually be useful. Let me know if you encounter bugs or wtv

(Disclaimer: No, it won’t hack the Pentagon. Yes, it might break if you sneeze wrong.) :skull:


Source Code:

import os
import platform
import socket
import subprocess
import time
import urllib.request
import re
import ipaddress
import threading
import shutil
import json

def clear_screen():
    os.system('cls' if os.name == 'nt' else 'clear')

def set_title(title):
    if os.name == 'nt':
        os.system(f'title {title}')
    else:
        print(f'\033]2;{title}\033[0m', end='', flush=True)

def loading_animation():
    loading_messages = [
        "Loading...",
        "Please wait while the tools are being initialized.",
    ]
    for i in range(4):
        clear_screen()
        print("\n\n\n", f"{loading_messages[0]:^48}", "\n", f"{loading_messages[1]:^48}", "\n\n", f"[{'=' * (i * 2) + '-' * (10 - i * 2)}]", f"{i * 20 + 10}%", sep="\n")
        time.sleep(0.2)

def display_menu():
    print(
        "\n",
        f"{'Python Multi-Tool':^48}",
        "\n",
        "╔══════════════════════════════════════════════════════════════╗\n",
        "β•‘                                                              β•‘\n",
        "β•‘  1. System Specs Viewer            5. Ping & Speed Test      β•‘\n",
        "β•‘  2. Network Scanner                6. Website Status Checker β•‘\n",
        "β•‘  3. Process Manager                7. IP & Geolocation Finderβ•‘\n",
        "β•‘  4. Startup Manager                8. Port Scanner           β•‘\n",
        "β•‘  9. Download Manager               9. PC Cleaner             β•‘\n",
        "β•‘  0. Exit                                                     β•‘\n",
        "β•‘                      @sin on x64.gg                          β•‘\n",
        "β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•\n",
    )

def get_choice():
    while True:
        try:
            choice = int(input(f"{'  Enter your choice: ':<48}"))
            if 0 <= choice <= 9:
                return choice
            else:
                print("Invalid choice. Please enter a number between 0 and 10.")
        except ValueError:
            print("Invalid input. Please enter a number.")

def system_specs():
    clear_screen()
    print(f"{'System Specifications:':^48}\n")
    print(f"{'Operating System:':<30} {platform.system()} {platform.release():<30}")
    print(f"{'CPU:':<30} {platform.processor():<30}")
    try:
        total_memory = os.popen("wmic computersystem get TotalPhysicalMemory").read().split()[1]
        print(f"{'RAM:':<30} {int(total_memory) / (1024 ** 2):.2f} MB")
    except Exception:
        print("RAM: Could not retrieve information")

    print("Storage:")
    try:
        disks = os.popen("wmic diskdrive get model,size").read().strip().split('\n')[1:]
        for disk in disks:
            if disk:
                model, size = disk.split()
                print(f"  {'Model:':<30} {model:<30}  {'Size:':<30} {int(size) / (1024 ** 3):.2f} GB")
    except Exception:
        print("  Could not retrieve disk information")

    print("Network:")
    try:
        hostname = socket.gethostname()
        ip_address = socket.gethostbyname(hostname)
        print(f"{'Hostname:':<30} {hostname:<30}")

        try:
            url = 'http://ip-api.com/json'
            response = urllib.request.urlopen(url, timeout=10)
            data = json.load(response)
            print(f"{'IP Address:':<30} {data.get('query', 'N/A'):<30}")
            print(f"{'City:':<30} {data.get('city', 'N/A'):<30}")
            print(f"{'Region:':<30} {data.get('regionName', 'N/A'):<30}")
            print(f"{'Country:':<30} {data.get('country', 'N/A'):<30}")
            print(f"{'Latitude:':<30} {data.get('lat', 'N/A'):<30}")
            print(f"{'Longitude:':<30} {data.get('lon', 'N/A'):<30}")
            print(f"{'ISP:':<30} {data.get('isp', 'N/A'):<30}")
        except urllib.error.URLError as e:
            print(f"  Error retrieving IP information: {e}")
        except json.JSONDecodeError:
            print("  Error decoding IP information.")
        except socket.timeout:
            print("  Timeout error while retrieving IP information.")
        except Exception as e:
            print(f"  An unexpected error occurred: {e}")

    except Exception:
        print("  Could not retrieve network information")

    input("\nPress Enter to return to the main menu...")



def network_scan():
    clear_screen()
    print(f"{'Network Scanner:':^48}\n")
    try:
        arp_result = subprocess.check_output(['arp', '-a']).decode('utf-8')
        print("Connected Devices:\n")
        print(arp_result)
    except Exception as e:
        print(f"Error occurred during network scan: {e}")
    input("\nPress Enter to return to the main menu...")

def process_manager():
    clear_screen()
    print(f"{'Process Manager:':^48}\n")
    try:
        tasklist_result = subprocess.check_output(['tasklist']).decode('utf-8')
        print("Current Processes:\n")
        print(tasklist_result)
    except Exception as e:
        print(f"Error fetching process list: {e}")

    process_choice = input("\nEnter process ID (PID) to kill, or Enter to return: ")

    if process_choice:
        if  process_choice.isdigit():
            try:
                subprocess.run(['taskkill', '/f', '/pid', process_choice], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
                print(f"Successfully terminated process with PID {process_choice}.")
            except subprocess.CalledProcessError:
                print(f"Failed to kill process with PID {process_choice}. Process may not exist or insufficient permissions.")
        else:
            print("Invalid input. Please enter a valid PID or Enter to return.")
    input("\nPress Enter to return to the main menu...")



def startup_manager():
    clear_screen()
    print(f"{'Startup Manager:':^48}\n")
    try:
        startup_programs = os.popen("wmic startup list brief").read().strip().split('\n')[1:]
        print("Startup Programs:\n")
        for program in startup_programs:
            if program:
                print(program)
    except Exception as e:
        print(f"Error retrieving startup programs: {e}")

    print("\nOptions:")
    print("  - To disable: Type 'd' followed by the startup item name")
    print("  - To enable: Type 'e' followed by the startup item name")
    print("  - To return: Press Enter")

    startup_choice = input("\nEnter choice: ")

    if startup_choice:
        action = startup_choice[0].lower()
        item_name = startup_choice[1:].strip()
        if action in ('d', 'e') and item_name:
            if action == 'd':
                print(f"Attempting to disable: {item_name}")
                try:
                    subprocess.run(['reg', 'query', 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', '/v', item_name], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
                    subprocess.run(['reg', 'add', 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce', '/v', f"{item_name}.bak", '/d', f'reg delete HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /v "{item_name}" /f', '/f'], check=True)
                    print(f"Disabled startup program: {item_name}")
                except subprocess.CalledProcessError:
                    print("Startup item not found.")
            elif action == 'e':
                print(f"Attempting to enable: {item_name}")
                try:
                    subprocess.run(['reg', 'query', 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce', '/v', f"{item_name}.bak"], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
                    subprocess.run(['reg', 'delete', 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce', '/v', f"{item_name}.bak", '/f'], check=True)
                    print(f"Enabled startup program: {item_name}")
                except subprocess.CalledProcessError:
                    print("Startup item not found.")
        else:
            print("Invalid input format.")
    input("\nPress Enter to return to the main menu...")

def ping_and_speed_test():
    clear_screen()
    print(f"{'Ping & Speed Test Tool:':^48}\n")
    print("Pinging google.com:")
    try:
        ping_result = subprocess.run(['ping', '-n', '5', 'google.com'], capture_output=True, text=True).stdout
        print(ping_result)
    except Exception as e:
        print(f"Error occurred during ping test: {e}")

    print("\nPerforming a basic speed test:")
    print("Downloading test file...")
    start_time = time.time()
    try:
        urllib.request.urlretrieve("http://www.google.com", filename="speed_test_file.html")
        end_time = time.time()
        download_time = end_time - start_time
        file_size = os.path.getsize("speed_test_file.html")
        speed_kbps = (file_size / download_time) * 8 / 1024 if download_time else 0
        print(f"Downloaded in {download_time:.2f} seconds.")
        print(f"Download speed: {speed_kbps:.2f} Kbps")
        os.remove("speed_test_file.html")
    except Exception as e:
        print(f"Error occurred during speed test: {e}")
    input("\nPress Enter to return to the main menu...")


def website_status_checker():
    clear_screen()
    print(f"{'Website Status Checker:':^48}\n")
    website = input("Enter website URL (e.g., google.com): ")
    if not website:
        return
    print(f"\nChecking status of {website}:")
    try:
        if not website.startswith("http://") and not website.startswith("https://"):
            website = "https://" + website
        req = urllib.request.urlopen(website, timeout=10)
        if req.getcode() == 200:
            print(f"{website} is online.")
        else:
            print(f"{website} is online, but returned status code {req.getcode()}.")
    except urllib.error.URLError as e:
        print(f"{website} appears to be offline or not responding. Error: {e}")
    except socket.timeout:
        print(f"{website} appears to be offline or not responding. Connection timed out.")
    except Exception as e:
        print(f"An unexpected error occurred: {e}")

    input("\nPress Enter to return to the main menu...")

def ip_and_geolocation_finder():
    clear_screen()
    print(f"{'IP & Geolocation Finder:':^48}\n")
    print("Getting your external IP address...")
    try:
        external_ip = urllib.request.urlopen('http://ifconfig.me/ip', timeout=10).read().decode('utf-8').strip()
        print(f"Your external IP address is: {external_ip}")
    except Exception as e:
        print(f"Error retrieving IP address: {e}")
        print("Could not retrieve external IP address.")

    print("\nNote: This tool can only retrieve your IP address. For geolocation information,\n"
          "you would need to use an online service or API.")
    input("\nPress Enter to return to the main menu...")

def is_valid_ip(host):
    try:
        ipaddress.ip_address(host)
        return True
    except ValueError:
        return False

def port_scan():
    clear_screen()
    print(f"{'Port Scanner:':^48}\n")
    host = input("Enter host (IP or domain): ")
    if not host:
        return

    if not is_valid_ip(host):
        try:
            socket.gethostbyname(host)
        except socket.gaierror:
            print("Invalid host or domain name.")
            input("Press Enter to return to the main menu...")
            return

    port_range_input = input("Enter port to scan (e.g., 80) or range start port: ")
    if not port_range_input:
        return

    if "-" in port_range_input:
        try:
            start_port, end_port = map(int, port_range_input.split("-"))
        except ValueError:
            print("Invalid port range format. Please use 'start-end'.")
            input("Press Enter to return to the main menu...")
            return
    else:
        try:
            start_port = int(port_range_input)
            end_port = int(input("Enter end port (leave blank for single port): ") or start_port)
        except ValueError:
            print("Invalid port number.")
            input("Press Enter to return to the main menu...")
            return

    print(f"\nScanning port(s) {start_port} to {end_port} on {host}...")

    open_ports = []
    def scan_port(host, port):
        try:
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sock.settimeout(0.5)
            result = sock.connect_ex((host, port))
            if result == 0:
                open_ports.append(port)
            sock.close()
        except Exception:
            pass

    threads = []
    for port in range(start_port, end_port + 1):
        thread = threading.Thread(target=scan_port, args=(host, port))
        threads.append(thread)
        thread.start()

    for thread in threads:
        thread.join()

    if open_ports:
        print("\nOpen Ports:")
        for port in open_ports:
            print(f"Port {port}: Open")
    else:
        print("\nNo open ports found.")

    input("\nPress Enter to return to the main menu...")


def download_manager():
    clear_screen()
    print(f"{'Download Manager:':^48}\n")
    url = input("Enter file URL: ")
    if not url:
        return

    filename = input("Enter filename to save as (or press Enter to use the filename from the URL): ")
    if not filename:
        filename = os.path.basename(url)

    print(f"\nDownloading {url} to {filename}...")
    try:
        urllib.request.urlretrieve(url, filename)
        print("Download complete!")
    except Exception as e:
        print(f"Error downloading file: {e}")
    input("\nPress Enter to return to the main menu...")

def pc_cleaner():
    clear_screen()
    print(f"{'PC Cleaner:':^48}\n")
    print("Cleaning temporary files...")
    try:
        temp_folder = os.environ.get("TEMP")
        if temp_folder:
            for file_name in os.listdir(temp_folder):
                file_path = os.path.join(temp_folder, file_name)
                try:
                    if os.path.isfile(file_path) or os.path.islink(file_path):
                        os.unlink(file_path)
                    elif os.path.isdir(file_path):
                        shutil.rmtree(file_path)
                except Exception as e:
                    print(f"Error deleting {file_path}: {e}")
        print("Temporary files cleaned.")
    except Exception as e:
        print(f"Error cleaning temporary files: {e}")

    print("\nCleaning log files...")
    try:
        log_folders = [
            os.path.join(os.environ.get("SystemRoot"), "Logs"),
            os.path.join(os.environ.get("SystemRoot"), "System32", "LogFiles"),
        ]
        for log_folder in log_folders:
            if os.path.exists(log_folder):
                for file_name in os.listdir(log_folder):
                    file_path = os.path.join(log_folder, file_name)
                    try:
                        if os.path.isfile(file_path):
                            os.remove(file_path)
                    except Exception as e:
                        print(f"Error deleting {file_path}: {e}")
        print("Log files cleaned.")
    except Exception as e:
        print(f"Error cleaning log files: {e}")

    print("\nFlushing DNS...")
    try:
        if os.name == 'nt':
            subprocess.run(['ipconfig', '/flushdns'], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
        else:
            subprocess.run(['sudo', 'systemd-resolve', '--flush-caches'], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
        print("DNS flushed.")
    except Exception as e:
        print(f"Error flushing DNS: {e}")
    input("\nPress Enter to return to the main menu...")
def main():
    set_title("Python Multi-Tool")
    loading_animation()
    while True:
        clear_screen()
        display_menu()
        choice = get_choice()
        if choice == 1:
            system_specs()
        elif choice == 2:
            network_scan()
        elif choice == 3:
            process_manager()
        elif choice == 4:
            startup_manager()
        elif choice == 5:
            ping_and_speed_test()
        elif choice == 6:
            website_status_checker()
        elif choice == 7:
            ip_and_geolocation_finder()
        elif choice == 8:
            port_scan()
        elif choice == 9:
            pc_cleaner()
        elif choice == 0:
            clear_screen()
            print("Exiting...")
            time.sleep(2)
            break

if __name__ == "__main__":
    main()


β€œWhen boredom strikes, code random utilities” - sun tzu or sum shit idk :skull:

1 Like

i dont like python but good work

Curious: Why dont you like python?

1 Like

i dont like python because i like js. there are tradeoffs u have to make in this world, and that is one of them.

Oh my god, I love JS It feels simpler to use than Python. I sometimes struggle with figuring out stupid errors in Python.

1 Like