ROOTPLOIT
Server: Apache
System: Linux node6122.myfcloud.com 6.14.3-x86_64-linode168 #1 SMP PREEMPT_DYNAMIC Mon Apr 21 19:47:55 EDT 2025 x86_64
User: bashacomputer (1004)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/bashacomputer/public_html/send.py
#!/usr/bin/env python3
import subprocess
import datetime
import json
import time

# --- Files ---
CONFIG_FILE = "config.json"
MAIL_LIST_FILE = "mailist.txt"
LETTER_FILE = "letter.html"
LOG_FILE = "sendmail_log.txt"

# --- Load configuration ---
with open(CONFIG_FILE, "r") as f:
    config = json.load(f)
FROM_NAME = config.get("from_name", "No Name")
FROM_EMAIL = "bashacomputer@barqfm.net"
SUBJECT = config.get("subject", "No Subject")
DELAY = 5  # configurable delay

# --- Load recipients ---
with open(MAIL_LIST_FILE, "r") as f:
    recipients = [line.strip() for line in f if line.strip()]

# --- Load email body ---
with open(LETTER_FILE, "r") as f:
    BODY_HTML = f.read()

# --- Logging function ---
def log_message(recipient, status):
    timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    entry = f"[{timestamp}] To: {recipient}, Status: {status}\n"
    with open(LOG_FILE, "a") as f:
        f.write(entry)

# --- Send email ---
def send_email(recipient):
    email_text = f"""To: {recipient}
Subject: {SUBJECT}
From: {FROM_NAME} <{FROM_EMAIL}>
Content-Type: text/html; charset=UTF-8

{BODY_HTML}
"""
    try:
        proc = subprocess.Popen(
            ["/usr/sbin/sendmail", "-t"],
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE
        )
        stdout, stderr = proc.communicate(email_text.encode())

        if proc.returncode == 0:
            log_message(recipient, "Accepted by sendmail")
            print(f"✅ {recipient} accepted by sendmail")
        else:
            log_message(recipient, f"Failed: {stderr.decode().strip()}")
            print(f"❌ {recipient} failed: {stderr.decode().strip()}")
    except Exception as e:
        log_message(recipient, f"Error: {str(e)}")
        print(f"❌ Exception for {recipient}: {str(e)}")

# --- Main loop ---
if __name__ == "__main__":
    for r in recipients:
        send_email(r)
        time.sleep(DELAY)  # delay between sends