Simple and practical automated logon to the 12306.cn website of the Ministry of Railways (new version)

Source: Internet
Author: User
Document directory
  • Analysis of difficulties in website Logon of the Ministry of Railways
  • Technical Analysis
  • Start step
  • Conclusion
Update description
  • Corrected the code that was no problem before, but now there is a script exception.

    • Http://www.cnblogs.com/cnshangsha/archive/2012/01/12/12306cnautologin.html
    • The new Code is as follows:
    • VaR page = "https://dynamic.12306.cn/otsweb/loginAction.do? Method = init "; var url =" https://dynamic.12306.cn/otsweb/loginAction.do? Method = login "; var queryurl =" https://dynamic.12306.cn/otsweb/order/querySingleAction.do? Method = init "; function submitform () {VaR _ ifrmain = document. getelementbyid ('main'); var username = _ifrmain.content+doc ument. getelementbyid ('username'); var Password = _ifrmain.contentdomaindoc ument. getelementbyid ('Password'); var randcode = _ifrmain.contentdomaindoc ument. getelementbyid ('randcode'); var submiturl = URL; $. ajax ({type: "Post", URL: submiturl, data: {"loginuser. user_name ": Username. value, "user. password ": password. value, "randcode": randcode. value },timeout: 30000, success: function (MSG) {If (MSG. indexof ('Enter the correct Verification Code ')>-1) {alert (' enter the correct verification code! ') ;}; If (MSG. indexof ('Too many current access')>-1) {relogin ('callback result: too many current access');} else {location. replace (queryurl) ;}}, error: function (MSG) {relogin ('callback result: error') ;}, beforesend: function (xhr) {;}}) ;}var COUNT = 1; function relogin (MSG) {count ++; skm_lockscreen ("(" + Count + ") in the middle of the login... "+ MSG); setTimeout (submitform, 500);} function skm_lockscreen (STR) {scroll (0, 0); var back = document. getelementbyid ('skm _ lockbackground '); var pane = document. getelementbyid ('skm _ lockpane '); var text = document. getelementbyid ('skm _ lockpanetext '); var lockbackgroundcssstring = "position: absolute; top: 0px; left: 0px; visibility: visible; display: block; width: 105%; height: 105%; Background-color: #666; Z-index: 999; filter: alpha (opacity = 75); opacity: 0.75; padding-top: 20% ;"; vaR lockpanecssstring = "Z-index: 1000; position: absolute; top: 0px; left: 0px; padding-top: 25%; visibility: visible; display: block; text-align: center; width: 100%; "; var textcssstring =" width: 55%; Background-color: #969; color: White; font-size: Large; Border: dotted 1px white; padding: 9px; margin-left: auto; margin-Right: auto; "; if (back) back.style.css text = lockbackgroundcssstring; If (PANE) pane.style.css text = lockpanecssstring; If (text) {text. innerhtml = STR; text.style.css text = textcssstring ;}} var loginoutelement = document. getelementbyid ('login _ out'); loginoutelement. innerhtml = "<Div id = 'skm _ lockbackground 'style = 'display: none; visibility: hidden; position: absolute; top:-100px; left:-100px; '> </div> <Div id = 'skm _ lockpane' style = 'display: none; visibility: hidden; position: absolute; top:-100px; left:-100px; '> <Div id = 'skm _ lockpanetext'> </div> "; submitform ();

       

  • Added friendly lock screen information
    •  
  • Multi-process Logon
    •  
  • The Code test can still be normally logged on, please feel free to use it
    •  
  • Bug
    • Currently, the frequency of Automatic Code logon is two times per second. When the number of logon attempts reaches times, the webpage suffers a denial of access error, does the Background Program of the Ministry of Railways determine that the current user requests are frequent and the requests are blacklisted?
Analysis of difficulties in website Logon of the Ministry of Railways
  • Microsoft IE browser is required

    • The Ministry of Railways website only supports Internet payment
  • Websites use HTTPS protocol
    • The client does not allow cross-origin access.
Technical Analysis
  • Use the Microsoft IE developer toolbar to crack the automated Logon Process
Start step
  • To use IE8 and later versions, you need to download the official ie developer Toolbar of Microsoft for IE7 and later versions. The download link is as follows:

    • Internet Explorer developer toolbar: http://www.microsoft.com/download/en/details.aspx? Id = 18359
  • In the IE Address Bar visit the Ministry of Railways login page https://dynamic.12306.cn/otsweb/loginAction.do? Method = init
  • You only need to enter your username, password, and verification code once.
  • Press the F12 shortcut key to bring up the IE developer toolbar> script tab> copy the code to the content text box> click Run script.
    • VaR page = "https://dynamic.12306.cn/otsweb/loginAction.do? Method = init "; var url =" https://dynamic.12306.cn/otsweb/loginAction.do? Method = login "; var queryurl =" https://dynamic.12306.cn/otsweb/order/querySingleAction.do? Method = init "; function submitform () {VaR _ ifrmain = document. getelementbyid ('main'); var username = _ifrmain.content+doc ument. getelementbyid ('username'); var Password = _ifrmain.contentdomaindoc ument. getelementbyid ('Password'); var randcode = _ifrmain.contentdomaindoc ument. getelementbyid ('randcode'); var submiturl = URL; $. ajax ({type: "Post", URL: submiturl, data: {"loginuser. user_name ": Username. value, "user. password ": password. value, "randcode": randcode. value },timeout: 30000, success: function (MSG) {If (MSG. indexof ('Enter the correct Verification Code ')>-1) {alert (' enter the correct verification code! ') ;}; If (MSG. indexof ('Too many current access')>-1) {relogin ('callback result: too many current access');} else {location. replace (queryurl) ;}}, error: function (MSG) {relogin ('callback result: error') ;}, beforesend: function (xhr) {;}}) ;}var COUNT = 1; function relogin (MSG) {count ++; skm_lockscreen ("(" + Count + ") in the middle of the login... "+ MSG); setTimeout (submitform, 500);} function skm_lockscreen (STR) {scroll (0, 0); var back = document. getelementbyid ('skm _ lockbackground '); var pane = document. getelementbyid ('skm _ lockpane '); var text = document. getelementbyid ('skm _ lockpanetext '); var lockbackgroundcssstring = "position: absolute; top: 0px; left: 0px; visibility: visible; display: block; width: 105%; height: 105%; Background-color: #666; Z-index: 999; filter: alpha (opacity = 75); opacity: 0.75; padding-top: 20% ;"; vaR lockpanecssstring = "Z-index: 1000; position: absolute; top: 0px; left: 0px; padding-top: 25%; visibility: visible; display: block; text-align: center; width: 100%; "; var textcssstring =" width: 55%; Background-color: #969; color: White; font-size: Large; Border: dotted 1px white; padding: 9px; margin-left: auto; margin-Right: auto; "; if (back) back.style.css text = lockbackgroundcssstring; If (PANE) pane.style.css text = lockpanecssstring; If (text) {text. innerhtml = STR; text.style.css text = textcssstring ;}} var loginoutelement = document. getelementbyid ('login _ out'); loginoutelement. innerhtml = "<Div id = 'skm _ lockbackground 'style = 'display: none; visibility: hidden; position: absolute; top:-100px; left:-100px; '> </div> <Div id = 'skm _ lockpane' style = 'display: none; visibility: hidden; position: absolute; top:-100px; left:-100px; '> <Div id = 'skm _ lockpanetext'> </div> "; submitform ();

       

  • Subsequent execution
    • After you click the run script button, the login operation is automated for the customer. You only need to wait until the login is successful.
  • If your user name is displayed, the logon is successful.
Conclusion
  • Insufficient

    • The ticket purchase peak has passed the previous day. This technique is too late. Someone else ordered my ticket. I didn't pay too much attention to using technology to achieve easy login.
  • Foot
    • The return ticket peak is coming soon!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.