Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>OS Health Checker</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background: #f4f6f9;
@Thenila
Thenila / app.py
Last active September 30, 2025 15:38
from flask import Flask, request, jsonify, send_from_directory
import os
import paramiko
import datetime
app = Flask(__name__)
BASE_REPORT_DIR = os.path.join(os.path.dirname(__file__), "health_reports")
os.makedirs(BASE_REPORT_DIR, exist_ok=True)
import paramiko
# Required tools list
REQUIRED_TOOLS = ["python3", "curl", "wget", "htop"]
def run_remote_command(host, username, password, command):
"""Run a command on the remote server via SSH"""
try:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
@Thenila
Thenila / index.html
Last active September 30, 2025 14:05
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Remote OS Health Check</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.server { border: 1px solid #ccc; padding: 10px; margin-bottom: 10px; }
button { margin-top: 10px; }
.download-link { display: block; margin-top: 5px; }
@Thenila
Thenila / app.py
Created September 30, 2025 11:53
from flask import Flask, request, jsonify, render_template, send_file
import paramiko
import os
from datetime import datetime, timezone
import zipfile
app = Flask(__name__)
BASE_REPORT_DIR = "/home/thenila/health_reports"
# Ensure base directory exists
@Thenila
Thenila / index.html
Last active September 30, 2025 14:02
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Remote OS Health Check</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.server { border: 1px solid #ccc; padding: 10px; margin-bottom: 10px; }
button { margin-top: 10px; }
.download-link { display: block; margin-top: 5px; }
#!/usr/bin/env python3
import os
import subprocess
from datetime import datetime, timezone
# -----------------------------
# Timestamp & Report Directory
# -----------------------------
timestamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
from flask import Flask, request, jsonify
import paramiko
import os
app = Flask(__name__)
@app.route('/run_health_check', methods=['POST'])
def run_health_check():
data = request.json
target_ip = data.get("ip")
from flask import Flask, request, jsonify
import paramiko
import os
app = Flask(__name__)
@app.route('/run_health_check', methods=['POST'])
def run_health_check():
data = request.json
target_ip = data.get("ip")
#!/usr/bin/env python3
import os
import subprocess
from datetime import datetime
# ==========================
# Setup report directories
# ==========================
home_dir = os.path.expanduser("~")