QQ,微信 消息轰炸
# -*- coding: utf-8 -*- """ Created on Wed Apr 1 09:20:06 2020 @author: Administrator """ import time import random def getupmsg(): """ 获取正能量语句 :return: """ while 1: url = "https://data.zhai78.com/openOneGood.php" # 毒鸡汤 url = "https://data.zhai78.com/openOneBad.php" res = requests.get(url) arr_dict = json.loads(res.text) print(arr_dict["txt"]) print(len(arr_dict["txt"])) if len(arr_dict["txt"]) <= 40: return arr_dict["txt"] def get_joke(): # http://v.juhe.cn/joke/randJoke.php?key=29b395bfdfa7f9b70787783875e693f1 import requests url="http://v.juhe.cn/joke/randJoke.php?key=29b395bfdfa7f9b70787783875e693f1" res=requests.get(url) joke_json=res.json() joke_list=joke_json["result"] j1=joke_list[0]["content"] return j1 def sendQQ(a): import win32gui import win32con import win32clipboard as w #发送的消息 # msg =get_joke() msg=a + " I Love You" #窗口名字 name = "朋友" #将测试消息复制到剪切板中 w.OpenClipboard() w.EmptyClipboard() w.SetClipboardData(win32con.CF_UNICODETEXT, msg) w.CloseClipboard() #获取窗口句柄 handle = win32gui.FindWindow(None, name) #while 1==1: if 1 == 1: #填充消息 win32gui.SendMessage(handle, 770, 0, 0) #回车发送消息 win32gui.SendMessage(handle, win32con.WM_KEYDOWN, win32con.VK_RETURN, 0) for i in range(1000): print(i) i = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())) sendQQ(i) time.sleep(1)
-----------------------------------------------------------------------------------------------------------------------------------------