我想发送一封电子邮件给病毒总量包含一个中国IP地址和一些我在Linux系统上发现的恶意软件。我一直受到攻击,并且对如何在bash中自动执行发送过程感到好奇。
在bash中尝试使用mail命令无效。
也许将此python脚本从https://www.virustotal.com/fr/documentation/email-submissions/转换为bash:
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders
from email.Utils import formatdate
msg = MIMEMultipart()
mfrom = 'spam-me-not@virustotal.com'
mto = 'scan@virustotal.com'
msg['Subject'] = 'SCAN'
msg['From'] = mfrom
msg['To'] = mto
msg['Date'] = formatdate()
# Open the file to scan in binary mode
fp = open('/path/to/file', 'rb')
attachment = MIMEBase('application', 'octet-stream')
attachment.set_payload(fp.read())
encoders.encode_base64(attachment)
attachment.add_header('Content-Disposition', 'attachment;
filename="filename"')
fp.close()
msg.attach(attachment)
# Send the email via your own SMTP server.
s = smtplib.SMTP('smtp.yourserver.com')
s.sendmail(mfrom, mto, msg.as_string())
s.quit()
或者也许有一种免费的验证码方法可以从命令行报告恶意IP地址?