Highlighted
Absent Member.. Absent Member..
Absent Member..
9265 views

Coorelating data in Header

Hi ,

I am trying to script for a web application using LR 11.03..  I need little help for coorelating the data mentioned in the header.. Please refer the attachment

 

In the HEADER, I need to coorelate the value present under the HEADER NAME - "X-CSRF-TOKEN". I have created a manual coorelation with the definition

 

web_reg_save_param_ex(
  "ParamName=CorrelationParameter_2",
  "LB=: ",
  "RB=\n",
  SEARCH_FILTERS,
  "Scope=HEADERS",
  "HeaderNames=X-CSRF-TOKEN",
  LAST);

 

but still doesnt helps. On replaying, getting the error as

 

Action.c(40): Error -35061: No match found for the requested parameter "CorrelationParameter_2". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 1000000 bytes, use web_set_max_html_param_len to increase the parameter size   [MsgId: MERR-35061]
Action.c(40): Registered web_reg_find successful for "Text=Financial Professional" (count=2)   [MsgId: MMSG-26364]
Action.c(40): web_url("register") highest severity level was "ERROR", 596313 body bytes, 13492 header bytes, 246 chunking overhead bytes   [MsgId: MMSG-26387]

 

it would be great if someone can help me out on this,

 

Thanks for your help

 

N Rathi

0 Likes
9 Replies
Highlighted
Absent Member.
Absent Member.

Re: Coorelating data in Header

Instead of  setting right boundry to newline (\n), can you please use "RB=", "savelen=36" if 36 is the length of the string want to save and it is a fixed length?

 

 

0 Likes
Highlighted
New Member.

Re: Coorelating data in Header

Hi N-Rathi,

 

Having same problem trying to correlate "X-CSRF-TOKEN". Did you find any solution on this?

 

Regards,

Fabricio

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Coorelating data in Header

Hi Fabrico

This worked for me

 

web_reg_save_param_ex(
  "ParamName=CorrelationParameter_1",
  "LB=X-CSRF-TOKEN: ",
  "RB=\r\n",
  "Ordinal=1",
  SEARCH_FILTERS,
  "Scope=Headers",
  "RequestUrl=*/template.LOGIN*",
  LAST);

 

I also replaced all the occurring instances of this value with correlation variable

 

Hope it works for you as well

 

N Rathi

 

 

Highlighted
Regular Contributor.
Regular Contributor.

Re: Coorelating data in Header

Hi ,

I am unable to correlate below highlighted CSRF token value in below header:-

web_add_auto_header("CSRFToken","X2E4NmZkMzhhLThmYTMtNGZhNi1iYjgwLTcyY2QwZWE3N2FjYi00QTc1N0Q4ODA4MzhFMDA0RTg3OTE4NjE1MDcxQTBBRA==");

 

I am using the below code:-

web_reg_save_param_ex(
"ParamName=CSRFTokenID_1",
"LB=CSRFToken\",\"",
"RB=\");",
"Ordinal=1",
SEARCH_FILTERS,
"Scope=ALL",
LAST);

 

Error I am getting (even after changing scope to headers and cookies too):-

No match found for the requested parameter "CSRFTokenID_1". Either the specified boundaries were not found in the response or the matched text is longer than current max html parameter size of 100000 bytes. The total length of the response is 2710 bytes.

 

Your expert help is appreciated.

Thanks in advance...!!!

 

-Rahul Kalbhor

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Coorelating data in Header

You stated "I am unable to correlate below highlighted CSRF token value in below header" and then you list a LR-function call. You based your pattern on this function call. This is a misunderstanding how correlation works.

Functions like web_reg_save_param_*() look only to the data received from the server. (Enable Extended logging with Date returned by server to validate the pattern you have to use. You might try to high-light the the value X2E4...== and then right-klick with your mouse and select 'Correlate Selection'. VuGen might do all the work for you. Or have a look to @N-Rathi last post that is reported to work.

 

P.S.

The issue that @N-Rathi has in his intial post is that he missed this line in the documentation: If Scope=Headers and a HeaderNames filter is used, only the values of the specified headers are searched. If no HeaderNames filter is used, all header text is searched. He should had left out the "LB=..." and "RB=..."

Signature:
Reward community members who take time to respond and help.
Highlighted
Regular Contributor.
Regular Contributor.

Re: Coorelating data in Header

@JHF Remmelzwaal  appreciate the for clarification. Got the solution.

pardon for misunderstanding because of me, giving incorrect header code instead of one from response snapshot.

 

Again thanks for same....!!!

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Coorelating data in Header

Never apologize for misunderstanding, we all have to learn each day. Success and have fun.

Signature:
Reward community members who take time to respond and help.
Highlighted
Contributor.
Contributor.

Re: Coorelating data in Header

Hi,

I am facing an issue correlating the header.

using the below piece of code.

web_reg_save_param_ex(
        "ParamName=c_CSRFToken",
        "LB=x-csrf-token: ",
        "RB===",
        "Ordinal=1",
        SEARCH_FILTERS,
        "Scope=HEADERS",
        "ContentType=application/json",
        LAST);

 

Getting the below error.

 

Action.c(254): Error -35061: No match found for the requested parameter "c_CSRFToken". Either the specified boundaries were not found in the response or the matched text is longer than current max html parameter size of 256 bytes. The total length of the response is 862 bytes. You can use "web_set_max_html_param_len" to increase the max parameter size. [MsgId: MERR-35061]

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Coorelating data in Header

@Skboddapati, to help you out please supply an example of the received data from the server. To enable logging: Run Time Settings -> Log and enable  / check:

"Enable Logging"

"Send messages" : Allways

"Extented Log" : "Data returned by server"

Notes:

It looks like you based the capture of your CSRF Token based on receiving a header. Normally the token is send from client to server and not the other way round.

In the cases that I saw CRSF Tokens, those were send from the server to the client in a response or javascript. So I suggest to use "Scope=All".

Depending on de coding of your CSRF Token the two "==" at the end are part of the token, so do not use them as "RB" in your web_reg_save_param_ex().

I hope that this helps you to solve the correlation.

Signature:
Reward community members who take time to respond and help.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.