开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 2879|回复: 1
收起左侧

[求助] 关于JS分析,验证码的获取

[复制链接]
结帖率:71% (5/7)
发表于 2012-8-5 17:46:35 | 显示全部楼层 |阅读模式   四川省成都市
验证码是在图片上显示为文字的,不是图片,所以没有图片地址,通过抓包,发现验证码的js,但是不会生成验证码

login.js
  1. function jxcheck() {

  2.     if (document.getElementById("jxname").value.replace(" ", "").length <= 0) {
  3.         alert("请输入用户名");
  4.         document.getElementById("jxname").focus();
  5.         return false;
  6.     }
  7.     if (document.getElementById("jxpwd").value.replace(" ", "").length <= 0) {
  8.         alert("请输入密码");
  9.         document.getElementById("jxpwd").focus();
  10.         return false;
  11.     }
  12.     if (document.getElementById("jxyzm").value.replace(" ", "").length <= 0) {
  13.         alert("请输入验证码");
  14.         document.getElementById("jxyzm").focus();
  15.         return false;
  16.     } else {
  17.         if (document.getElementById("code").innerHTML.indexOf("点击获取") <0) {
  18.             if (document.getElementById("jxyzm").value.toUpperCase() != document.getElementById("code").innerHTML.toUpperCase()) {
  19.                 alert("验证码错误,请重新输入");
  20.                 return false;
  21.             }
  22.         } else {
  23.             alert("请先获取验证码");
  24.             return false;
  25.         }
  26.     }

  27.     return true;
  28. }
  29. function jsrcheck() {
  30.     if (document.getElementById("cgs").value == "0") {
  31.         alert('请选择车管所');
  32.         return false;
  33.     }

  34.     return true;
  35. }
  36. function cgscheck() {
  37.     if (document.getElementById("cgsname").value.replace(" ", "").length <= 0) {
  38.         alert("请输入用户名");
  39.         document.getElementById("cgsname").focus();
  40.         return false;
  41.     }
  42.     if (document.getElementById("cgspwd").value.replace(" ", "").length <= 0) {
  43.         alert("请输入密码");
  44.         document.getElementById("cgspwd").focus();
  45.         return false;
  46.     }
  47.     if (document.getElementById("cgsyzm").value.replace(" ", "").length <= 0) {
  48.         alert("请输入验证码");
  49.         document.getElementById("cgsyzm").focus();
  50.         return false;
  51.     }

  52.     return true;
  53. }
  54. function refreshimg(control) {
  55.     var x = Math.random();
  56.     control.src = "../ValidateCode.aspx?index" + x;
  57. }
  58. function ShortcutButtonSwitch(index) {
  59.     //        document.getElementById("function_button" + (index % 3)).style.display = "block";
  60.     //        document.getElementById("function_button" + ((index + 1) % 3)).style.display = "none";
  61.     //        document.getElementById("function_button" + ((index + 2) % 3)).style.display = "none";

  62.     document.getElementById("dllx").value = index;
  63.     if (index == 0) {
  64.         //document.getElementById("image11").style.display = "inline";
  65.         document.getElementById("image2").style.display = "none";
  66.         document.getElementById("lyhm").innerHTML = "用户名:";
  67.         document.getElementById("bt_title").innerHTML = "驾校登录";
  68.     }
  69.     else if (index == 1) {
  70.         //document.getElementById("image11").style.display = "none";
  71.         document.getElementById("image2").style.display = "inline";
  72.         document.getElementById("lyhm").innerHTML = "***:";
  73.         document.getElementById("bt_title").innerHTML = "学员登录";
  74.     }
  75.     else if (index == 2) {
  76.         //document.getElementById("image11").style.display = "inline";
  77.         document.getElementById("image2").style.display = "none";
  78.         document.getElementById("lyhm").innerHTML = "用户名:";
  79.         document.getElementById("bt_title").innerHTML = "车管所登录";
  80.     } else if (index == 3) {
  81.         document.getElementById("image2").style.display = "none";
  82.         document.getElementById("lyhm").innerHTML = "***:";
  83.         document.getElementById("bt_title").innerHTML = "学员绿色通道";
  84.     }
  85. }
  86. function validate() {
  87.     if (document.getElementById("txtsfzhm").value == "" || document.getElementById("txtphonenum").value == "") {
  88.         alert("***号码或手机号码不能为空,请重新输入.");
  89.         return false;
  90.     } else {
  91.         var patrn = /^(1[0-9][0-9])\d{8}$/;
  92.         if (!patrn.exec(document.getElementById("txtphonenum").value)) {
  93.             alert("手机号码的格式不对,请重新输入.");
  94.             return false;
  95.         }
  96.         else {
  97.             return true;
  98.         }

  99.     }
  100. }

  101. function print(lsh, kssj) {
  102.     var postForm = document.createElement("form"); //表单对象   
  103.     postForm.method = "post";
  104.     postForm.action = '../PrintPage.aspx';
  105.     postForm.target = "print";

  106.     var nameInput = document.createElement("input");  //email input
  107.     nameInput.setAttribute("name", "lsh");
  108.     nameInput.setAttribute("value", lsh);
  109.     postForm.appendChild(nameInput);
  110.     var sjInput = document.createElement("input");  //email input
  111.     sjInput.setAttribute("name", "kssj");
  112.     sjInput.setAttribute("value", kssj);
  113.     postForm.appendChild(sjInput);
  114.     postForm.attachEvent("onsubmit", function() { window.open("about:blank", "print", "directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); });
  115.     document.body.appendChild(postForm);
  116.     postForm.fireEvent("onsubmit");
  117.     postForm.submit();
  118.     document.body.removeChild(postForm);
  119. }
  120. function view(lsh, kssj) {
  121.     var postForm = document.createElement("form"); //表单对象   
  122.     postForm.method = "post";
  123.     postForm.action = '../view.aspx';
  124.     postForm.target = "view";

  125.     var nameInput = document.createElement("input");  //email input
  126.     nameInput.setAttribute("name", "lsh");
  127.     nameInput.setAttribute("value", lsh);
  128.     postForm.appendChild(nameInput);
  129.     var sjInput = document.createElement("input");  //email input
  130.     sjInput.setAttribute("name", "kssj");
  131.     sjInput.setAttribute("value", kssj);
  132.     postForm.appendChild(sjInput);
  133.     postForm.attachEvent("onsubmit", function() { window.open("about:blank", "view", "directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); });
  134.     document.body.appendChild(postForm);
  135.     postForm.fireEvent("onsubmit");
  136.     postForm.submit();
  137.     document.body.removeChild(postForm);
  138. }


  139. <font class="Apple-style-span" color="#ff0000">function divclick(){
  140.     var code = "";
  141.     var codeLength = 4; //验证码的长度  
  142.     var checkCode = document.getElementById("checkCode");
  143.     var selectChar = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N','P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); //所有候选组成验证码的字符,当然也可以用中文的     
  144.     for (var i = 0; i < codeLength; i++) {
  145.         var charIndex = Math.floor(Math.random() * 34);
  146.         code += selectChar[charIndex];
  147.     }
  148.       document.getElementById("code").style.backgroundColor = "black";
  149.       document.getElementById("code").innerHTML = code;  
  150.       return code;  
  151. }  </font>
复制代码
不知道怎么获取验证码,

网站地址:http://www.scjj.gov.cn:8635/




结帖率:71% (5/7)
 楼主| 发表于 2012-8-5 17:49:05 | 显示全部楼层   四川省成都市
这个应该是生成验证码的js但是我怎么使用?

不知道我取的对不对哦!!!最近发布了很多问题,不知道是我的问题很简单没人愿意浪费时间还是怎么了,哎。。。

function divclick(){
    var code = "";
    var codeLength = 4; //验证码的长度  
    var checkCode = document.getElementById("checkCode");
    var selectChar = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N','P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); //所有候选组成验证码的字符,当然也可以用中文的     
    for (var i = 0; i < codeLength; i++) {
        var charIndex = Math.floor(Math.random() * 34);
        code += selectChar[charIndex];
    }
      document.getElementById("code").style.backgroundColor = "black";
      document.getElementById("code").innerHTML = code;  
      return code;  
}

点评

我现在是这样用的, 验证码脚本.置语言 (“JScript”) 验证码脚本.执行语句 (#常量5) 验证码 = 验证码脚本.运行 (“jxyzm”)   四川省成都市  发表于 2012-8-5 17:49
回复 支持 反对

使用道具 举报

  高级模式
B Color Image Link Quote Code Smilies |上传

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 793400750,邮箱:wp@125.la
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表