Error while decrypt the password in Script (1296 Views)
Reply
Advisor
Rajesh_Sahu
Posts: 31
Registered: ‎08-03-2011
Message 1 of 8 (1,296 Views)
Accepted Solution

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

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

Please use plain text.
HP Expert
Editus
Posts: 630
Registered: ‎04-06-2011
Message 2 of 8 (1,282 Views)

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

Please use plain text.
Advisor
Rajesh_Sahu
Posts: 31
Registered: ‎08-03-2011
Message 3 of 8 (1,279 Views)

Re: Error while decrypt the password in Script

Hi
I used your solution, but it does not even compile.
Please use plain text.
HP Expert
Shane_Evans
Posts: 152
Registered: ‎04-08-2010
Message 4 of 8 (1,267 Views)

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
Product Manager - HP LoadRunner
www.hp.com/go/loadrunner
Please use plain text.
Frequent Advisor
stormshade69
Posts: 32
Registered: ‎01-03-2012
Message 5 of 8 (1,250 Views)

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

Please use plain text.
Occasional Advisor
Kim Sandell
Posts: 7
Registered: ‎02-18-2011
Message 6 of 8 (1,239 Views)

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
Please use plain text.
Advisor
robbav
Posts: 21
Registered: ‎05-05-2010
Message 7 of 8 (1,149 Views)

Re: Error while decrypt the password in Script

that works like a charm - thanks!

Please use plain text.
Occasional Advisor
HenriqueAbreu
Posts: 11
Registered: ‎02-14-2014
Message 8 of 8 (323 Views)

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.

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation