📄 attackapi.js
字号:
var AttackAPI = {
version: '0.8a',
author: 'Petko Petkov | pdp (architect)',
homepage: 'http://www.gnucitizen.org',
credits: {
JeremiahGrossman: {homepage: 'http://jeremiahgrossman.blogspot.com/'},
RSnake: {homepage: 'http://ha.ckers.org'},
DanielBartlett: {homepage: 'http://f-box.org/~dan/'},
PeterPaulKoch: {homepage: 'http://www.quirksmode.org/'},
TylerAkins: {homepage: 'http://rumkin.com'},
VladislavMysla: {homepage: ''}
}};
AttackAPI.URLScanner = {};
AttackAPI.URLScanner.scan = function (callback, URLs, timeout) {
var timeout = (timeout == null)?1000:timeout;
var checkSingleURL = function (URL) {
var request = AttackAPI.RequestBuilder.build();
request.onreadystatechange = function () {
if (request.readyState == 4) {
clearTimeout(timer);
callback(URL, request.status);
}
};
request.open('GET', URL, true);
request.send(null);
var timer = setTimeout(function () {
request.abort();
callback(URL, 408);
}, timeout);
};
for (index = 0; index < URLs.length; index++)
checkSingleURL(URLs[index]);
};
AttackAPI.URLScanner.scriptScan = function (callback, URLs, timeout) {
var timeout = (timeout == null)?1000:timeout;
var head = document.getElementsByTagName('head')[0];
var checkSingleURL = function (URL) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.defer = true;
script.src = URL;
script.onerror = function () {
clearTimeout(timer);
head.removeChild(script);
callback(URL, false);
};
script.onload = function () {
clearTimeout(timer);
head.removeChild(script);
callback(URL, true);
};
head.appendChild(script);
var timer = setTimeout(function () {
head.removeChild(script);
callback(URL, false);
}, timeout);
};
var onerror = window.onerror;
window.onerror = function (message, URL, line) {
if (onerror)
return onerror(message, URL, line);
return true;
};
for (var index = 0; index < URLs.length; index++)
checkSingleURL(URLs[index]);
};
AttackAPI.Server = {};
AttackAPI.Server.getPlatformInfo = function (callback, timeout) {
var timeout = (timeout == undefined)?1000:timeout;
var request = AttackAPI.RequestBuilder.build();
request.onreadystatechange = function () {
if (request.readyState == 4) {
clearTimeout(timer);
callback({ platform: request.getResponseHeader('Server'),
date: request.getResponseHeader('Date'),
powered_by: request.getResponseHeader('X-Powered-By') });
}
};
request.open('HEAD', document.location);
request.send(null);
var timer = setTimeout(function () {
request.abort();
callback(undefined);
}, timeout);
};
AttackAPI.Server.getNetworkInfo = function () {
var hostname = document.domain;
var address = undefined;
try {
var sock = new java.net.Socket();
sock.bind(new java.net.InetSocketAddress('0.0.0.0', 0));
sock.connect(new java.net.InetSocketAddress(document.domain, (!document.location.port)?80:document.location.port));
hostname = sock.getInetAddress().getHostName();
address = sock.getInetAddress().getHostAddress();
} catch (e) {}
return {hostname: hostname, address: address};
};
AttackAPI.CookieJar = {};
AttackAPI.CookieJar.setCookie = function (name, value, expires, path, domain, secure) {
document.cookie = name + '=' + escape(value) +
((expires == undefined)?'':'; expires=' + expires) +
((path == undefined)?'':'; path=' + path) +
((domain == undefined)?'':'; domain=' + domain) +
((secure == undefined)?'':'; secure=' + secure);
};
AttackAPI.CookieJar.delCookie = function (name) {
AttackAPI.CookieJar.setCookie(name, '');
};
AttackAPI.CookieJar.getCookie = function (name) {
var tokens = document.cookie.split(';');
for (var index = 0; index < tokens.length; index++) {
var pair = tokens[index].replace(/^\s*/, '');
if (name == pair.substring(0, name.length))
return pair.substring(name.length + 1);
}
return null;
};
AttackAPI.CookieJar.listCookies = function () {
var results = new Array();
var tokens = document.cookie.split(';');
for (var index = 0; index < tokens.length; index++) {
var pair = tokens[index].split('=');
if (pair[1] && !(pair[0] in results))
results.push(pair[0]);
}
return results;
};
AttackAPI.NetworkSweeper = {};
AttackAPI.NetworkSweeper.lazySweep = function (callback, targets, protocols) {
var links = [];
var protocols = (protocols == null)?['ftp', 'http', 'https']:protocols;
for (index = 0; index < targets.length; index++) {
for (zindex = 0; zindex < protocols.length; zindex++) {
var link = new String(protocols[zindex] + '://' + targets[index]);
link.target = targets[index];
links.push(link);
}
}
AttackAPI.HistoryDumper.lazyDump(function (link, status) {
callback(link.target, status);
}, links);
};
AttackAPI.HistoryDumper = {};
AttackAPI.HistoryDumper.lazyDump = function (callback, links) {
var iframe = document.createElement('iframe');
iframe.style.visibility = 'hidden';
document.body.appendChild(iframe);
var doc = iframe.contentDocument;
if (doc == undefined) doc = iframe.contentWindow.document;
doc.open();
doc.write('<style>a:visited{display: none}</style>');
doc.close();
for (index = 0; index < links.length; index++) {
var testLink = doc.createElement('a');
testLink.href = links[index];
doc.body.appendChild(testLink);
if (testLink.currentStyle) var display = testLink.currentStyle['display'];
else var display = doc.defaultView.getComputedStyle(testLink, null).getPropertyValue('display')
callback(links[index], display == 'none'?true:false);
}
document.body.removeChild(iframe);
};
AttackAPI.Client = {};
AttackAPI.Client.getPlatformInfo = function (signatures) {
return {platform: navigator.platform};
};
AttackAPI.Client.getBrowserInfo = function (signatures) {
var browser = undefined;
if (navigator.userAgent) {
browser = navigator.userAgent;
} else if (navigator.vendor) {
browser = navigator.vendor;
} else if (window.opera) {
browser = "Opera";
}
return {browser: browser};
};
AttackAPI.Client.getPluginsInfo = function () {
return navigator.plugins;
};
AttackAPI.Client.getNetworkInfo = function () {
var hostname = undefined;
var address = undefined;
try {
var sock = new java.net.Socket();
sock.bind(new java.net.InetSocketAddress('0.0.0.0', 0));
sock.connect(new java.net.InetSocketAddress(document.domain, (!document.location.port)?80:document.location.port));
hostname = sock.getLocalAddress().getHostName();
address = sock.getLocalAddress().getHostAddress();
} catch (e) {}
return {hostname: hostname, address: address};
};
AttackAPI.ExtensionScanner = {};
AttackAPI.ExtensionScanner.scan = function (callback, signatures, timeout) {
var signatures = (signatures == null)?AttackAPI.Signatures.extensions:signatures;
var timeout = (timeout == null)?100:timeout;
var checkSingleExtension = function (signature) {
var img = new Image();
img.onload = function() {
if (!img) return;
img = undefined;
callback(signature, true)
};
img.onerror = function() {
if (!img) return;
img = undefined;
callback(signature, false)
};
img.src = signature.src;
setTimeout(img.onerror, timeout);
};
for (index = 0; index < signatures.length; index++)
checkSingleExtension(signatures[index]);
};
AttackAPI.Base64Encoder = {};
AttackAPI.Base64Encoder.character_space = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
AttackAPI.Base64Encoder.encode = function(input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
do {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output + AttackAPI.Base64Encoder.character_space.charAt(enc1) + AttackAPI.Base64Encoder.character_space.charAt(enc2) + AttackAPI.Base64Encoder.character_space.charAt(enc3) + AttackAPI.Base64Encoder.character_space.charAt(enc4);
} while (i < input.length);
return output;
};
AttackAPI.Base64Encoder.decode = function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
do {
enc1 = AttackAPI.Base64Encoder.character_space.indexOf(input.charAt(i++));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -