Всем привет, копался у себя на хранилище и нашел старый скрипт для теста интернета что он умеет? 1. Он пингует сайт в переменной PING_HOST и выводит что получил, тоесть тест интернета 2. присылание запроса на сайт, можно сказать доп. тест интернета ну или просто присылатель запросов на сайты 3. Неофетч, спиженный неофетч который показывает информацию про систему знаю, что скрипт считай бесполезен, но может кому нибудь пригодится код import os import platform import psutil import socket import time from pyfiglet import Figlet RED = "\033[31m" RESET = "\033[0m" CLEAR = "\033[2J\033[H" PING_HOST = 'www.google.com' HTTP_METHODS = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'] def show_logo(): fig = Figlet(font="bulbhead") logo = fig.renderText('Progtest') print(f"{RED}{logo}{RESET}") def main_menu(): while True: show_logo() print(f"{RED}1. Internet test{RESET}") print(f"{RED}2. Send request on site{RESET}") print(f"{RED}3. pchar{RESET}") print(f"{RED}4. Credentials{RESET}") choice = input(f"{RED}enter: {RESET}").lower() if choice == '1': internet_test() elif choice == '2': send_request() elif choice == '3': pc_characteristics() elif choice == '4': credentials() elif choice == 'exit': exit() else: print(f"{RED}Invalid option!{RESET}") def credentials(): os.system('cls' if os.name == 'nt' else 'clear') print(f"{RED}Dimaproggramer{RESET}") print(f"{RED}Telegram channel: t.me/Dimaproggramer{RESET}") print(f"{RED}GitHub: github.com/dimaproggramer{RESET}") def internet_test(): while True: os.system('cls' if os.name == 'nt' else 'clear') try: response = os.system(f"ping -c 1 {PING_HOST}") if response == 0: print(f"{RED}Ping to {PING_HOST}: Successful{RESET}") else: print(f"{RED}Ping to {PING_HOST}: Failed{RESET}") except Exception as e: print(f"{RED}Failed to connect: {e}{RESET}") exit_input = input(f"{RED}enter(exit): {RESET}").lower() if exit_input == "exit": return def send_request(): while True: os.system('cls' if os.name == 'nt' else 'clear') print(f"{RED}Choose a method to send (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS){RESET}") request_type = input(f"{RED}enter(exit): {RESET}").upper() if request_type == 'EXIT': return if request_type in HTTP_METHODS: url = input(f"{RED}Please, enter a site{RESET}\n{RED}enter(exit): {RESET}") if url == 'exit': return try: hostname = url.replace('http://', '').replace('https://', '').split('/')[0] ip_address = socket.gethostbyname(hostname) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((ip_address, 80)) request = f"{request_type} / HTTP/1.1\r\nHost: {hostname}\r\n\r\n" sock.send(request.encode()) response = sock.recv(4096) print(f"{RED}Response: {response.decode()[:500]}{RESET}") sock.close() except Exception as e: print(f"{RED}Error sending request: {e}{RESET}") else: print(f"{RED}Invalid request method!{RESET}") exit_input = input(f"{RED}enter(exit): {RESET}").lower() if exit_input == "exit": return def pc_characteristics(): while True: os.system('cls' if os.name == 'nt' else 'clear') try: print(f"{RED}OS: {platform.system()}{RESET}") print(f"{RED}Platform: {platform.platform()}{RESET}") device_type = "Phone" if 'Android' in platform.platform() else "PC" print(f"{RED}Device: {device_type}{RESET}") print(f"{RED}Kernel: {platform.release()}{RESET}") print(f"{RED}Processor: {platform.processor()}{RESET}") print(f"{RED}RAM: {psutil.virtual_memory().total / (1024 ** 3):.2f} GB{RESET}") print(f"{RED}ROM: {psutil.disk_usage('/').total / (1024 ** 3):.2f} GB{RESET}") print(f"{RED}{' '*10}{RESET}") for i in range(16): print(f"\033[48;5;{i}m \033[0m", end=" ") print(RESET) except Exception: print(f"{RED}Your device does not give access to characteristics!{RESET}") exit_input = input(f"{RED}enter(exit): {RESET}").lower() if exit_input == "exit": return if __name__ == "__main__": main_menu() Python import os import platform import psutil import socket import time from pyfiglet import Figlet RED = "\033[31m" RESET = "\033[0m" CLEAR = "\033[2J\033[H" PING_HOST = 'www.google.com' HTTP_METHODS = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'] def show_logo(): fig = Figlet(font="bulbhead") logo = fig.renderText('Progtest') print(f"{RED}{logo}{RESET}") def main_menu(): while True: show_logo() print(f"{RED}1. Internet test{RESET}") print(f"{RED}2. Send request on site{RESET}") print(f"{RED}3. pchar{RESET}") print(f"{RED}4. Credentials{RESET}") choice = input(f"{RED}enter: {RESET}").lower() if choice == '1': internet_test() elif choice == '2': send_request() elif choice == '3': pc_characteristics() elif choice == '4': credentials() elif choice == 'exit': exit() else: print(f"{RED}Invalid option!{RESET}") def credentials(): os.system('cls' if os.name == 'nt' else 'clear') print(f"{RED}Dimaproggramer{RESET}") print(f"{RED}Telegram channel: t.me/Dimaproggramer{RESET}") print(f"{RED}GitHub: github.com/dimaproggramer{RESET}") def internet_test(): while True: os.system('cls' if os.name == 'nt' else 'clear') try: response = os.system(f"ping -c 1 {PING_HOST}") if response == 0: print(f"{RED}Ping to {PING_HOST}: Successful{RESET}") else: print(f"{RED}Ping to {PING_HOST}: Failed{RESET}") except Exception as e: print(f"{RED}Failed to connect: {e}{RESET}") exit_input = input(f"{RED}enter(exit): {RESET}").lower() if exit_input == "exit": return def send_request(): while True: os.system('cls' if os.name == 'nt' else 'clear') print(f"{RED}Choose a method to send (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS){RESET}") request_type = input(f"{RED}enter(exit): {RESET}").upper() if request_type == 'EXIT': return if request_type in HTTP_METHODS: url = input(f"{RED}Please, enter a site{RESET}\n{RED}enter(exit): {RESET}") if url == 'exit': return try: hostname = url.replace('http://', '').replace('https://', '').split('/')[0] ip_address = socket.gethostbyname(hostname) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((ip_address, 80)) request = f"{request_type} / HTTP/1.1\r\nHost: {hostname}\r\n\r\n" sock.send(request.encode()) response = sock.recv(4096) print(f"{RED}Response: {response.decode()[:500]}{RESET}") sock.close() except Exception as e: print(f"{RED}Error sending request: {e}{RESET}") else: print(f"{RED}Invalid request method!{RESET}") exit_input = input(f"{RED}enter(exit): {RESET}").lower() if exit_input == "exit": return def pc_characteristics(): while True: os.system('cls' if os.name == 'nt' else 'clear') try: print(f"{RED}OS: {platform.system()}{RESET}") print(f"{RED}Platform: {platform.platform()}{RESET}") device_type = "Phone" if 'Android' in platform.platform() else "PC" print(f"{RED}Device: {device_type}{RESET}") print(f"{RED}Kernel: {platform.release()}{RESET}") print(f"{RED}Processor: {platform.processor()}{RESET}") print(f"{RED}RAM: {psutil.virtual_memory().total / (1024 ** 3):.2f} GB{RESET}") print(f"{RED}ROM: {psutil.disk_usage('/').total / (1024 ** 3):.2f} GB{RESET}") print(f"{RED}{' '*10}{RESET}") for i in range(16): print(f"\033[48;5;{i}m \033[0m", end=" ") print(RESET) except Exception: print(f"{RED}Your device does not give access to characteristics!{RESET}") exit_input = input(f"{RED}enter(exit): {RESET}").lower() if exit_input == "exit": return if __name__ == "__main__": main_menu()
ну, такое себе, но для теста сети и проверки инфы о системе сойдёт при условии, что ты понимаешь, что делаешь, и не лезешь куда не надо