Walks

网络安全爱好者

Python3学习系列(四):编写属于自己的邮件伪造工具

《Python3学习系列(四):编写属于自己的邮件伪造工具》

前言:

相信有些人也看过一些渗透,邮件伪造然后钓鱼这个在渗透中也是经典技巧了,那么邮件伪造又是如何运作的呢?下面的文章将会为你揭示邮件伪造,看完这篇文章,你会发现,原来就是这样。


目录:

  • 0x01:邮件伪造原理

  • 0x02:处理流程

  • 0x03:代码实现

  • 0x04:逐行解析

 0x01 邮件伪造原理

利用的是SMTP协议,因为在SMTP协议里面,是不需要身份认证的,也就是邮件发送者和邮件显示的发送人不一定要一致,那为什么我们平时发送的邮件的邮件发送人和显示的发送人都是一致的呢?这是邮件服务商人为要求的,163,qq邮箱都是如此

 

 0x02 处理流程

  • 注册个邮箱,这里用网易163

 《Python3学习系列(四):编写属于自己的邮件伪造工具》 

  • 登陆邮箱

  • 进入设置

 《Python3学习系列(四):编写属于自己的邮件伪造工具》 

  • 打开SMTP服务

 《Python3学习系列(四):编写属于自己的邮件伪造工具》 

  • 设置授权码

这些只是代码之前的前奏,下面开始我们的工具编写   

0x03  代码编写 

# -*- coding: utf-8 -*-
'''
Program:邮件伪造
Function:伪造邮件发送工具

Version:Python3.6
Time:2017/10/13
Author:Walks
个人博客:http://www.bywalks.com
'''  
  
import smtplib  
import email.mime.multipart  
import email.mime.text  

#建立邮件对象  
msg = email.mime.multipart.MIMEMultipart()  
#添加数据,来自哪,去哪
msg['Subject'] = u'发送asd邮件时设置的标题asd'  
msg['From'] = '123asds@163.com'  
msg['To'] = 'xxx@qq.com'   
content = "你好啊今asdasda好日子,所以西乡说些阿萨德asdasd事情阿斯达所阿斯达所大所大大所大库拉索多拉还是打款哈手机打开哈金士顿哈见到过巴克斯降本增效变成你们准备下次找你没错吧红烧冬瓜 。" 
   
txt = email.mime.text.MIMEText(content,'text','utf-8')    
msg.attach(txt)  # 将多个子部分进行组合  

#防出错  
try:  
        smtp = smtplib.SMTP()
        # 连接到服务器
        smtp.connect('smtp.163.com', '25')
        # 用户名密码登录,密码为163邮箱的授权码
        smtp.login('bywalkss@163.com', 'XXX')
        # 发送邮件 
        smtp.sendmail('bywalkss@163.com', ['739327037@qq.com'], msg.as_string()) 
        smtp.quit()  
        print('邮件发送成功email has send out !')  
except Exception as e:  
    print(e)


0x04  逐行解析

# -*- coding: utf-8 -*-
'''
Program:邮件伪造
Function:伪造邮件发送工具

Version:Python3.6
Time:2017/10/13
Author:Walks
个人博客:http://www.bywalks.com
'''  

#导入两个库,用来发送邮件,multipart用来构造邮件,带附件的
import smtplib  
import email.mime.multipart  
import email.mime.text  

#建立邮件对象  
msg = email.mime.multipart.MIMEMultipart()  
#添加数据,来自哪,去哪
msg['Subject'] = u'发送asd邮件时设置的标题asd' 
#邮件显示的发送人 
msg['From'] = '123asds@163.com'  
#接受地
msg['To'] = 'XXX@qq.com' 
#发送的内容  
content = "你好啊今asdasda好日子,所以西乡说些阿萨德asdasd事情阿斯达所阿斯达所大所大大所大库拉索多拉还是打款哈手机打开哈金士顿哈见到过巴克斯降本增效变成你们准备下次找你没错吧红烧冬瓜 。" 
   
txt = email.mime.text.MIMEText(content,'text','utf-8')   
# 将多个子部分进行组合 
msg.attach(txt)    

#防出错  
try:  
        smtp = smtplib.SMTP()
        # 连接到服务器
        smtp.connect('smtp.163.com', '25')
        # 用户名密码登录,密码为163邮箱的授权码,自己设置的
        smtp.login('bywalkss@163.com', 'XXX')
        # 发送邮件(发送地,接受地,内容) 第二个参数必须为列表
        smtp.sendmail('bywalkss@163.com', ['XXX@qq.com'], msg.as_string()) 
        #退出
        smtp.quit()  
        print('邮件发送成功email has send out !')  
except Exception as e:
    #打印出错原因,可以查看出错代码  
    print(e)

两张成功图。这里为什么会显示代发,上面也说过了,邮件服务商要求,那么我们找一个小服务商是不是就行了?

《Python3学习系列(四):编写属于自己的邮件伪造工具》 《Python3学习系列(四):编写属于自己的邮件伪造工具》

转载请注明来自:www.bywalks.com

点赞
  1. leticia说道:

    :redface: 这个代发邮箱会暴露

    1. walks说道:

      服务商要求,不是协议要求

  2. 帝国之鹰说道:

    网易判断我是垃圾邮件怎么办?

  3. I have to express some thanks to the writer for bailing me out of this type of condition. As a result of surfing throughout the the web and seeing methods which are not productive, I was thinking my entire life was over. Being alive devoid of the strategies to the issues you've fixed through the article content is a crucial case, as well as those that might have adversely damaged my career if I had not discovered the blog. Your actual natural talent and kindness in controlling all the stuff was useful. I am not sure what I would have done if I had not discovered such a subject like this. I'm able to at this time relish my future. Thanks for your time so much for the impressive and sensible help. I will not think twice to propose your web page to anybody who should get tips on this matter.

  4. pandora charms说道:

    I would like to convey my appreciation for your generosity in support of all those that require guidance on that study. Your personal dedication to getting the solution along became really practical and have really helped employees just like me to reach their endeavors. Your entire warm and helpful report signifies a lot a person like me and still more to my colleagues. Warm regards; from each one of us.

  5. yeezy boost 350说道:

    My wife and i have been absolutely excited Louis managed to finish up his reports via the ideas he grabbed when using the blog. It's not at all simplistic to simply always be releasing tips and tricks that some others have been trying to sell. And we realize we need the blog owner to give thanks to for this. The entire explanations you have made, the simple blog menu, the relationships you can aid to create - it is mostly terrific, and it's helping our son in addition to us reckon that that issue is entertaining, and that is truly essential. Thank you for everything!

  6. Thanks a lot for providing individuals with such a brilliant opportunity to discover important secrets from here. It really is very excellent plus stuffed with a lot of fun for me and my office co-workers to visit the blog at the least 3 times weekly to find out the new guides you will have. Of course, I am always fascinated concerning the perfect information served by you. Some two points on this page are particularly the most beneficial we have had.

  7. A lot of thanks for your entire efforts on this blog. Kim enjoys setting aside time for investigations and it is obvious why. Almost all know all relating to the lively form you give practical information on the blog and as well as invigorate participation from people about this subject matter and our own girl is always understanding a lot of things. Enjoy the remaining portion of the new year. Your carrying out a tremendous job.

  8. converse outlet说道:

    Thanks a lot for giving everyone an exceptionally nice chance to read critical reviews from this blog. It is always so pleasurable and as well , jam-packed with a lot of fun for me personally and my office acquaintances to search your web site no less than thrice a week to study the newest tips you have. And lastly, we're always pleased for the awesome advice you give. Selected 3 tips on this page are undeniably the most beneficial we have had.

  9. yeezy boost说道:

    I truly wanted to compose a message to be able to thank you for some of the fantastic instructions you are placing at this website. My extensive internet research has now been compensated with good quality points to go over with my family and friends. I 'd claim that we visitors are truly blessed to be in a fantastic network with many awesome individuals with good ideas. I feel very much happy to have come across your site and look forward to plenty of more pleasurable minutes reading here. Thank you once more for a lot of things.

  10. hermes birkin说道:

    Thanks so much for giving everyone an exceptionally special possiblity to check tips from this site. It's always so cool and also full of fun for me and my office mates to visit your blog at minimum 3 times per week to see the new guides you have. Of course, I'm just certainly pleased with all the spectacular creative concepts served by you. Some 2 points in this posting are in reality the simplest I have had.

  11. golden goose说道:

    I precisely wanted to say thanks once again. I am not sure what I might have achieved in the absence of the solutions contributed by you over this subject matter. It previously was the depressing crisis for me personally, however , finding out a new specialised technique you treated that made me to leap for contentment. Now i'm happy for this support as well as believe you are aware of an amazing job you are accomplishing instructing other individuals using your site. I am certain you haven't encountered all of us.

  12. adidas outlet说道:

    I and also my guys came reading the good solutions located on the website then quickly came up with a horrible feeling I had not thanked the web site owner for those secrets. My women were definitely certainly glad to read through them and have now in actuality been loving these things. Thanks for really being so helpful and for getting some quality subject areas millions of individuals are really desperate to know about. My honest apologies for not expressing gratitude to earlier.

  13. jordan retro 12说道:

    Thank you a lot for giving everyone a very special chance to read articles and blog posts from this website. It can be very cool and full of amusement for me personally and my office co-workers to visit the blog a minimum of 3 times a week to see the fresh issues you have got. And indeed, I am at all times motivated with all the spectacular tactics served by you. Certain 1 tips in this posting are truly the very best we've had.

  14. I would like to express my thanks to this writer just for rescuing me from such a problem. After searching throughout the world wide web and getting things which are not powerful, I believed my entire life was gone. Existing devoid of the strategies to the issues you've fixed all through this write-up is a critical case, and the ones which could have adversely affected my entire career if I hadn't discovered your website. Your main natural talent and kindness in playing with all areas was invaluable. I am not sure what I would have done if I had not encountered such a point like this. It's possible to at this moment look forward to my future. Thanks a lot so much for the impressive and amazing help. I will not be reluctant to suggest your web blog to any person who would like assistance about this topic.

  15. Thanks a lot for providing individuals with a very splendid chance to check tips from this blog. It can be so sweet plus packed with a lot of fun for me personally and my office friends to visit your website more than three times per week to find out the new secrets you have got. And lastly, we are always astounded concerning the tremendous information you give. Selected 3 facts in this article are completely the most beneficial we have ever had.

  16. ysl handbags说道:

    Thank you a lot for giving everyone a very pleasant possiblity to read in detail from this blog. It is often so enjoyable plus full of a good time for me and my office co-workers to search your site at least three times in one week to find out the latest guides you will have. And definitely, I'm just certainly motivated considering the unique principles you give. Some 2 facts in this article are undoubtedly the simplest we've ever had.

  17. I simply desired to appreciate you again. I'm not certain the things I might have handled in the absence of the actual basics shown by you relating to such a subject. It previously was a very frightening circumstance in my view, but looking at your professional mode you treated that made me to leap for fulfillment. I'm happier for this work as well as expect you find out what a great job you are accomplishing teaching people thru your web blog. Probably you've never encountered any of us.

  18. Thanks for your whole hard work on this blog. My aunt takes pleasure in getting into internet research and it is easy to see why. Most of us know all regarding the compelling way you convey effective techniques on your web site and therefore encourage response from others on that idea so our own princess is always learning a lot of things. Take advantage of the remaining portion of the new year. You're the one doing a fabulous job.

  19. My husband and i ended up being glad when Ervin could carry out his studies using the ideas he had from your own web pages. It is now and again perplexing to just happen to be giving for free steps the others have been selling. And now we understand we've got you to thank because of that. The main illustrations you have made, the simple web site navigation, the friendships you will help instill - it's mostly remarkable, and it is helping our son in addition to us understand that matter is interesting, and that's exceedingly fundamental. Many thanks for the whole thing!

  20. I simply desired to thank you very much again. I do not know the things I could possibly have made to happen without the entire information shared by you directly on such a subject matter. It was before an absolute terrifying setting for me personally, but being able to see the very skilled form you handled the issue took me to leap for happiness. I'm thankful for the support and pray you recognize what an amazing job you were doing instructing the others through a site. More than likely you haven't come across any of us.

  21. nike hyperdunk说道:

    I would like to express my appreciation to this writer for bailing me out of this particular incident. Just after searching throughout the search engines and coming across basics which were not helpful, I believed my life was over. Existing devoid of the answers to the difficulties you have solved as a result of your entire article is a critical case, as well as ones that would have negatively affected my entire career if I had not noticed your blog post. Your personal know-how and kindness in handling all the things was important. I don't know what I would've done if I had not discovered such a point like this. I am able to at this point relish my future. Thanks a lot so much for the impressive and effective guide. I will not think twice to suggest your web blog to anyone who wants and needs tips on this topic.

  22. I have to express thanks to the writer just for bailing me out of this particular setting. Just after researching through the the net and coming across tips that were not beneficial, I figured my life was gone. Living minus the strategies to the issues you have sorted out all through your guideline is a crucial case, and ones which may have negatively affected my entire career if I had not encountered the blog. Your good talents and kindness in dealing with all the pieces was invaluable. I don't know what I would've done if I had not encountered such a step like this. I can at this point look ahead to my future. Thanks for your time so much for this professional and sensible guide. I won't hesitate to recommend the sites to any individual who needs to have counselling about this problem.

  23. yeezy boost 350说道:

    I want to show my thanks to this writer for bailing me out of such a trouble. Right after surfing around through the online world and obtaining concepts which are not pleasant, I was thinking my life was done. Living without the presence of strategies to the problems you have solved by means of your good article is a serious case, and those that would have in a wrong way affected my career if I hadn't discovered the website. Your training and kindness in maneuvering everything was very useful. I'm not sure what I would've done if I hadn't discovered such a point like this. I can also at this point look forward to my future. Thanks for your time so much for the specialized and amazing help. I will not think twice to endorse the website to any individual who should get care on this issue.

  24. My wife and i ended up being relieved Louis could finish up his investigations out of the precious recommendations he obtained while using the web page. It's not at all simplistic just to find yourself freely giving concepts which people could have been trying to sell. So we do understand we need the writer to give thanks to for this. The illustrations you made, the easy web site menu, the friendships you can aid to promote - it's got most great, and it is helping our son and the family consider that the theme is exciting, which is certainly incredibly indispensable. Many thanks for the whole thing!

  25. cheap jordans说道:

    I am just writing to let you be aware of of the notable encounter my princess went through reading the blog. She learned plenty of pieces, which included what it's like to have a very effective giving character to let certain people completely fully grasp various specialized matters. You undoubtedly did more than our own expectations. Thank you for displaying these practical, healthy, explanatory and as well as easy tips about this topic to Ethel.

  26. yeezy boost说道:

    I wanted to post you this tiny remark to finally say thanks once again for these amazing suggestions you have featured here. It has been simply pretty generous with people like you to make openly all a lot of people could have offered for sale as an e book to help with making some bucks on their own, chiefly considering the fact that you could possibly have done it in the event you decided. These tricks likewise served as the easy way to fully grasp most people have the identical zeal like my own to grasp very much more when it comes to this matter. I believe there are a lot more fun moments ahead for people who look into your blog post.

  27. I happen to be commenting to make you understand of the fine experience our girl developed reading through your site. She came to understand such a lot of pieces, with the inclusion of what it's like to possess an incredible helping mood to let other individuals smoothly completely grasp various tortuous topics. You really did more than people's expected results. Thanks for offering those effective, healthy, educational and unique tips on the topic to Ethel.

发表评论

电子邮件地址不会被公开。 必填项已用*标注