-
-
Save loveshell/7300149 to your computer and use it in GitHub Desktop.
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
var page = require('webpage').create(), | |
system = require('system'), | |
address; | |
page.onInitialized = function () { | |
page.evaluate(function () { | |
// additional detection code here perhaps | |
// f.e. detecting STORED/DOM XSS | |
}); | |
}; | |
page.settings.XSSAuditingEnabled = true; | |
// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this") | |
page.onConsoleMessage = function(msg) { | |
if (msg.indexOf("Refused to execute a JavaScript script") == 0) { | |
console.log("XSS!"); | |
} | |
}; | |
if (system.args.length === 1) { | |
console.log('Usage: xssdetect.js <some URL>'); | |
phantom.exit(1); | |
} else { | |
address = system.args[1]; | |
console.log('Checking ' + address + '...'); | |
page.open(address, function (status) { | |
if (status !== 'success') { | |
console.log('FAIL to load the address'); | |
} else { | |
window.setTimeout(function () { | |
phantom.exit(); | |
}, 1500); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment