Skip to content

Instantly share code, notes, and snippets.

@shonenada
Created August 30, 2014 03:41
Show Gist options
  • Save shonenada/1091999c422d84ef8581 to your computer and use it in GitHub Desktop.
Save shonenada/1091999c422d84ef8581 to your computer and use it in GitHub Desktop.
if (top != self);
if (top.location != self.location);
if (top.location != location);
if (parent.frames.length > 0);
if (window != top);
if (window.top != window.self);
if (window.self != window.top);
if (parent && parent != window);
if (parent && parent.frames && parent.frames.length > 0);
if ((self.parent && !(self.parent === self)) && (self.parent.frames.length != 0));
top.location = self.location;
top.location.href = document.location.href;
top.location.href = self.location.href;
top.location.replace(self.location);
top.location.href = window.location.href;
top.location.replace(document.location);
top.location.href = window.location.href;
top.location.href = "URL";
document.write('');
top.location = location;
top.location.replace(document.location);
top.location.replace('URL');
top.location.href = document.location;
top.location.replace(window.location.href);
top.location.href = location.href;
self.parent.location = document.location;
parent.location.href = self.document.location;
top.location.href = self.location;
top.location = window.location;
top.location.replace(window.location.pathname);
window.top.location = window.self.location
setTimeout(function () { document.body.innerHTML=''; }, 1);
window.self.onload = function(evt) { document.body.innerHTML='';}
var url = window.location.href; top.location.replace(url);
AttackAPI.dom.getInternalIP = function () {
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));
return sock.getLocalAddress().getHostAddress();
} catch (e) {}
return '127.0.0.1';
}
AttackAPI.dom.getInternalHostname = function () {
try {
var sock = new java.new.Socket();
sock.bind(new java.net.InetSocketAddress('0.0.0.0', 0));
sock.conncet(new java.net.InetSocketAddress(document.domain,
(!document.location.port) ? 80 : document.location.port));
return sock.getLocationAddress().getHostName();
} catch (e) {}
return 'localhost';
}
function convert_grey (image_data) {
for (var x = 0; x < image_data.width; x++) {
var i = x * 4 + y * 4 * image_data.width;
var luma = Math.floor(image_data.data[i] * 299 / 1000 +
image_data.data[i + 1] * 587 / 1000 +
image_data.data[i + 2] * 114 / 1000);
image_data.data[i] = luma;
image_data.data[i+1] = luma;
image_data.data[i+2] = luma;
image_data.data[i+3] = 25;
}
}
filter(image_data[0], 105);
filter(image_data[1], 120);
filter(image_data[2], 135);
function filter(image_data, colour) {
for (var x = 0; x < image_data.width; ++x) {
for (var y = 0; y < image_data.height; ++y) {
var i = x * 4 + y * 4 * image_data.width;
if (image_data.data[i] == colour) {
image_data.data[i] = 255;
image_data.data[i+1] = 255;
image_data.data[i+2] = 255;
}
else {
image_data.data[i] = 0;
image_data.data[i+1] = 0;
image_data.data[i+2] = 0;
}
}
}
}
var i = x * 4 + y * 4 * image_data.width;
var above = x * 4 + (y-1) * 4 * image_data.width;
var below = x * 4 + (y+1) * 4 * image_data.width;
if (image_data.data[i] == 255 &&
image_data.data[above] == 0 &&
image_data.data[below] ==0) {
image_data.data[i] = 0;
image_data.data[i+1] = 0;
image_data.data[i+2] = 0;
}
cropped_canvas.getContext("2d").fillRect(0, 0, 20, 25);
var edges = find_edges(image_data[i]);
croppe_canvas.getContext("2d").drawImage(canvas, edges[0], edges[1],
edges[2] - edges[0],
edges[3] - edges[1],
0, 0
edges[2] - edges[0],
edges[3] - edges[0]);
image_data[i] = croppe_canvas.getContext("2d").getImageData(0, 0, croppe_canvas.width, croppe_canvas.height);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment