From 239cc86ff4271ce21dd6066f595e328c63f685a6 Mon Sep 17 00:00:00 2001 From: Kenio de Souza Date: Fri, 5 Dec 2025 10:17:32 -0300 Subject: [PATCH] First commit --- .gitignore | 46 +++++++++++++++++++++++++++++++ main.py | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 37 +++++++++++++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 .gitignore create mode 100644 main.py create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..05291f8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,46 @@ +# Ambiente virtual +venv/ +.env +.env.* + +# Bytecode compilado +__pycache__/ +*.py[cod] +*$py.class + +# Arquivos temporários do sistema +.DS_Store +Thumbs.db + +# Logs e databases locais +*.log +*.sqlite3 + +# VSCode +.vscode/ + +# PyCharm +.idea/ + +# Arquivos de testes ou builds +*.coverage +htmlcov/ +coverage.xml +dist/ +build/ +.eggs/ +*.egg-info/ + +# Cache do pip +pip-wheel-metadata/ +*.egg +.cache/ +.tox/ + +# Arquivo s de conexão +config/database/firebird.json +storage/temp +storage/temp.json + +# Ignorar arquivos storage +storage/ \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..57ec1f1 --- /dev/null +++ b/main.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 + +# main.py +# Exibe informações agradáveis do servidor no terminal +# Comentários explicativos incluídos conforme sua preferência + +import platform +import psutil +import socket +from datetime import datetime + +def get_server_info(): + """\ Coleta informações do sistema operacional, hardware e rede. + """ + info = {} + + # Informações gerais do sistema + info["system"] = platform.system() + info["release"] = platform.release() + info["version"] = platform.version() + info["machine"] = platform.machine() + info["processor"] = platform.processor() + + # Informações da rede + hostname = socket.gethostname() + ip_address = socket.gethostbyname(hostname) + info["hostname"] = hostname + info["ip_address"] = ip_address + + # Informações de recursos + info["cpu_percent"] = psutil.cpu_percent(interval=1) + info["memory_percent"] = psutil.virtual_memory().percent + info["total_memory_gb"] = round(psutil.virtual_memory().total / (1024**3), 2) + info["uptime"] = datetime.now() - datetime.fromtimestamp(psutil.boot_time()) + + return info + + +def display_server_info(info): + """\ Exibe as informações no terminal de maneira estilizada. + """ + # Exibe horário do início do teste + now = datetime.now().strftime("%H:%M:%S") + print(f"Início do teste às {now}") + print("=" * 60) + print(" 🖥️ SERVER STATUS - INFORMACOES DO SERVIDOR") + print("=" * 60) + + print(f"📌 Sistema Operacional: {info['system']} {info['release']}") + print(f"📌 Versão: {info['version']}") + print(f"📌 Arquitetura: {info['machine']}") + print(f"📌 Processador: {info['processor']}") + print() + + print(f"🌐 Hostname: {info['hostname']}") + print(f"🌐 IP: {info['ip_address']}") + print() + + print(f"⚙️ Uso de CPU: {info['cpu_percent']}%") + print(f"⚙️ Uso de Memória: {info['memory_percent']}%") + print(f"⚙️ Memória Total: {info['total_memory_gb']} GB") + print(f"⚙️ Uptime: {str(info['uptime']).split('.')[0]}") + + print("=" * 60) + print(" Finalizado ✔️") + print("=" * 60) + + +if __name__ == "__main__": + info = get_server_info() + display_server_info(info) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..bfcba0a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,37 @@ +annotated-types==0.7.0 +anyio==4.10.0 +bcrypt==3.1.7 +cffi==2.0.0 +click==8.2.1 +colorama==0.4.6 +cryptography==46.0.3 +dnspython==2.7.0 +ecdsa==0.19.1 +email_validator==2.2.0 +fastapi==0.116.1 +firebird-base==2.0.2 +firebird-driver==2.0.2 +greenlet==3.2.4 +h11==0.16.0 +idna==3.10 +packaging==25.0 +passlib==1.7.4 +protobuf==5.29.5 +psutil==7.1.3 +pyasn1==0.6.1 +pycparser==2.22 +pydantic==2.11.7 +pydantic_core==2.33.2 +PyMySQL==1.1.2 +python-dateutil==2.9.0.post0 +python-jose==3.5.0 +pytz==2025.2 +rsa==4.9.1 +six==1.17.0 +sniffio==1.3.1 +SQLAlchemy==2.0.42 +sqlalchemy-firebird==2.1 +starlette==0.47.2 +typing-inspection==0.4.1 +typing_extensions==4.14.1 +uvicorn==0.35.0