生成隨機字串並引用
阿新 • • 發佈:2019-01-27
目的:使用隨機字串拼接引用,實現對bbs註冊介面壓測;
隨機生成字串 int itera_num,rand_num,i; char i_name[24]=""; char StrTable[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; ..........省略................... for (i=0;i<=8;i++) { rand_num=rand()%62; strncat(i_name,StrTable+rand_num,1); } lr_save_string(i_name,"i_name_value"); lr_log_message("i_name== %s", i_name); //i_name_value即為可傳入引數 lr_log_message("i_name_value== %s", lr_eval_string("{i_name_value}")); //將i_name_value引入到names即可 web_submit_data("member.php", "Action=http://www.limlhome.cn/bbs/member.php?mod=register&inajax=1", "Method=POST", "EncType=multipart/form-data", "TargetFrame=", "RecContentType=text/xml", "Referer=http://www.limlhome.cn/bbs/member.php?mod=register", "Snapshot=t9.inf", "Mode=HTML", ITEMDATA, "Name=regsubmit", "Value=yes", ENDITEM, "Name=formhash", "Value={formhash}", ENDITEM, "Name=referer", "Value=http://www.limlhome.cn/bbs/forum.php", ENDITEM, "Name=activationauth", "Value=", ENDITEM, "Name=FSJkhH", "Value={i_name_value}", ENDITEM, "Name=hDALC8", "Value=123456", ENDITEM, "Name=QmMt8M", "Value=123456", ENDITEM, "Name=RELb5r", "Value={email}@qq.com", ENDITEM, LAST);