-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathninja.js
33 lines (28 loc) · 952 Bytes
/
ninja.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env phantomjs
var page = require('webpage').create(),
args = require('system').args,
util = require('util');
if (args.length === 1) {
console.log('Please specify the URL to an SSL page.');
phantom.exit(1);
}
page.onResourceReceived = function (response) {
if (response.stage == "start") {
var protocol = response.url.substr(0, 8);
console.log(util.inspect(response.url));
if (protocol !== "https://" && response.url.substr(0, 5) !== "data:") {
console.log("ALERT: The secure page " + args[1] + " loaded an insecure asset " + response.url + " which may trigger warnings and hurt customer perception.");
phantom.exit(1);
}
}
};
page.open(args[1], function(status) {
if (status === "success") {
console.log("All good!");
phantom.exit(0);
}
else {
console.log("Could not open " + args[1]);
phantom.exit(1);
}
});