google搜索 站内搜索                 软件测试门户 | 软件测试培训 | 文章资料精选 | 软件测试论坛 | 测试解决方案 | 软件测试博客 | 测试招聘求职 
打印

我做图片校验码的关联,后来成功了,共享如下:(看最后的帖)

我做图片校验码的关联,后来成功了,共享如下:(看最后的帖)


Execution Log 中,我比较了两个脚本,发现:
...
vuser_init.c(15):         <td><input name="validNum" type="text" id="validNum"><!--img border=0 src="http://192.
vuser_init.c(15):     168.1.18:8080/17dp//common/image.jsp"-->\r\n
vuser_init.c(15):     \r\n
vuser_init.c(15):     <img src='/17dp/images/randImg/6.gif '><img src='/17dp/images/randImg/2.gif '><img src='/1
vuser_init.c(15):     7dp/images/randImg/6.gif '><img src='/17dp/images/randImg/2.gif '></td>\r\n
...
其中,不同的是那四个*.gif,也就是说,在输入图形校验码的时候,调用了一个image.jsp中的随机函数,最后返回如上四个随机的*.gif。因此,我在脚本中做了如下调整:
...
lr_think_time(11);
    web_reg_save_param("ValidAction1","LB=<img src='/17dp/images/randImg/","RB=.",LAST);
    web_reg_save_param("ValidAction2","LB=<img src='/17dp/images/randImg/","RB=.",LAST);
    web_reg_save_param("ValidAction3","LB=<img src='/17dp/images/randImg/","RB=.",LAST);
    web_reg_save_param("ValidAction4","LB=<img src='/17dp/images/randImg/","RB=.",LAST);
    web_submit_form(
"managerLogin.do",
"Snapshot=t3.inf",
ITEMDATA,
"Name=userName", "Value=wow", ENDITEM,
"Name=password", "Value=nev", ENDITEM,
"Name=mercType", "Value=网店管理子系统", ENDITEM,
//"Name=validNum", "Value=7777", ENDITEM,
"Name=ValidAction1", "Value={ValidAction1}",ENDITEM,
"Name=ValidAction2", "Value={ValidAction2}",ENDITEM,
"Name=ValidAction3", "Value={ValidAction3}",ENDITEM,
"Name=ValidAction4", "Value={ValidAction4}",ENDITEM,
LAST);
web_submit_form("j_security_check",
...
生成四个web_reg_save_param函数,参数分别为:ValidAction(1~4),同时在web_submit_form中屏蔽原来的随机校验码,取而代之四个"Name"和“Value”。。。。请问,我这样对图形校验码进行关联,是否正确?(其中还有session的关联我没做,在自动关联中没有session的关联提示,因此我省掉了),在仅做了如上的调整后,运行,execution Log 最后提示如下:
....
....
vuser_init.c(24): Notify: Saving Parameter "ValidAction1 = "
vuser_init.c(24): Error -27190: No match found for the requested parameter "ValidAction2". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 256 bytes, use web_set_max_html_param_len to increase the parameter size          [MsgId: MERR-27190]
vuser_init.c(24): Notify: Saving Parameter "ValidAction2 = "
vuser_init.c(24): Error -27190: No match found for the requested parameter "ValidAction3". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 256 bytes, use web_set_max_html_param_len to increase the parameter size          [MsgId: MERR-27190]
vuser_init.c(24): Notify: Saving Parameter "ValidAction3 = "
vuser_init.c(24): Error -27190: No match found for the requested parameter "ValidAction4". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 256 bytes, use web_set_max_html_param_len to increase the parameter size          [MsgId: MERR-27190]
vuser_init.c(24): Notify: Saving Parameter "ValidAction4 = "
vuser_init.c(24): Error -27187: The above "not found" error(s) may be explained by header and body byte counts being 0 and 0, respectively.          [MsgId: MERR-27187]
vuser_init.c(24): web_submit_form highest severity level was "ERROR", 0 body bytes, 0 header bytes          [MsgId: MMSG-27178]

...
...

[ Last edited by Wins on 2005-9-12 at 17:24 ]

TOP

也可通过QQ:35900943联系我 谢谢了

TOP

楼主的函数定义有问题

TOP

请指正!!
我的理解是:
四个图片组成四个校验码,这是每次脚本的差异,因此,我定义了四个参数,做不同的关联。。。

TOP

楼主应该在做关联时加上参数“ORD=1”、“ORD=2”、“ORD=3”、“ORD=4”,等来定位具体哪个函数对应哪个指定偏移量。。具体“ORD= ”后面的数值是多少就得你自己去试了。。

不知我这么回答能给你帮助没。。你可以试试行不行,我也是新手。。

TOP

"Name=ValidAction", "Value={ValidAction1}{ValidAction2}{ValidAction3}{ValidAction4}",ENDITEM,

我觉得这个地方需要改成如上。。。问题是如下:
在run step by step中,系统提示如下:
...
vuser_init.c(23): Registering web_reg_save_param was successful          [MsgId: MMSG-27180]
vuser_init.c(24): Registering web_reg_save_param was successful          [MsgId: MMSG-27180]
vuser_init.c(26): Error -27979: Requested form not found          [MsgId: MERR-27979]
vuser_init.c(26): Warning -27148: Pending web_reg_save_param/reg_find/create_html_param[_ex] request(s) are deleted and will be handled as "not found"          [MsgId: MWAR-27148]
v
...
也就是,脚本中进行到相应的步骤:
...
    web_reg_save_param("ValidAction3","LB=<img src='/17dp/images/randImg/","RB=.",LAST);
    web_reg_save_param("ValidAction4","LB=<img src='/17dp/images/randImg/","RB=.",LAST);
    web_submit_form("managerLogin.do",
                        "Snapshot=t3.inf",
                  ITEMDATA,
                  "Name=userName", "Value=wow", ENDITEM,
                  "Name=password", "Value=nev", ENDITEM,
                  "Name=mercType", "Value=网店管理子系统", ENDITEM,
                  //"Name=validNum", "Value=7777", ENDITEM,
                  "Name=ValidAction", "Value={ValidAction1}{ValidAction2}{ValidAction3}{ValidAction4}",ENDITEM,
                  LAST);
...
web_submit_form 时,运行就断掉了。。。再次求救!

TOP

to: sky_live
嗯,我先试试看。谢谢啦;〉

TOP

搞定了,多谢sky_live的提醒,我把多种思路都试了一下,其实很简单,如下:
#include "web_api.h"
#include "lrw_custom_body.h"


vuser_init()
{
        web_url("17DPSYSMANAGE",
                "URL=http://192.168.1.222/17DPSYSMANAGE/",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                LAST);
         web_set_max_html_param_len("100000000");
     web_reg_save_param("validNum","LB=images/randImg/","RB=.gif","ORD=ALL",LAST);

         lr_think_time( 18 );

        web_submit_data("sysuserLoginAction.do",
                "Action=http://192.168.1.222/17DPSYSMANAGE/sysuserLoginAction.do",
                "Method=POST",
                "RecContentType=text/html",
                "Referer=http://192.168.1.222/17DPSYSMANAGE/sysuserLogin.jsp",
                "Snapshot=t2.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=sysuserName", "Value=CTAdmin", ENDITEM,
                "Name=password", "Value=CTAdmin", ENDITEM,
                //"Name=validNum", "Value=9630", ENDITEM,
                "Name=validNum", "Value={validNum}", ENDITEM,
                "Name=Submit", "Value=登 录", ENDITEM,
                LAST);
        lr_think_time(54);
        web_submit_form("j_security_check",
                "Snapshot=t3.inf",
                ITEMDATA,
                EXTRARES,
                "URL=images/admin_h_2.jpg", "Referer=http://192.168.1.222/17DPSYSMANAGE/sysmanage/indexTop.jsp", ENDITEM,
                "URL=images/admin_h_4.jpg", "Referer=http://192.168.1.222/17DPSYSMANAGE/sysmanage/indexTop.jsp", ENDITEM,
                "URL=javascript/rsmenu.js", "Referer=http://192.168.1.222/17DPSYSMANAGE/sysmanage/indexLeft.jsp", ENDITEM,
                "URL=images/left_bg.jpg", "Referer=http://192.168.1.222/17DPSYSMANAGE/sysmanage/indexLeft.jsp", ENDITEM,
                "URL=images/w1_r1_c2.gif", "Referer=http://192.168.1.222/17DPSYSMANAGE/sysmanage/indexLeft.jsp", ENDITEM,
                LAST);
        return 0;
}

TOP

好贴,顶一下

TOP

太好了


谢谢了。辛苦了

TOP

to wins:你图片保存的名字和你要输入的检验码一样吗?那其不是很不安全?

TOP

验证码和图片名字一样的话
你这个脚本可以通过
如果不一样呢?

TOP

你这种方法的前提是:你所测试的系统中的验证码图片是静态,即数据库中只有一定数量的静态验证码图片。
每次刷新该验证码的图片时,如:<img src='/17dp/images/randImg/2.gif '>中的2(数字)随刷新而改变。
这里面存在一定的规则可寻。
但如果你所测试的系统调用验证码图片时,是通过函数调用的。如:<img border=0 src="/managerWeb/images/image.jsp">,那就不会有任何规律。
随之,这种方法就有可能失去效果了。
请各位高手指教一下,还有什么高指可以突破验证码而登录,谢谢!

[ Last edited by girl04 on 2005-9-29 at 02:11 ]

TOP

大家可以用一个例子再做一下,看是否可以找出什么方法:
http://mail.21cn.com/huodong/0808/index.html
注册电子邮箱。

TOP

多谢拉,这个问题,一直是比较难解决的

TOP

太深奥了,看不懂.还需继续努力啊!

TOP

这个例子太特殊了,现在不具有普遍性。 验证码做成这样没有任何验证的意义。

TOP

楼上所言极是。验证码是用来干什么的?
验证码就是为了防止恶意的大量的攻击,注册,破解等等,如果哪个网站能够让loadrunner寻找出图片的生成规律,模仿出大量的用户,那这个验证码的设计本身就是失败的。
my site-http://groups.google.com/group/tesooo/

TOP

其实现在的做法就是把验证码的0~9分别从图片里面扣出来保存起来,然后运行的时候再把验证码分别抠出来,作图片的比较,来确定是什么数字。
但如果是中文验证码的话...... 还是让开发屏蔽掉吧

TOP

楼主,可否把你的网址贴出来?

TOP

 
当前时区 GMT+8, 现在时间是 2008-12-5 15:32Copyright(C)上海博为峰软件技术有限公司 2001-2007 电话:021-64471599-8017
当您在访问网站、论坛及博客过程中遇到问题时可发送email:webmaster@51testing.com或发送论坛短信至管理员风在吹