Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- # Filename: loading_screen.py
- # Version: 1.0.0
- # Author: Jeoi Reqi
- """
- Description:
- - This script gathers various system information essential for network management and troubleshooting.
- It retrieves the following details:
- - Public IP address:
- Obtained from an external API endpoint.
- - User details:
- Includes the username currently logged into the system.
- - Computer name:
- Retrieves the local computer's name.
- - Operating system:
- Fetches information about the current operating system.
- - Wi-Fi network information:
- Retrieves SSIDs (Service Set Identifiers) and passwords of previously saved Wi-Fi networks on the machine.
- - It presents this information using a simulated loading effect, enhancing user experience with a progress bar visual representation.
- Requirements:
- - Python 3.x
- - The Following Modules:
- - json
- - urllib
- - subprocess
- - colorama
- Functions:
- - get_wifi_passwords():
- Retrieves SSIDs and passwords of saved Wi-Fi networks on the machine.
- - loading():
- Displays system information with a loading bar effect, including IP,
- username, PC name, OS, and Wi-Fi information.
- Usage:
- - Ensure Python 3.x is installed.
- - Install required modules using pip (if not already installed):
- EXAMPLE:
- 'pip install colorama'
- - Run the script.
- Additional Notes:
- - The loading function clears the screen and displays information in a loop,
- simulating a loading process with a progress bar.
- - This script requires administrative privileges on Windows to retrieve Wi-Fi passwords.
- """
- import os
- import time
- import random
- from json import load
- from urllib.request import urlopen
- import subprocess
- from colorama import init, Fore, Style
- # Initialize colorama
- init(autoreset=True)
- def get_wifi_passwords():
- """
- Retrieves the SSIDs and passwords of saved Wi-Fi networks on the machine.
- Returns:
- wifi_data (str): A formatted string containing SSIDs and passwords.
- """
- wifi_data = ""
- try:
- # Get the list of Wi-Fi profiles
- wifi_profiles = subprocess.check_output("netsh wlan show profiles", shell=True, text=True).split('\n')
- profiles = [line.split(":")[1].strip() for line in wifi_profiles if "All User Profile" in line]
- for profile in profiles:
- # Get the Wi-Fi password for each profile
- wifi_details = subprocess.check_output(f"netsh wlan show profile name=\"{profile}\" key=clear", shell=True, text=True).split('\n')
- password = None
- for line in wifi_details:
- if "Key Content" in line:
- password = line.split(":")[1].strip()
- break
- wifi_data += f"SSID: {profile}, Password: {password if password else 'None'}\n"
- except Exception as e:
- wifi_data += f"Error retrieving Wi-Fi passwords: {e}\n"
- return wifi_data
- def loading():
- """
- Displays system information with a loading bar effect.
- Retrieves the public IP, username, computer name, operating system, and Wi-Fi information,
- then displays this information while simulating a loading process with a progress bar.
- """
- # Gather system information
- ip_info = load(urlopen('https://api.myip.com/'))
- wifi_info = get_wifi_passwords()
- img = f"""
- IP: {ip_info['ip']}
- Username: {os.getlogin()}
- PC Name: {os.getenv('COMPUTERNAME')}
- Operating System: {os.getenv('OS')}
- Known Wi-Fi Networks + Passwords:
- {wifi_info}
- """
- # Display system information with a loading bar
- for i in range(40):
- os.system('cls' if os.name == 'nt' else 'clear') # Clear the screen
- print(img)
- progress = (Fore.GREEN + "#" * (i + 1) + Style.RESET_ALL).ljust(40, '-')
- print(f"[{progress}]")
- time.sleep(random.uniform(0.025, 0.075)) # Random delay between 0.025 and 0.075 seconds
- if __name__ == '__main__':
- loading()
- print("\n\n\tAll processes completed.\n\n\tExiting Program... GoodBye!\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement