current position:Home>Decoding the verification code of Taobao slider with Python + selenium, the road of information security

Decoding the verification code of Taobao slider with Python + selenium, the road of information security

2021-08-23 11:51:35 Little geese learn python


Today is Python+Selenium Simulated Login series decipher Taobao slider verification code
I don't say much nonsense , Let's start happily ~

development tool

Python edition : 3.6.4

Related modules :

selenium modular ;

As well as some python Built in modules .


Download the driver that matches the Google browser version on your computer in the link below :

Environment building

install python And add to environment variable ,pip Install the relevant modules required .

Introduction of the principle

Instantiate a webdriver.Chrome object , For automating the operation of Google browser in our computers :

browser = webdriver.Chrome(executable_path=chromedriverpath, options=chrome_opts)

next , We use it to automatically access Taobao :


And simulate clicking on the top left of the page " Pro - , Please log in " To enter the login interface of Taobao :

To be specific , The code implementation is as follows :

button = driver_wait.until(EC.presence_of_element_located((By.CLASS_NAME, 'h')))

Automatically fill in the user name and password :

#  Enter the username and password 
username_sender = driver_wait.until(EC.presence_of_element_located((By.ID, 'fm-login-id')))
password_sender = driver_wait.until(EC.presence_of_element_located((By.ID, 'fm-login-password')))

The above code directly uses ID To locate the input box :

Of course, you can also locate elements in web pages in the following ways , How to use it depends on your personal preferences , Beginners don't have to worry too much about these things :


After automatically filling in the user name and password , The slider verification code... May appear in the login interface , As shown in the figure below :

This type of slider verification code requires the user to press and hold the slider , And drag it to the far right . use ActionChains Function directly drag the slider to the far right in one breath to pass the verification :

  slider = browser.find_element_by_xpath("//span[contains(@class, 'btn_slide')]")
  if slider.is_displayed():
    ActionChains(browser).move_by_offset(xoffset=258, yoffset=0).perform()

Finally, simulate clicking the login button :

#  Click the login button 
button = driver_wait.until(EC.presence_of_element_located((By.CLASS_NAME, 'password-login')))

This is the end of the article , Thanks for watching ,Python Information security , The next series will share the painting series

To thank readers , I want to share with you some of my recent collections of programming dry goods , Give back to every reader , I hope I can help you .

Dry goods mainly include :

① 2000 Multiple copies Python e-book ( There should be both mainstream and classic books )

② Python Standard library information ( The most complete Chinese version )

③  Project source code ( Forty or fifty interesting and classic training projects and source code )

④ Python Basic introduction 、 Reptiles 、web Development 、 Big data analysis video ( Suitable for Xiaobai to learn )

⑤ Python Learning Roadmap ( Farewell to bad learning )

All done~ Private letter to get the complete source code ..

Looking back

use Python+Selenium Crack the Spring Airlines slider verification code , The road to information security

use Python+Selenium Crack B Station slider verification code , The road to information security

use Python+hackcaptcha Decipher 12306 Image verification code , The road to information security

Simple implementation of entry-level steganography

copyright notice
author[Little geese learn python],Please bring the original link to reprint, thank you.

Random recommended