当前位置:网站首页>Selenium builds cookies pool to bypass authentication and anti crawl login
Selenium builds cookies pool to bypass authentication and anti crawl login
2022-06-26 08:52:00 【Feng Dashao】
The previous blog introduced , Today's Internet developers are trying to reduce the impact of various crawlers on servers , Various anti climbing mechanisms have been adopted . Recently someone raised a question , Algorithm cracking without verification code , How to complete Selenium Fully automatic login ? In fact, since there is an anti climbing mechanism , There must be every way to crack it , It's just that the complexity of each is different . Today I will introduce a more direct method , By building Cookies Pool to bypass the verification step .
Cookie It is a short text file stored by the browser on the user's computer . The encrypted user information is stored in this file (User ID, Password), Expiration time (Expired Date/Time) wait .
because Cookie There is an expiration date , chart 1,t because Cookies involve User/Password, Here is the code of the occlusion part . When it fails , You need to log in again , Generate a new Cookie. Simple understanding , It is like a Hong Kong and Macao pass , After the validity of the visa , You have to sign again before you can use .
Therefore, we must first complete a manual normal login , Automatic system generation Cookies, And then through response.cookies() Method to get directly , Of course , If you are not familiar with fast extraction through code , You can also manually copy and paste , More time-consuming .
By getting Cookies after , First add an empty lst, Then put multiple Cookies To form an independent dict, Add to this empty by looping lst in , Formed a Cookies pool , chart 2
Quickly set up Cookies Behind the pool , When we open the corresponding URL after , You can let the browser automatically add one by one through a loop Cookie, When I'm done , Refresh the browser , Code in :
Something to pay attention to ,add_cookie() Methodical params Must contain “Name” and " Value", Otherwise, an error will be reported . So in creating an independent Cookie, The format must be {‘name’:‘xxx’, ‘value’:‘xxxx’}, So it can be interpreted as name Equivalent to Cookie Of Key,value Equivalent to value ( Key_Value Key value pair ) .
Last , Create a class , hold Selenium Set the properties of ,
hold Cookies pool , All the added methods are encapsulated in a custom function , Run it , You can achieve the effect of automatic login . A final reminder , dependent Cookies Don't give it to others , The code program must be encrypted and kept well , Because it's related User/Password There is a risk of being decompiled and stolen , Here we will not introduce how to compile Cookie Restore real information .
for i in cookies:
browser.add_cookie(i)
browser.refresh()
chart 1

chart 2

边栏推荐
- Bezier curve learning
- Euler function: find the number of numbers less than or equal to N and coprime with n
- Detailed explanation of SOC multi-core startup process
- 【Unity Mirror】NetworkTeam的使用
- Playing card image segmentation
- leetcode2022年度刷题分类型总结(十二)并查集
- Stanford doggo source code study
- opencv學習筆記三
- Two ways to realize time format printing
- Implementation of ffmpeg audio and video player
猜你喜欢

Apple motherboard decoding chip, lightning Apple motherboard decoding I.C

(2) Buzzer

opencv學習筆記三

Design based on STM32 works: multi-functional atmosphere lamp, wireless control ws2812 of mobile app, MCU wireless upgrade program

Intra class data member initialization of static const and static constexpr

HEVC学习之码流分析

51 single chip microcomputer project design: schematic diagram of timed pet feeding system (LCD 1602, timed alarm clock, key timing) Protues, KEIL, DXP

WBC learning notes (II): practical application of WBC control

Transformers loading Roberta to implement sequence annotation task

How to realize wireless Ethernet high-speed communication for multiple Mitsubishi PLCs?
随机推荐
Apple motherboard decoding chip, lightning Apple motherboard decoding I.C
Relation extraction model -- spit model
STM32 based d18s20 (one wire)
Implementation of ffmpeg audio and video player
Detailed process of generating URDF file from SW model
The principle and function of focus
关于极客时间 | MySQL实战45讲的部分总结
STM32 project design: an e-reader making tutorial based on stm32f4
XSS 跨站脚本攻击
What is Qi certification Qi certification process
keras_ Callback function summary
Koa_mySQL_Ts 的整合
Detailed explanation of self attention & transformer
golang json unsupported value: NaN 处理
Whale conference one-stop intelligent conference system helps organizers realize digital conference management
利用无线技术实现分散传感器信号远程集中控制
ZLMediaKit推流拉流测试
Bezier curve learning
Install Anaconda + NVIDIA graphics card driver + pytorch under win10_ gpu
Comparison between Apple Wireless charging scheme and 5W wireless charging scheme