|
vuser_init.c(110): Notify: Parameter Substitution: parameter "uname" = "v0000001"[MsgId: MMSG-13992]
vuser_init.c(110): Notify: Parameter Substitution: parameter "pass" = "88888888"[MsgId: MMSG-13992]
vuser_init.c(111): lrs_receive(socket1, buftt1)[MsgId: MMSG0]
vuser_init.c(111): Mismatch (expected 220 bytes, 0 bytes actually received)[MsgId: MMSG0]
================================EXPECTED BUFFER================================[MsgId: MMSG0]
"\x00\x00\x00\x00\x00\x00\x00\x00\xcc\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00"
"\x00\x00\x00\x00\x00\xbc\x00\x00\x00\xbf\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"192.168.1.17"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x15\x00"
"angelina"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"123456"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"192.168.1.17"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00"
"P"
"\x00"
"test"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"123456"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x10\x00\x01\x00"
"殁a*"
"\x7f\x80"
"筗崑{L6?聒"
[MsgId: MMSG0]
===============================================================================[MsgId: MMSG0]
================================RECEIVED BUFFER================================[MsgId: MMSG0]
[MsgId: MMSG0]
===============================================================================[MsgId: MMSG0]
vuser_init.c(113): lrs_get_last_received_buffer(socket1, buf_p, size_p)[MsgId: MMSG0]
vuser_init.c(115): ------4[MsgId: MMSG-17999]
vuser_init.c(129): __usPort:0[MsgId: MMSG-17999]
vuser_init.c(130): __caIp:[MsgId: MMSG-17999]
vuser_init.c(131): __usTokenLe:0[MsgId: MMSG-17999]
vuser_init.c(70): __MsgHeader:[MsgId: MMSG-17999]
vuser_init.c(71): __ usType = 60128[MsgId: MMSG-17999]
vuser_init.c(72): __ usMessageId = 5000[MsgId: MMSG-17999]
vuser_init.c(73): __ usMessageLen = 1033966408[MsgId: MMSG-17999]
vuser_init.c(74): __ uiPersonId = 17104812[MsgId: MMSG-17999]
vuser_init.c(134): lrs_save_param_ex(socket1, user, buf_p, 0, 4, null, pid)[MsgId: MMSG0]
vuser_init.c(134): Notify: Saving Parameter "pid = \xac\xff\x04\x01"[MsgId: MMSG-13798]
vuser_init.c(136): __ uiPersonId1 = 17104812[MsgId: MMSG-17999]
脚本如下:
lrs_startup(257);
lrs_create_socket("socket1", "UDP", "RemoteHost=192.168.1.3:56782", LrsLastArg);
token(retPid);
sprintf(tmp3, "Value=%s", retPid);
lr_output_message("%s", tmp3 );
sprintf(tmp4[0], "Url=../suggestion/list_1?pid=%s&t2=1302317640031", retPid);
sprintf(tmp4[1], "Url=../suggestion/list_1?pid=%s&t2=1302317642093", retPid);
sprintf(tmp5, "Referer={HostUrl}suggestion/list?pid=%s", retPid);
lr_output_message("__ tmp3 = %s",tmp5 );
lr_save_string(retPid, "person_id");
/*
//upload hisroty
lrs_create_socket("socket0", "TCP", "LocalHost=0", "RemoteHost=192.168.1.127:1681", LrsLastArg);//192.168.1.127:1681 192.168.1.87:1681
lrs_send("socket0", "buf0", LrsLastArg);
lrs_close_socket("socket0");
*/
return 0;
}
void printMsgHeader(PMESSAGEHEADER p)
{
PMESSAGEHEADER pmsgHead = p;
lr_output_message("__MsgHeader: ");
lr_output_message("__ usType = %d", pmsgHead->usType);
lr_output_message("__ usMessageId = %d", pmsgHead->usMessageId);
lr_output_message("__ usMessageLen = %d", pmsgHead->usMessageLen);
lr_output_message("__ uiPersonId = %d", pmsgHead->uiPersonId);
}
int token(char *ret)
{
char acToken[sizeof(RAWMESSAGEPACKETHEADER) + sizeof(MESSAGEHEADER) + sizeof(TOKENMESSAGE)];
char *ActualBuffer, *tmp2;
char charY[80];
int NumberOfBytes, i;
PTOKENANSWERMESSAGE p;
PTOKENMESSAGE t;
char name[16], urlTmp[1025];
PLOGINMESSAGE p1;
PMESSAGEHEADER p0;
PLOGINANSWERMESSAGE pLoginAnswer;
PSUGGESTFANSWERMESSAGE pSuggestAnswer;
PSUGGESTFSINGLEMESSAGE pSuggestSingleMessage;
short flagLoginFail = 0, RETRY_COUNT = 3, msgLen = 0, flagSuggestFail = 0, msgId = 0, nResult;
long fp;
char temp[80];
for(i=0; i<RETRY_COUNT; i++)
{
//token
lrs_get_buffer_by_name("buftt0", &ActualBuffer, &NumberOfBytes);
t = (PTOKENMESSAGE)(ActualBuffer + sizeof(RAWMESSAGEPACKETHEADER) + sizeof(MESSAGEHEADER));
lr_output_message("__caOs:%s", t->caOs);
lr_output_message("__uiPersonName:%s", t->uiPersonName);
lrs_free_buffer(ActualBuffer);
lrs_set_recv_timeout(60, 0);
lrs_set_recv_timeout2(30, 0);
lrs_send("socket1", "buftt0", "TargetSocket=192.168.1.126:56782", LrsLastArg);//192.168.1.3:56782
lrs_receive("socket1", "buftt1", LrsLastArg);
nResult = lrs_get_last_received_buffer("socket1", &ActualBuffer, &NumberOfBytes);
NumberOfBytes = sizeof(ActualBuffer);
lr_output_message("------%d", NumberOfBytes);
if(nResult != 0)
{
lr_output_message("接受失败!");
lrs_free_buffer(ActualBuffer);
lr_think_time(1);
if(i==(RETRY_COUNT-1))flagLoginFail = 1;
continue;
}
else
{
p = (PTOKENANSWERMESSAGE)(ActualBuffer+sizeof(RAWMESSAGEPACKETHEADER)+sizeof(MESSAGEHEADER));
p0= (PMESSAGEHEADER)(ActualBuffer+sizeof(RAWMESSAGEPACKETHEADER));
lr_output_message("__usPort:%d", p->usPort);
lr_output_message("__caIp:%s", p->caIp);
lr_output_message("__usTokenLe:%d", p->usTokenLen);
printMsgHeader(p0);
lrs_save_param_ex("socket1", "user", (char*)&p0->uiPersonId, 0, sizeof(int), NULL, "pid");
lr_output_message("__ uiPersonId1 = %d", p0->uiPersonId);
sprintf(ret,"%d",p0->uiPersonId);
lr_output_message("__pid = \"%d\"\n", atoi(lr_eval_string("{pid}")));
sprintf(charY,"%d",lr_eval_string("{pid}"));
lr_output_message("charY = %s\n", charY);
lrs_free_buffer(ActualBuffer);
break;
}
}
if(flagLoginFail){
lr_output_message("__token Fial!!");
lrs_close_socket("socket1");
return -1;
}
//lrs_close_socket("socket1");
return 0;
} |
|