51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2289|回复: 5
打印 上一主题 下一主题

[原创] 关于SOCKET参数化的一个实际应用问题

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2009-8-14 11:02:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
lr_start_transaction("建立数据库连接");

lrs_create_socket("socket1", "TCP", "LocalHost=0", "RemoteHost=192.168.66.21:2383", LrsLastArg);

lrs_send("socket1", "buf3", LrsLastArg);
lrs_receive("socket1", "buf4", LrsLastArg);
lrs_save_searched_string("socket1", LRS_LAST_RECEIVED, "Parameter1", "LB/BIN=<SspiHandshake>", "RB/BIN=</SspiHandshake>", 1, 0, -1);
lrs_save_searched_string("socket1", LRS_LAST_RECEIVED, "Parameter2", "LB/BIN=</soap:Body></soap:Envelope>", NULL, 1, 0, 1);
lrs_send("socket1", "buf5", LrsLastArg);
lrs_receive("socket1", "buf6", LrsLastArg);
......
中间省略大约10组lrs_send与lrs_receive
lr_end_transaction("建立数据库连接", LR_AUTO);

以下是buf3,buf4,buf5,buf6的信息,储存在data.ws中:
send buf3 316
"\x0e\x10\x00\x04\x00\x00\x00"
"\b"
"\x00\x00\x01"
"\""
"\x18\x00\x00\x00"
"text/xml<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelo"
"pe/\"><soap:Body><Authenticate xmlns=\"http://schemas.microsoft.com/analys"
"isservices/2003/ext\"><SspiHandshake>TlRMTVNTUAABAAAAt4II4gAAAAAAAAAAAAAAA"
"AAAAAAFASgKAAAADw== \n"
"</SspiHandshake></Authenticate></soap:Body></soap:Envelope>"
"\x00\x00"
recv buf4 504
"\x0e\x10\x00\x04\x00\x00\x00"
"\b"
"\x00\x00\x01\xdf\x18\x00\x00\x00"
"text/xml<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelo"
"pe/\"><soap:Body><AuthenticateResponse xmlns=\"http://schemas.microsoft.co"
"m/analysisservices/2003/ext\"><return><SspiHandshake>TlRMTVNTUAACAAAAEAAQA"
"DgAAAA1goricoZLJwyNzFkAAAAAAAAAAFQAVABIAAAABQLODgAAAA9E \n"
"AEMAUwBFAFIAVgBFAFIAAgAQAEQAQwBTAEUAUgBWAEUAUgABABAARABDAFMARQBSAFYARQBSAA"
"QA \n"
"EABkAGMAcwBlAHIAdgBlAHIAAwAQAGQAYwBzAGUAcgB2AGUAcgAAAAAA \n"
"</SspiHandshake></return></AuthenticateResponse></soap:Body></soap:Envelop"
"e>G"
send buf5 524
"\x0e\x10\x00\x04\x00\x00\x00"
"\b"
"\x00\x00\x01\xf4\x19\x00\x00\x00"
"text/xml<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelo"
"pe/\"><soap:Body><Authenticate xmlns=\"http://schemas.microsoft.com/analys"
"isservices/2003/ext\"><SspiHandshake>TlRMTVNTUAADAAAAGAAYAIIAAAAYABgAmgAAA"
"BAAEABIAAAAGgAaAFgAAAAQABAAcgAAABAAEACy \n"
"AAAANYKI4gUBKAoAAAAPVwBBAE4ARwBSAE8ATgBHAGEAZABtAGkAbgBpAHMAdAByAGEAdABvAH"
"IA \n"
"VwBBAE4ARwBSAE8ATgBHAAB6DHpBvFa2AAAAAAAAAAAAAAAAAAAAAIJt4pOb73mIR48zywWfH4"
"7J \n"
"bkF3U6raAmC8c/EExCLOF32ky4Y9Ih8= \n"
"</SspiHandshake></Authenticate></soap:Body></soap:Envelope>"
recv buf6 396
"\x0e\x10\x00\x04\x00\x00\x00\x15\x00\x00\x01"
"a"
"\x18\x00\x00\x00"
"application/sx+xpress"
"\x00"
"悙o"
"\x02\x00\x00"
"Y"
"\x01\x00\x00\x00\x00\x00\x00\xdf\xff\x01\xb0\x04\xfe\x03"
"1"
"\x00"
"."
"\x00"
"0"
"\x00\xfd\x06"
"U"
"\x00"
"T"
"\x00"
"F"
"\x00"
"-"
"\x00"
"1"
"\x00"
"6"
"\x00\x00\xf0"
")h"
"\x00"
"T"
"\x11\x00"
"At\b"
"\x00"
"p"
"\x00"
":"
"\x00"
"/\b"
"\x00"
"s"
"\x00"
"c"
"\x00"
"h"
"\x00"
"e"
"\x00"
"m"
"\x00"
"aX"
"\x00"
"."
"\x00"
"xH"
"\x00"
"lH"
"\x00"
"ox"
"\x00"
"px"
"\x00"
"o"
"\x00\x00\x11"
"*"
"\x1a"
"r"
"\x00"
"g:"
"\x01\x8b\x00"
"/X"
"\x01"
"n"
"\x00"
"v("
"\x00"
"l"
"\x88\x00"
"p8"
"\x00"
"/"
"\x00\xf0\x04\xed\x00\xf0"
"\bE"
"\xef\x00"
"躏"
"\x01\x02\x03\xf8\x01\xf0"
"\n"
"\x04\x00\x05"
""
"\x02"
"n8"
"\x02"
":"
"\x18\x00"
"k"
"\x01\xef\x00\x04\x00\xf6\x02\x0e\x8f\x04"
"<BX"
"\x00"
"d"
"\x00"
"y"
"\x00\xef\x01\x02\x05"
"貘"
"\x03\xf0"
"6'"
"\x03\xff\x05"
"m"
"\x00"
"猌i"
"\x88\x00"
"r"
"\xa0\x01\xb1\x02"
"fH"
"\x01"
".x"
"\x00"
"o"
"\xb8\x00"
"/\b"
"\x01"
"n"
"\x18\x00"
"l`"
"\x02"
"s("
"\x01"
"s\b"
"\x00"
"eH"
"\x01"
"vX"
"\x00"
"cH"
"\x00"
"s\b"
"\x01"
"28\v0阿\r("
"\x00"
"3H"
"\x00"
"ep"
"\x05"
"t"
"\x00\xf0\x14"
"A"
"\x00"
"u8"
"\x00"
"\t"
"\x03"
"n8"
"\x00"
"I"
"\x01"
"a8"
"\x00"
"e"
"\x00"
"R"
"\x18\x00"
"s("
"\x04"
"o"
"\xb8\x00"
"9"
"\x02\xef\x06\x00\x07\x05\xac\x04"
"\f"
"\xf8\x04\xf0\x05"
"#"
"\x07\x99\x00\xef\x00"
"\b"
"\x00\xf6\x05\x0e\x7f\x05"
"U"
"\x06"
"rH"
"\x00"
"t"
"\x98\x05"
"r"
"\xd8\x01\x98\x04"
"\t貘"
"\x06\xf0"
"\rS`"
"\x01"
"p"
"\xb0\x01\xff\x07"
"`THp"
"\x02"
"nh\n"
"s"
"\x10\x04"
"a"
"\x00"
"kP"
"\x01\x10\x01"
"\n"
"\xf8\x07"
"\f"
"\x00"
"鼢鼢鼹"
"\x81"
"\t"

[ 本帖最后由 断寒 于 2009-8-14 11:05 编辑 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2009-8-14 11:08:52 | 只看该作者
呵呵,没用过socket,学习学习,
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2009-8-14 11:10:00 | 只看该作者
问题是:
第1个lrs_send中使用的buf3一直是不变的,获取的buf4直接关联就能执行通过,
第2个lrs_send中使用的buf5每次录制得到的data都不一样,看不出有什么规律,都是一组乱排序的字符串.这个时候怎么对buf5进行参数化??
以下我在附上几次录制时buf5的data:
send buf5 524
        "\x0e\x10\x00\x04\x00\x00\x00"
        "\b"
        "\x00\x00\x01\xf4\x19\x00\x00\x00"
        "text/xml<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelo"
        "pe/\"><soap:Body><Authenticate xmlns=\"http://schemas.microsoft.com/analys"
        "isservices/2003/ext\"><SspiHandshake>TlRMTVNTUAADAAAAGAAYAIIAAAAYABgAmgAAA"
        "BAAEABIAAAAGgAaAFgAAAAQABAAcgAAABAAEACy \n"
        "AAAANYKI4gUBKAoAAAAPVwBBAE4ARwBSAE8ATgBHAGEAZABtAGkAbgBpAHMAdAByAGEAdABvAH"
        "IA \n"
        "VwBBAE4ARwBSAE8ATgBHACYbiK519akbAAAAAAAAAAAAAAAAAAAAAPfwp4xBDOiIH00shIH4w+"
        "54 \n"
        "JmuK1PIX82X46vFeCM7y8bPzLatZ0Oo= \n"
        "</SspiHandshake></Authenticate></soap:Body></soap:Envelope>"


send  buf5 524
        "\x0e\x10\x00\x04\x00\x00\x00"
        "\b"
        "\x00\x00\x01\xf4\x19\x00\x00\x00"
        "text/xml<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelo"
        "pe/\"><soap:Body><Authenticate xmlns=\"http://schemas.microsoft.com/analys"
        "isservices/2003/ext\"><SspiHandshake>TlRMTVNTUAADAAAAGAAYAIIAAAAYABgAmgAAA"
        "BAAEABIAAAAGgAaAFgAAAAQABAAcgAAABAAEACy \n"
        "AAAANYKI4gUBKAoAAAAPVwBBAE4ARwBSAE8ATgBHAGEAZABtAGkAbgBpAHMAdAByAGEAdABvAH"
        "IA \n"
        "VwBBAE4ARwBSAE8ATgBHAC2Dvna63ia7AAAAAAAAAAAAAAAAAAAAABNCdHQu6nuCYlmKGWyZoF"
        "Ny \n"
        "oyuLrP6a1Dx6wN9K/yozn3uCjZki/1E= \n"
        "</SspiHandshake></Authenticate></soap:Body></soap:Envelope>"
回复 支持 反对

使用道具 举报

该用户从未签到

4#
 楼主| 发表于 2009-8-14 11:20:10 | 只看该作者
录制的socket连接的data中可以看出有SspiHandshake,这个是MS的安全支持提供器接口所使用的一个交互接口,里面的传输数据都是经过加密的,这个时候怎么参数化?
回复 支持 反对

使用道具 举报

该用户从未签到

5#
发表于 2009-8-14 12:58:27 | 只看该作者
首先从你的脚本中看到好象可以用webservice来做,一般来说最好用上层协议来完成测试;如果一定要用socket参数化的话,就需要找到MS提供的接口(我想应该是一个DLL),然后调用它,得到加密数据,然后通过lr_save_string的方式参数化
回复 支持 反对

使用道具 举报

该用户从未签到

6#
发表于 2010-12-2 17:09:52 | 只看该作者
回复 5# lijian422202


    怎么调用 能否说具体点
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-9 04:41 , Processed in 0.068484 second(s), 29 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

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