做做笔记
0x1调用第三方邮件服务
0x1.2 mailgun
1 2 3 4 5 6 7 8 9 10
|
import requests def send_simple_message(): return requests.post( "https://api.mailgun.net/v3/yourdomain/messages", auth=("api", "yourapi"), data={"from": "JMCTF Admin <mailgun@yourdomain>", "to": ["[email protected]"], "subject": "Hello", "text": "Testing some Mailgun awesomness!"}) send_simple_message()
|
0x1.2 qq
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
import requests import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.image import MIMEImage from email.header import Header def get_smtp(host, port, username, password): smtp = smtplib.SMTP_SSL(host, port) smtp.ehlo() smtp.login(username, password) return smtp def sendmail(): data = { 'host': "smtp.qq.com", 'port': 465 } data['username'] = "[email protected]" data['password'] = "*************"
smtp = get_smtp(**data) msg = MIMEText('Python 邮件发送测试...', 'plain', 'utf-8') msg['Subject'] = "Message from {0}".format("ctf_name") msg['From'] = '[email protected]' msg['To'] = '[email protected]' smtp.sendmail(msg['From'], [msg['To']], msg.as_string()) smtp.quit() print "Email sent" sendmail()
|
0x2 semdmail
1
|
echo "This is test mail" | sendmail -s 'Test mail' test@qq.com
|
FROM :blog.cfyqy.com | Author:cfyqy
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
点赞
https://cn-sec.com/archives/721797.html
复制链接
复制链接
-
左青龙
- 微信扫一扫
-
-
右白虎
- 微信扫一扫
-
评论