Python analog Login The first bullet see: Python data analysis Python analog login (a) requests. Session Application
The last login is the most basic, all clear text, and in the browser can see the post data. And then we're going to have a little bit more difficult – Demo login Blog Park (http://www.cnblogs.com)
Login Features: The
user name password is RSA encrypted, and in the browser can not see the post data
Figure 1
For example, the post content cannot be explicitly seen in the post data.
simulate sign-in steps
Also note the issue of cookies, which must be selected correctly, Do not select the following:
Figure 5,
is included. Cnblogcookies cookies, which are also cookies on the homepage.
in order to verify that the login was successful, we opened the followers page after logging in because it was not possible to see any user's fan page before logging in.
or take advantage of requests. Session, write the following code:
Import requestsimport reimport jsonfrom BS4 Import beautifulsoups = requests. Session () headers = {' Accept ': ' Application/json, Text/javascript, */*; q=0.01 ', ' Referer ': ' Http://passport.cnblogs . Com/user/signin ', ' user-agent ': ' mozilla/5.0 (Windows NT 6.3; WOW64) applewebkit/537.36 (khtml, like Gecko) chrome/39.0.2171.95 safari/537.36 ', ' Cookie ': ' __gads=id=fc58354935efbd8 9:t=1458638388:s=alni_myetsucyem4nwel9mdxvqmfazltgq; _ga=ga1.2.111229817.1458781632;. Cnblogscookie= 39eb7c846ff5a6ca5d762d210b954e55ce77a24d11c5203f6055dcac93dfff8ea7e405568f2d8cc9f00afe43a859e71de55ae6e79a030f7e74c231cec f7da2dd88b734ea2eca22dfed8c2ecab85717b45434aabfe1202da8266c7440562114d99d9c6767 '}login_data = {' input1 ': ' Your user name is encrypted after content ', ' input2 ': ' Your password is encrypted after content ', ' remember ': ' false '}url = ' HTTP://PASSPORT.CNB Logs.com/user/signin ' req = s.post (url, data = Login_data, headers=headers) print (Req.status_code) #200print (req.c Ontent.decode ()) #{"Success": false, "meSsage ":" You are already logged in "}f = S.get (' http://home.cnblogs.com/u/whatbeg/followers/1 ', headers=headers) print (F.status_code) Print (F.text)
then run with:
Figure 6
Figure 7
Displays a successful login.
This way, you can log on to this non-HTTPS web site that does not require a verification code with RSA encrypted user name passwords. Hope to be of help to the people who need it.
This work is for communication purposes only, do not use any behavior that does not comply with the network ethics.
Original address: http://whatbeg.com/2016/04/14/logincnblogs.html
"Python emulation Login" RSA encryption and replay login-Take a mock login blog Park for example