Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /etc/script/ServerMonitor/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /etc/script/ServerMonitor/domain-monitor-DOWN-by-mail.py_29june26
import requests
import smtplib
import json
import os
import time
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from urllib.parse import urlparse

# ==============================
# CONFIG
# ==============================

websites_to_check = [
    "https://nirikshan.tatacapital.com/",
    "https://nirikshan-cron.tatacapital.com",
    "https://arukustech.com/",
    "https://hr.arukustech.com/",
    "https://mbmoms.com/",
    "https://murphybusiness.com/",
    "https://dev.arukustech.com/",
    "https://frontier.tatacapital.com/",
    "https://nirikshan-stg.tatacapital.com/",
    "https://engageu.tatacapital.com/",
    "https://frontier-cron.tatacapital.com/",
    "https://engage.tatacapital.com/",
    "https://engage-cron.tatacapital.com/",
    "https://nirikshan-stg.tatacapital.com/",
    "https://auditprod.midlandmicrofin.co.in/",
    "https://audituat.midlandmicrofin.co.in//"
]

sender_email = "Website Down Alert <uptime@arukustech.com>"
receiver_email = "hosting@arukustech.com"

SMTP_SERVER = "email-smtp.ap-south-1.amazonaws.com"
SMTP_PORT = 587

CRED_FILE = "/etc/secure/ses_credentials.json"
LOGO_PATH = "/etc/script/ServerMonitor/ArukusTech.png"

# ==============================
# LOAD CREDENTIALS
# ==============================

if not os.path.exists(CRED_FILE):
    raise Exception(f"Credential file not found: {CRED_FILE}")

with open(CRED_FILE, "r") as f:
    creds = json.load(f)

SMTP_USER = creds.get("username")
SMTP_PASS = creds.get("password")

# ==============================
# HELPERS
# ==============================

def clean_url(url):
    parsed = urlparse(url)
    return parsed.netloc

def send_email(url):
    name = clean_url(url)

    msg = MIMEMultipart()
    msg['From'] = sender_email
    msg['To'] = receiver_email
    msg['Subject'] = f"🚨 Website Down: {name}"

    # Attach logo safely
    if os.path.exists(LOGO_PATH):
        with open(LOGO_PATH, 'rb') as f:
            logo = MIMEImage(f.read())
            logo.add_header('Content-ID', '<company_logo>')
            msg.attach(logo)

    html = f"""
    <html>
    <body style="text-align:center;">
        <img src="cid:company_logo"><br><br>
        <h2 style="color:red;">Website Down Alert</h2>
        <p><b>{name}</b> is DOWN</p>
        <a href="{url}">Check Website</a>
        <p>This is an automated alert from Arukus Monitoring</p>
    </body>
    </html>
    """

    msg.attach(MIMEText(html, 'html'))

    try:
        server = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
        server.starttls()
        server.login(SMTP_USER, SMTP_PASS)
        server.sendmail(sender_email, receiver_email, msg.as_string())
        server.quit()
        print(f"Alert sent for {name}")
    except Exception as e:
        print("Email error:", str(e))

# ==============================
# MAIN
# ==============================

for url in websites_to_check:
    try:
        response = requests.get(url, timeout=5)

        if not (200 <= response.status_code < 400):
            send_email(url)

    except:
        send_email(url)

Youez - 2016 - github.com/yon3zu
LinuXploit