专栏名称: python
隔天更新python文章,我希望用我的努力换来劳动的成果帮助更多的人掌握一门技术,因此我要更加努力。
目录
相关文章推荐
Python开发者  ·  “李飞飞团队50 美元炼出 ... ·  2 天前  
Python爱好者社区  ·  史上最强!PINN杀疯了 ·  2 天前  
Python爱好者社区  ·  离谱!下载DeepSeek最高判刑20年? ·  3 天前  
Python爱好者社区  ·  1885页的Python完全版电子书 ·  4 天前  
Python爱好者社区  ·  多模态,杀疯了 ·  3 天前  
51好读  ›  专栏  ›  python

利用itchat 10行python代码实现微信轰炸

python  · 公众号  · Python  · 2018-11-05 21:09

正文

'''
转载:https://github.com/Gin79/WeChat-Bomb/blob/master/README.md
'''

说明

  • 站在巨人的肩膀上

  • 基于python,这个小程序是用python写的

  • 使用的是python第三方库itchat,itchat模块是一位叫 littlecodersh 的大神写的模块,附上大神的github地址,有兴趣的朋友可以去尝试玩一下itchat模块,很有趣的!!!https://github.com/littlecodersh/ItChat

准备

  • Python3.6 需要安装python3.6并配置好环境路径

  • 安装好python后,打开电脑的CMD终端输入 pip install itchat 安装itchat模块

  • 需要设置好默认看图软件

核心代码

import itchatimport timeprint('扫一下弹出来的二维码')
itchat.auto_login(hotReload=True)
boom_remark_name = input('输入你要轰炸的人的微信备注,按回车建继续')
message = input('输入你要轰炸的内容,按回车键开始轰炸')
boom_obj = itchat.search_friends(remarkName=boom_remark_name)[0]['UserName']while True:
    time.sleep(0.5)    print('正在轰炸。。。')
    itchat.send_msg(msg=message, toUserName=boom_obj)

代码讲解

import itchat

导入itchat模块

import time

导入time模块

itchat.auto_login(hotReload=True)

登录微信,采用热加载的方式登录网页版的微信,会生成一个itchat.pkl的文件,用于保持登录状态,有点类似于cookie

boom_remark_name = input('输入你要轰炸的人的微信备注,按回车建继续') 这里一定要输入你给微信好友的 备注名 ,否者无法定位到好友

message = input('输入你要轰炸的内容,按回车键开始轰炸')

这里输入要轰炸的内容

boom_obj = itchat.search_friends(remarkName=boom_remarkname)[0]['UserName']

这里通过微信好友的 备注名 找到微信好友的信息,再通过 UserName 定位到好友







请到「今天看啥」查看全文


推荐文章
Python爱好者社区  ·  史上最强!PINN杀疯了
2 天前
Python爱好者社区  ·  离谱!下载DeepSeek最高判刑20年?
3 天前
Python爱好者社区  ·  1885页的Python完全版电子书
4 天前
Python爱好者社区  ·  多模态,杀疯了
3 天前
前端大全  ·  Promise 异步流程控制
7 年前
深夜书屋  ·  我妈亲眼看着我被弟弟毁了容。
6 年前