lr编写https脚本
login() {
lr_load_dll( "redcorespa.dll" );
web_set_certificate_ex("CertFilePath=E:\\lr_scripts\\login_https_cert\\httpscert.pem",
"CertFormat=PEM",
"KeyFilePath=E:\\lr_scripts\\login_https_cert\\privkey6.pem",
"KeyFormat=KEY",
"Password=",
"CertIndex=1",
LAST);
web_set_sockets_option("USER_IP_ADDRESS", "192.168.2.66");
web_set_sockets_option("SSL_VERSION","TLS");
/* ---登录地址 */
lr_save_string( "https://sdp3.deep.cn/client/v5/login",
"login_url" );
/* --------------------------------用户登录-------------------- */
lr_think_time(2);
web_add_header("User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.429 Safari/537.36 );
web_reg_save_param("resultCode",
"LB=\"code\":\"",
"RB=\"}",
LAST);
lr_start_transaction( "用户登录" );
web_custom_request( "login",
"URL={login_url}",
"Method=POST",
"Resource=0",
"Referer=",
"Mode=HTML",
"EncType=application/x-www-form-urlencoded; charset=UTF-8",
"Body=domainName=sdp3.deep.cn&loginName={baseusername}&password=6HNz84K5ajVP9RxVxvBAsw==&sms=false&deviceInfo=1sdf5d4f5fs4d5f54ds5",
LAST );
if ( strcmp( lr_eval_string( "{resultCode}" ),"00" ) ==0) {
lr_end_transaction( "用户登录", LR_PASS );
lr_output_message("%s 登录成功",lr_eval_string("{username}") );
} else {
lr_end_transaction( "用户登录", LR_FAIL );
lr_error_message("%s 登录失败 %s",lr_eval_string("{username}"), loginBody );
return 0;
}
return 0;
}
本文来自博客园,作者:up~up,转载请注明原文链接:https://www.cnblogs.com/soft-engineer/p/15090685.html