抓包实现脚本编写--手持机
Action(){
char a2[100];
char a1[100];
char jFC[100];
lr_message("======The final message is=========%s", lr_eval_string("{bnb}"));
strcpy(jFC,lr_eval_string("{bnb}"));
sscanf(jFC, "%127[^#]#%127[^ ]", a1, a2);
lr_output_message(a1);
lr_output_message(a2);
lr_save_string(a1,"token1");
lr_save_string(a2,"token2");
// lr_message("======The final message is=========%s", lr_eval_string("{token1}"));
// lr_message("======The final message is=========%s", lr_eval_string("{token2}"));
lr_start_transaction("ruku816");
lr_save_string("\"success\"","Rusult");
web_reg_save_param("NewRusult",
"LB=status=",
"RB=/>",
LAST);
web_add_header("HMAppKey","41767D5D87D95773622A080C470488B");
web_custom_request("bbm",
"URL=http://192.168.10.27:26266/MiddlewareWeb/rest/hh/component",
"Method=PUT",
"EncType=application/xml; charset=UTF-8",
// "Body=<?xml version=\"1.0\" encoding=\"utf-8\"?><dn:HHMessages xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:dn=\"http://dn.com/soa/schemas/\"><dn:Header id=\"\" status=\"\" timeStamp=\"2013-04-11T18:34:32+08:00\" /><dn:Operation id=\"\" subNdx=\"0\" status=\"single\" requestedDate=\"2013-04-11T17:47:50\" endDate=\"2013-04-11T18:34:32+08:00\">2001</dn:Operation><dn:Request subNdx=\"0\">{token1}</dn:Request><dn:CreatedBy>jack</dn:CreatedBy><dn:Device>CS101H0000002021</dn:Device><dn:HHMessage><dn:Asset><dn:Id>{token2}</dn:Id><dn:UnitQTY>1</dn:UnitQTY></dn:Asset><dn:Tags><dn:Tag type=\"1000\"><dn:Barcode>{biaoq}</dn:Barcode><dn:ReadTime>2013-04-11T18:34:21+08:00</dn:ReadTime></dn:Tag></dn:Tags></dn:HHMessage></dn:HHMessages>",
// "Body=<?xml version=\"1.0\" encoding=\"utf-8\"?><dn:HHMessages xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:dn=\"http://dn.com/soa/schemas/\"><dn:Header id=\"\" status=\"\" timeStamp=\"2013-06-07T14:34:18+08:00\" /><dn:Operation id=\"\" subNdx=\"0\" status=\"single\" requestedDate=\"2013-06-07T14:33:33+08:00\" endDate=\"2013-06-07T14:34:18+08:00\">2001</dn:Operation><dn:Request subNdx=\"0\" name=\"RQ03\">400000001</dn:Request><dn:CreatedBy>jackGCJJ</dn:CreatedBy><dn:Device>CS101H0000002223</dn:Device><dn:HHMessage><dn:Asset><dn:Id>10643</dn:Id><dn:UnitQTY>1</dn:UnitQTY></dn:Asset><dn:Tags><dn:Tag id=\"\" type=\"1001\" name=\"\"><dn:Epc>F030000000000000000F0252</dn:Epc><dn:ReadTime>2013-06-07T14:33:41+08:00</dn:ReadTime></dn:Tag><dn:Tag type=\"1000\"><dn:Barcode>GCW197</dn:Barcode><dn:ReadTime>2013-06-07T14:34:02+08:00</dn:ReadTime></dn:Tag></dn:Tags></dn:HHMessage></dn:HHMessages>",
"Body=<?xml version=\"1.0\" encoding=\"utf-8\"?><dn:HHMessages xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:dn=\"http://dn.com/soa/schemas/\"><dn:Header id=\"\" status=\"\" timeStamp=\"2013-06-08T10:43:04+08:00\" /><dn:Operation id=\"\" subNdx=\"0\" status=\"single\" requestedDate=\"2013-06-08T10:42:18+08:00\" endDate=\"2013-06-08T10:43:04+08:00\">2001</dn:Operation><dn:Request subNdx=\"0\" name=\"RQ03\">{token1}</dn:Request><dn:CreatedBy>jackGCJJ</dn:CreatedBy><dn:Device>CS101H0000002223</dn:Device><dn:HHMessage><dn:Asset><dn:Id>{token2}</dn:Id><dn:UnitQTY>1</dn:UnitQTY></dn:Asset><dn:Tags><dn:Tag id=\"\" type=\"1001\" name=\"\"><dn:Epc>F030000000000000000F0252</dn:Epc><dn:ReadTime>2013-06-08T10:42:20+08:00</dn:ReadTime></dn:Tag><dn:Tag type=\"1000\"><dn:Barcode>{biaoq}</dn:Barcode><dn:ReadTime>2013-06-08T10:42:32+08:00</dn:ReadTime></dn:Tag></dn:Tags></dn:HHMessage></dn:HHMessages>",
LAST);
// lr_message("======The final message is=========%s", lr_eval_string("{biaoq}"));
if (strcmp(lr_eval_string("{Rusult}"),lr_eval_string("{NewRusult}")) == 0)
{
lr_end_transaction("ruku816", LR_PASS);
}
else
{
lr_end_transaction("ruku816", LR_FAIL);
}
return 0;
}