jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From black gaff <joseph.kill...@gmail.com>
Subject Re: How to mask/encrypt values sent as an HTTP request parameter
Date Fri, 22 Oct 2010 15:53:55 GMT


sebb-2-2 wrote:
> 
> If you are able to code in Java, then you should be able to use the
> BeanShell Post-Processor to redact the contents of the SampleResult
> (held in the 'prev' variable).
> 
> something like:
> 
> prev.setSampleData(prev.getSampleData().replace("secret","******"))
> 
> Similarly if the secret is in one of the headers (use
> setRequestHeaders() and getRequestHeaders())
> 
> Post-Processors are run before Listeners, so any change you make will
> be reflected in the data that is saved.
> 
> 

After getting some basic java tutorials and learning that the secret text is
written to "Response Data" via simple data writer, I've come up with the
following code:


      import org.apache.jmeter.util.JMeterUtils;
      import org.apache.jmeter.samplers.SampleResult;
      import java.lang.String;
     
prev.setResponseData(prev.getResponseData().replace("secret","******"));  


Unfortunately, it isn't redacting the information as I had hoped.  Any
thoughts, oh wise ones?

Also, for others learning to write script for Jmeter, I've found the
following link rather helpful: 
http://www.javadocexamples.com/java_examples/org/apache/jmeter/
http://www.javadocexamples.com/java_examples/org/apache/jmeter/ 

-- 
View this message in context: http://jmeter.512774.n5.nabble.com/How-to-mask-encrypt-values-sent-as-an-HTTP-request-parameter-tp3200142p3232490.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message