|
#include "web_api.h"
#define RV_OK 0
vuser_init()
{
char str[1024];
int cnt=0,temp1=0,temp2=0,temp3=0,temp4=0,temp5=0,temp6=0,i=0;
char signData[4096]={0};
char signresult[4096]={0};
unsigned char pin[5];
unsigned long pinLen;
unsigned long loginType=2;
unsigned char sigCert[4096]={0}, sigCertB64[4096]={0}, inData[2048]={0}, openData[2048]={0};
unsigned long sigCertLen=0, sigCertB64Len=0, inDataLen=0, signDataLen=0, openDataLen=0;
unsigned long algoType=32772;//sha1RSA:32772 md5RSA:32771
web_reg_save_param("CSRule_1_UID5",
"LB= value=\"",
"RB=\"",
"Ord=2",
"Search=Body",
"RelFrameId=1",
LAST);
web_reg_save_param("CSRule_2_UID3",
"LB=jsessionid=",
"RB=?",
"Ord=1",
"Search=Body",
"RelFrameId=1",
LAST);
web_reg_save_param("CSRule_1_UID4",
"LB= value=\"",
"RB=\"",
"Ord=1",
"Search=Body",
"RelFrameId=1",
LAST);
web_reg_save_param("CSRule_1_UID6",
"LB= value=\"",
"RB=\"",
"Ord=3",
"Search=Body",
"RelFrameId=1",
LAST);
web_reg_save_param( "WCSParam_Diff1", "LB=jsessionid=", "RB=?", "Ord=1", "IgnoreRedirections=Yes", "Search=Body", "RelFrameId=1", LAST );
web_url("10.168.11.204:7002",
"URL=https://10.168.11.204:7002/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=/web/servicetel.png", ENDITEM,
"Url=/web/header-y2.png", ENDITEM,
"Url=/web/message_tip.gif", ENDITEM,
"Url=/web/tips.gif", ENDITEM,
"Url=/web/login_space.png", ENDITEM,
"Url=/web/componentTab-middle.png", ENDITEM,
"Url=/web/user.gif", ENDITEM,
"Url=/web/componentTab-selected.png", ENDITEM,
"Url=/web/serviceroom/serviceroom/images/login/{CSRule_1_UID5}.gif", ENDITEM,
"Url=/web/login/point.gif", ENDITEM,
"Url=/web/tipitem.gif", ENDITEM, "Url=/web/serviceroom_logo.png", ENDITEM,
LAST);
strcpy((char*)inData,lr_eval_string ("{WCSParam_Diff1}"));
lr_output_message ("inData=%s",inData);
inDataLen = strlen((char*)inData);
lr_output_message ("inDataLen=%d",inDataLen);
lr_load_dll ("gdca_api.dll");
temp1=GDCA_SetDeviceType(11);
lr_output_message ("temp1=%d",temp1);
if (RV_OK!=temp1)
{
lr_output_message ("GDCA_SetDeviceType Error...[%d]\n",temp1);
}
else lr_output_message ("GDCA_SetDeviceType OK...\n");
temp2=GDCA_Initialize();
lr_output_message ("temp2=%d",temp2);
if (RV_OK!=temp2)
{
lr_output_message ("GDCA_Initialize Error...[%d]\n",temp2);
}
else lr_output_message ("GDCA_Initialize OK...\n");
strcpy((char*)pin,lr_eval_string ("123456"));
lr_output_message ("pin=%s",pin);
pinLen = strlen((char *)pin);
lr_output_message ("pinLen=%d",pinLen);
temp3=GDCA_Login(2,pin,pinLen);
lr_output_message ("temp3=%d",temp3);
if (RV_OK!=temp3)
{
lr_output_message ("GDCA_Login Error...[%d]\n",temp3);
}
else lr_output_message ("GDCA_Login OK...\n");
temp4=GDCA_ReadLabel((unsigned char*)"LAB_USERCERT_SIG",16,7,sigCert,&sigCertLen);
lr_output_message ("sigCert=%s",sigCert);
lr_output_message ("sigCertLen=%d",sigCertLen);
temp5=GDCA_Base64Encode(sigCert,sigCertLen,sigCertB64,&sigCertB64Len);
lr_output_message ("sigCertB64=%s",sigCertB64);
sigCertB64Len = strlen((char*)sigCertB64);
lr_output_message ("sigCertB64Len=%d",sigCertB64Len);
cnt=GDCA_OpkiSignData("LAB_USERCERT_SIG",16,4,sigCertB64,sigCertB64Len,inData,inDataLen,algoType,0,signData,&signDataLen);
lr_output_message ("cnt=%d",cnt);
lr_output_message ("signData=%s",signData);
signDataLen = strlen((char*)signData);
lr_output_message ("signDataLen=%d",signDataLen);
web_submit_data("login.do;jsessionid={WCSParam_Diff1}",
"Action=https://10.168.11.204:7002/serviceroom/login.do;jsessionid={CSRule_2_UID3}?action={CSRule_1_UID5}",
"Method=POST",
"RecContentType=text/html",
"Referer=https://10.168.11.204:7002/",
"Snapshot=t2.inf",
"Mode=HTML",
ITEMDATA,
"Name=pin", "Value=123456", ENDITEM,
"Name=random", "Value={CSRule_1_UID4}", ENDITEM,
"Name=action", "Value={CSRule_1_UID5}", ENDITEM,
"Name=loginPage", "Value={CSRule_1_UID6}", ENDITEM,
"Name=sign",signData, ENDITEM,
"Name=cert", "Value=MIIEezCCA+"
"SgAwIBAgIPBwACIBEFEgEAAAAAJ2GAMA0GCSqGSIb3DQEBBQUAMIIBJDENMAsGA1UEBh4EAEMATjEbMBkGA1UECB4SAEcAdQBhAG4AZwBkAG8AbgBnMRswGQYDVQQHHhIARwB1AGEAbgBnAHoAaABvAHUxPTA7BgNVBAoeNABHAEQAQwBBACAAQwBlAHIAdABpAGYAaQBjAGEAdABlACAAQQB1AHQAaABvAHIAaQB0AHkxRzBFBgNVBAsePgBHAHUAYQBuAGcAZABvAG4AZwAgAEMAZQByAHQAaQBmAGkAYwBhAHQAZQAgAEEAdQB0AGgAbwByAGkAdAB5MVEwTwYDVQQDHkgARwBEAEMAQQAgAEcAdQBhAG4AZwBkAG8AbgBnACAAQwBlAHIAdABpAGYAaQBjAGEAdABlACAAQQB1AHQAaABvAHIAaQB0AHkwHhcNMTEwNTExMTYwMDAwWhcNMjAwNTExMTYwMDAwWjCCASYxDTALBgNV"
"BAYeBABDAE4xDzANBgNVBAgeBl5/Thx3ATEPMA0GA1UEBx4GXn9d3l4CMTcwNQYDVQQKHi5ef04cdwFlcFtXi8FOZouki8FOLV/DZwmWUFFsU/gARwBEAGMAYQAuADMALQAxMRMwEQYDVQQLHgps1VuaTuOIaE66MVMwUQYDVQQLHkoAaAB0AHQAcABzADoALwAvADYAMQAuADEANAAyAC4AMgAzADkALgAxADQAMAAvAG8AYQAvAE8AYQBJAG4AZABlAHgALgBqAHMAcDE3MDUGA1UEAx4uXn9OHHcBZXBbV4vBTmaLpIvBTi1fw2cJllBRbFP4AEcARABjAGEALgAzAC0AMTEXMBUGCSqGSIb3DQEJARYIOEBxcS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMYeGQFOgy6SPLVs+V6WoASPZCiq405SHg/Y15exv4mgYtyCGQ4wUKMSdYZi/"
"Jmx3jLV34vlzxz39V6jOlck3FXG5Xkd7EWUv/RunM+bjZA0S9rpnnr+jL4BmDBFCeMssxf86SaLE02cDCPM0zQffDr2h1IzhVBIET2zteyWRNopAgMBAAGjgagwgaUwHwYDVR0jBBgwFoAUd0MJEPcVizqwEdJMeweUBPAUVEYwHQYDVR0OBBYEFB2uweA0D+03qZTL2f585ag3/OeUMAsGA1UdDwQEAwIGwDARBgUqVgsHAwQIEwY1NTU1NTUwDwYFKlYLBwQEBhMENTU1NTAVBgUqVhUBAgQMZ2RzYXQuY29tLmNuMBsGBSpWFQEDBBIwMDcyMDIwMTEwNTEyNzIwMDIwDQYJKoZIhvcNAQEFBQADgYEASp+CEz3iRabnv7RacGivy79WZkEpUhPsYSGrtDXcT5EaML4C0zGp6eDnSQqLI2g5PVJmxdbmaqeGrkTnvSRpJIqg7ZkbSvqJUw90u9tYG6/MEi66nD+"
"Ak4FGZ7qc0cD3tQjzqs+70Jfg3n3/B1Odf7W7RY4sp+cXQGDlxdpDK5w=", ENDITEM,
"Name={CSRule_1_UID5}Id", "Value=007202011051272002", ENDITEM,
"Name=agreeProtocol", "Value=on", ENDITEM,
"Name=submitTag", "Value=1", ENDITEM,
EXTRARES,
"Url=../web/servicetel.png", "Referer=https://10.168.11.204:7002/web/serviceroom/serviceroom/page/serviceroom.jsp", ENDITEM,
"Url=../web/serviceroom_logo.png", "Referer=https://10.168.11.204:7002/web/serviceroom/serviceroom/page/serviceroom.jsp", ENDITEM,
"Url=../web/header-y2.png", "Referer=https://10.168.11.204:7002/web/serviceroom/serviceroom/page/serviceroom.jsp", ENDITEM,
"Url=../web/currenUser.gif", "Referer=https://10.168.11.204:7002/web/serviceroom/serviceroom/page/serviceroom.jsp", ENDITEM,
"Url=../web/header-y0.png", "Referer=https://10.168.11.204:7002/web/serviceroom/serviceroom/page/serviceroom.jsp", ENDITEM,
"Url=../web/myserviceroom.gif", "Referer=https://10.168.11.204:7002/web/serviceroom.jsp", ENDITEM,
"Url=../web/clock.gif", "Referer=https://10.168.11.204:7002/web/serviceroom/serviceroom/page/serviceroom.jsp", ENDITEM,
"Url=../web/exit.gif", "Referer=https://10.168.11.204:7002/web/serviceroom/serviceroom/page/serviceroom.jsp", ENDITEM,
"Url=../web/menuBig_on.gif", "Referer=https://10.168.11.204:7002/web/serviceroom.jsp", ENDITEM,
"Url=../web/menuLittle.gif", "Referer=https://10.168.11.204:7002/serviceroom.jsp", ENDITEM,
"Url=../web/bodylayout-y0.gif", "Referer=https://10.168.11.204:7002/web/serviceroom/serviceroom/page/serviceroom.jsp", ENDITEM,
"Url=../web/serviceroom/serviceroom/images/bodylayout-y1.gif", "Referer=https://10.168.11.204:7002/web/serviceroom/serviceroom/page/serviceroom.jsp", ENDITEM,
"Url=../web/serviceroom/serviceroom/images/mainframe/main_line1.jpg", "Referer=https://10.168.11.204:7002/serviceroom/desktop.do?action=searchKey", ENDITEM,
"Url=../web/serviceroom/serviceroom/images/arrow_black.png", "Referer=https://10.168.11.204:7002/serviceroom/desktop.do?action=searchKey", ENDITEM,
"Url=http://icon.ajiang.net/icon_0.gif", "Referer=", ENDITEM,
LAST);
web_url("go.asp",
"URL=http://web1.51.la:82/go.asp?svid=20&id=3097796&tpages=2&ttimes=3&tzone=8&tcolor=32&sSize=1440,900&referrer=https%3A//10.168.11.204%3A7002/&vpage=https%3A//10.168.11.204%3A7002/serviceroom/desktop.do%3Faction%3DsearchKey",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
web_url("go.asp_2",
"URL=http://web1.51.la:82/go.asp?svid=20&id=3097796&tpages=1&ttimes=3&tzone=8&tcolor=32&sSize=1440,900&referrer=https%3A//10.168.11.204%3A7002/&vpage=https%3A//10.168.11.204%3A7002/web/serviceroom/serviceroom/page/serviceroom.jsp",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
return 0;
}
日志如下:
vuser_init.c(157): Error -27225: The "CpfwosueRveO2mHnx86Q0BxKrBYkLoMy+xQdQ44Stu6jrmrI5VUfDY3CiMl6LeTGDJnvSqGy3M+67Rydp+oZuTozBlkO1DWVJVNEla4lTnCESLEbaI6G+VAkPNJn6CqagkONKE0iMA5FkA8MsnK+o6N9pKdAK3ypFGpef70Qjz4=" argument (number 22) is not recognized within "ITEMDATA" [MsgId: MERR-27225]vuser_init.c(157): web_submit_data("login.do;jsessionid={WCSParam_Diff1}") highest severity level was "ERROR", 0 body bytes, 0 header bytes [MsgId: MMSG-26388]Abort was called from an action. |
|