简单实用的铁道部12306.cn网站自动化登录(转http://www.cnblogs.com/cnshangsha/archive/2012/01/12/12306cnautologin.html)
来源:互联网 发布:买家加入淘宝联盟 编辑:程序博客网 时间:2024/06/05 03:40
铁道部网站登录难点分析
- 必须使用微软IE浏览器
- 铁道部网站只支持IE在线付款
- 网站使用Https协议
- 客户端不允许跨域访问
技术解析
- 使用微软IE开发者工具栏即可破解自动化登录过程
开始步骤
- 使用IE8及其以上的版本,IE7及以下版本需要另外下载微软官方的IE开发者工具栏,下载链接如下:
- Internet Explorer Developer Toolbar: http://www.microsoft.com/download/en/details.aspx?id=18359
- 在IE地址栏中访问铁道部登录页面 https://dynamic.12306.cn/otsweb/loginAction.do?method=init
- 需要 且 只需要输入一次自己的用户名,密码,验证码即可
- 按F12快捷键调出IE开发者工具栏 >>> Script(脚本)选项卡 >>> 复制如下图代码到内容文本框中 >>> 点击 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.contentWindow.document.getElementById('UserName'); var password = _ifrMain.contentWindow.document.getElementById('password'); var randCode = _ifrMain.contentWindow.document.getElementById('randCode'); var subLink = _ifrMain.contentWindow.document.getElementById('subLink'); 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('请输入正确的验证码') > -1) { alert('请输入正确的验证码!'); }; if (msg.indexOf('当前访问用户过多') > -1) { reLogin(msg); } else { location.replace(queryurl); }; }, error: function (msg) { reLogin(msg); }, beforeSend: function (XHR) { ; } }); } var count = 1; function reLogin(msg) { count++; subLink.innerHTML = "(" + count + ")次登录中..." + msg; setTimeout(submitForm, 500); } submitForm();
- 后面执行情况说明
- 点击了运行脚本按钮后,对客户来说,登录操作是自动化的了,无需其他操作,只待登录成功即可。
- 执行成功说明 ,如下图,看到自己的用户名后,即登录成功
最后总结
- 不足
- 前些天买票高峰期已过, 此技巧来得太晚 , 我的票别人帮忙订的,我没太注意用技术实现容易登录。
- 足
- 返程票高峰期马上到来!
- 简单实用的铁道部12306.cn网站自动化登录(转http://www.cnblogs.com/cnshangsha/archive/2012/01/12/12306cnautologin.html)
- 简单实用的铁道部12306.cn网站自动化登录
- c#的迭代器,转自http://www.cnblogs.com/yangecnu/archive/2012/03/17/2402432.html
- makefile @ 符号作用 http://www.cnblogs.com/MyEyes/archive/2012/01/12/2320505.html
- jQuery动态表格(转自:http://www.cnblogs.com/Zjmainstay/archive/2012/07/12/jQuery_autoAddDeleteTableTr.html)
- xm create的过程 (转自http://www.cnblogs.com/feisky/archive/2012/01/17/2325018.html)
- 大流量网站架构的几点认识[转:http://www.cnblogs.com/hq2008/archive/2008/04/24/1169244.html]
- C# 启动外部程序的几种方法(转自:http://www.cnblogs.com/Slxj/archive/2012/01/12/2320531.html)
- HTTP协议详解,转自http://www.cnblogs.com/TankXiao/archive/2012/02/13/2342672.html
- Linux的inode的理解 http://www.cnblogs.com/itech/archive/2012/05/15/2502284.html
- 超有营养的好博客http://www.cnblogs.com/me115/archive/2012/09/08/2676250.html
- 超有营养的好博客http://www.cnblogs.com/me115/archive/2012/09/08/2676250.html
- Android Fragment的使用http://www.cnblogs.com/xinye/archive/2012/08/28/2659712.html
- Linux进程调度的目标 http://www.cnblogs.com/zhaoyl/archive/2012/09/04/2671156.html
- http://www.cnblogs.com/hemingwang0902/archive/2012/03/15/2397761.html异常的解决方案
- 一步一步打造自己的编译器http://www.cnblogs.com/sukyboor/archive/2007/01/11/617406.html
- 揭开Socket编程的面纱http://www.cnblogs.com/goodcandle/archive/2005/12/10/socket.html
- http://www.cnblogs.com/wujd/archive/2012/01/10/wujiandong-android-1.html
- 定制log
- SFP与GBIC的区别
- javascript弹出层组件easyDialog v2.0
- Smartdrv程序有什么作用
- 汉化教程地址
- 简单实用的铁道部12306.cn网站自动化登录(转http://www.cnblogs.com/cnshangsha/archive/2012/01/12/12306cnautologin.html)
- 转 hdu 1452
- Windows XP的开机菜单有什么含义
- 工作10年的一点感想
- 销售3点
- Java SE 6 新特性: 编译器 API
- SELinux概述及相关命令
- Storm Serialization
- iPhone app发布到appstore的步骤