LoadRunner Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Error while decrypt the password in Script

SOLVED
Go to solution
Highlighted
Rajesh_Sahu
Super Collector

Error while decrypt the password in Script

Hi All,

I am getting the error when trying to encrypt the password.

 

web_submit_form("j_spring_security_check;jsessionid=2B3718A7975886FBBC9A867700536CF3.nomurastructure-uat1",
  "Snapshot=t2.inf",
  ITEMDATA,
  "Name=j_username", "Value=sar", ENDITEM,
  //"Name=j_password", "Value=raj12", ENDITEM,

..............

I copied the password in password encoder tool and then wrote the below code.
 

web_submit_form("j_spring_security_check;jsessionid=2B3718A7975886FBBC9A867700536CF3.nomurastructure-uat1",
  "Snapshot=t2.inf",
  ITEMDATA,
  "Name=j_username", "Value=sar", ENDITEM, 
  "Name=j_password", "Value=lr_decrypt("4eef186a1dfc6eee8ad627caaa2a43b49d52")", ENDITEM,

 

But it gives compile error.

 

I am using LR 9.5.

 

Regards,

Rajesh Sahu

-----------------

7 REPLIES
Editus
HPE Expert

Re: Error while decrypt the password in Script

Hello Rajesh

 

Use it like this

 

"Name=j_password", "Value=lr_decrypt(lr_eval_string("4eef186a1dfc6eee8ad627caaa2a43b49d52"))", ENDITEM,

 

Cheers

Rajesh_Sahu
Super Collector

Re: Error while decrypt the password in Script

Hi
I used your solution, but it does not even compile.
Shane_Evans
HPE Expert

Re: Error while decrypt the password in Script

Rajesh, could you post the entire web_submit_form and compile error?

You may need to evaluate that password outside of the web_submit_form function, save it into a parameter then use the parameter in your itemdata section. But I can't be sure without seeing the error.

Shane Evans
stormshade69
Regular Collector

Re: Error while decrypt the password in Script

i usually do it like this:

 

web_set_user("domain\\{UserName}",
  lr_decrypt("4ee1000ff1c911c3cecf3988"),  "domain:port");

 

i suggest you correlate this:

jsessioni​d=2B3718A7975886FBBC9A867700536CF3.nomurastructure​-uat1",

because session ids usually has a dynamic value everytime you go to a page that needs a session

Kim Sandell
Occasional Contributor
Solution

Re: Error while decrypt the password in Script

Your code below mixes LR function calls inside a string.

 

The "Name=j_password", "Value=lr_decrypt ..." statement is invalid since you try to call a function by entering the name of it in a string .. Then you terminate the string with a " inside the decrypt statement .. :)

 

To do this right you need to change the code to:

 

lr_save_string( lr_decrypt("4eef186a1dfc6eee8ad627caaa2a43b49d52") ,"passwd"); // Store Password in a variable

 

web_submit_form("j_spring_security_check;jsessionid=2B3718A7975886FBBC9A867700536CF3.nomurastructure-uat1",
  "Snapshot=t2.inf",
  ITEMDATA,
  "Name=j_username", "Value=sar", ENDITEM, 
  "Name=j_password", "Value={passwd}", ENDITEM, // Use the parameter here !!

 

Enjoy!

Kim Sandell
www.celarius.com
blog: ptfrontline.wordpress.com
robbav
Super Collector

Re: Error while decrypt the password in Script

that works like a charm - thanks!

HenriqueAbreu
Occasional Contributor

Re: Error while decrypt the password in Script

The problem with this approach is that the password shows as plain text on the (extended) logs.

 

What I did was to encrypt the whole "Value=mypassword" text, and save this encryption as a parameter. Then use:

"Name=j_password", lr_decrypt(lr_eval_string("{pass}")), ENDITEM,

 Hope this helps someone.

//Add this to "OnDomLoad" event