MOON
Server: Apache
System: Linux cloud.squadinventive.com 3.10.0-1160.119.1.el7.tuxcare.els5.x86_64 #1 SMP Fri Sep 6 06:34:34 UTC 2024 x86_64
User: wpk54ozo (1047)
PHP: 8.2.28
Disabled: NONE
Upload Files
File: //tmp/.lfisdfdfodfgdfg/ita/sec.py
import smtplib
import random

import uuid
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from random import randint

mailcnt = 0
changesmtp = 50

fsmtp = open("smtp.txt", "r")

while True:
    try:
        if mailcnt % changesmtp == 0:
            tmp = fsmtp.readline().strip().split()
            smtpsrv = tmp[0]
            user = tmp[1]
            password = tmp[2]
            port = tmp[3]
            port = int(port)
            smtpserver = smtplib.SMTP(smtpsrv,port)
            sender_email = user

            smtpserver.ehlo()
            smtpserver.starttls()
            smtpserver.login(user, password)

        femail = open("emailaddress.txt", "r")
        noemaialflag = False
        while True:
            receiver_email = femail.readline().strip()
            if receiver_email=="":
                noemaialflag = True
                break

            msg = MIMEMultipart("alternative")
            rand_subject = "Billing " + str(randint(0, 1000000)) + " - " + str(randint(0, 1000)) + " - " + str(randint(0, 100000))
            rand_subject = rand_subject +  "  <" + str(uuid.uuid4()) + sender_email + ">"

            msg['Subject'] = rand_subject

            msg['From'] = sender_email
            msg['To'] = receiver_email
            msg['Reply-To'] =  "THIS IS THE EMAIL I WANT TO CHANGE@domain.com"



            # write the HTML part
            f = open("msg.txt", "r")
            html = f.read().strip()
            f.close()

            # convert both parts to MIMEText objects and add them to the MIMEMultipart message
            msg.attach(MIMEText(html, "html"))

            try:
                smtpserver.sendmail(user, receiver_email, msg.as_string())
                print("Random subject "  + rand_subject)
                print("Sent email to "  + receiver_email + " successfully")
                mailcnt = mailcnt  + 1
            except Exception as e:
                print(e)
            if mailcnt % changesmtp == 0:
                tmp = fsmtp.readline().strip().split()
                smtpsrv = tmp[0]
                user = tmp[1]
                password = tmp[2]
                port = tmp[3]
                port = int(port)
                smtpserver = smtplib.SMTP(smtpsrv,port)
                sender_email = user

                smtpserver.ehlo()
                smtpserver.starttls()
                smtpserver.login(user, password)
        femail.close()
        if noemaialflag:
            break
        if mailcnt % changesmtp == 0:
            smtpserver.close()
    except Exception as ex:
        print(ex)

fsmtp.close()