Skip to content

Commit

Permalink
Merge pull request #935 from 409H/develop
Browse files Browse the repository at this point in the history
EAL Release v1.19
  • Loading branch information
409H authored Dec 3, 2018
2 parents 5f04a7b + cf54f7d commit 927ee71
Show file tree
Hide file tree
Showing 21 changed files with 26,737 additions and 37 deletions.
Binary file added images/antiphishing/iosiro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/antiphishing/phishfort.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/antiphishing/segasec.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/turn_off_punycode_blocker.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 14 additions & 4 deletions js/DomainBlacklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
var arrDomainParts = strCurrentTab.split(".");
arrDomainParts.forEach(strDomainPart => {
if (strDomainPart.startsWith("xn--")) {
window.location.href = "https://harrydenley.com/EtherAddressLookup/phishing.html#" + (window.location.href) + "#punycode";
window.location.href = chrome.runtime.getURL('/static/phishing/phishing.html#') + (window.location.hostname) + "#punycode";
return false;
}
});
Expand Down Expand Up @@ -71,9 +71,9 @@
}

//If it's not in the whitelist and it is blacklisted or levenshtien wants to blacklist it.
if ( arrWhitelistedDomains.indexOf(strCurrentTab) < 0 && (isBlacklisted === true || blHolisticStatus === true)) {
if (arrWhitelistedDomains.indexOf(strCurrentTab) < 0 && (isBlacklisted === true || blHolisticStatus === true)) {
console.warn(window.location.href + " is blacklisted by EAL - "+ (isBlacklisted ? "Blacklisted" : "Levenshtein Logic"));
window.location.href = "https://harrydenley.com/EtherAddressLookup/phishing.html#"+ (window.location.href) +"#"+ (isBlacklisted ? "blacklisted" : "levenshtein");
window.location.href = chrome.runtime.getURL('/static/phishing/phishing.html#') + (window.location.hostname) +"#"+ (isBlacklisted ? "blacklisted" : "levenshtein");
return false;
}
}
Expand All @@ -95,7 +95,17 @@

if(obj3rdPartyLists[str3rdPartyIdentifier].domains.indexOf(strCurrentTab) >= 0) {
console.warn(window.location.href + " is blacklisted by "+ str3rdPartyIdentifier);
window.location.href = "https://harrydenley.com/EtherAddressLookup/phishing-"+ str3rdPartyIdentifier +".html#"+ (window.location.href);
switch(str3rdPartyIdentifier) {
case 'phishfort':
window.location.href = chrome.runtime.getURL('/static/phishing/phishing-phishfort.html#') + (window.location.hostname) +"#blacklisted";
break;
case 'segasec':
window.location.href = chrome.runtime.getURL('/static/phishing/phishing-segasec.html#') + (window.location.hostname) +"#blacklisted";
break;
default:
window.location.href = chrome.runtime.getURL('/static/phishing/phishing.html#') + (window.location.hostname) +"#blacklisted";
break;
}
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/app/historyInspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function doHistoryInspection() {
var objUri = URI(objHistoryItems[intIterator].url);

//See if we redirected to the phishing site...
if (objUri.domain() === "harrydenley.com" && ["/EtherAddressLookup/phishing.html", "/EtherAddressLookup/phishing-segasec.html", "/EtherAddressLookup/phishing-iosiro.html"].indexOf(objUri.path()) >= 0) {
if (objUri.domain() === "harrydenley.com" && ["/EtherAddressLookup/phishing.html", "/EtherAddressLookup/phishing-segasec.html", "/EtherAddressLookup/phishing-phishfort.html"].indexOf(objUri.path()) >= 0) {
blRedirected = true;
continue;
}
Expand Down
130 changes: 130 additions & 0 deletions js/app/lib/blockies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// source: https://raw.githubusercontent.com/ethereum/blockies/86c3e71ec33a31424ac8dcae449ec9c09c4ab3cb/blockies.js
(function() {
// The random number is a js implementation of the Xorshift PRNG
var randseed = new Array(4); // Xorshift: [x, y, z, w] 32 bit values

function seedrand(seed) {
for (var i = 0; i < randseed.length; i++) {
randseed[i] = 0;
}
for (var i = 0; i < seed.length; i++) {
randseed[i%4] = ((randseed[i%4] << 5) - randseed[i%4]) + seed.charCodeAt(i);
}
}

function rand() {
// based on Java's String.hashCode(), expanded to 4 32bit values
var t = randseed[0] ^ (randseed[0] << 11);

randseed[0] = randseed[1];
randseed[1] = randseed[2];
randseed[2] = randseed[3];
randseed[3] = (randseed[3] ^ (randseed[3] >> 19) ^ t ^ (t >> 8));

return (randseed[3]>>>0) / ((1 << 31)>>>0);
}

function createColor() {
//saturation is the whole color spectrum
var h = Math.floor(rand() * 360);
//saturation goes from 40 to 100, it avoids greyish colors
var s = ((rand() * 60) + 40) + '%';
//lightness can be anything from 0 to 100, but probabilities are a bell curve around 50%
var l = ((rand()+rand()+rand()+rand()) * 25) + '%';

var color = 'hsl(' + h + ',' + s + ',' + l + ')';
return color;
}

function createImageData(size) {
var width = size; // Only support square icons for now
var height = size;

var dataWidth = Math.ceil(width / 2);
var mirrorWidth = width - dataWidth;

var data = [];
for(var y = 0; y < height; y++) {
var row = [];
for(var x = 0; x < dataWidth; x++) {
// this makes foreground and background color to have a 43% (1/2.3) probability
// spot color has 13% chance
row[x] = Math.floor(rand()*2.3);
}
var r = row.slice(0, mirrorWidth);
r.reverse();
row = row.concat(r);

for(var i = 0; i < row.length; i++) {
data.push(row[i]);
}
}

return data;
}

function buildOpts(opts) {
var newOpts = {};

newOpts.seed = opts.seed || Math.floor((Math.random()*Math.pow(10,16))).toString(16);

seedrand(newOpts.seed);

newOpts.size = opts.size || 8;
newOpts.scale = opts.scale || 4;
newOpts.color = opts.color || createColor();
newOpts.bgcolor = opts.bgcolor || createColor();
newOpts.spotcolor = opts.spotcolor || createColor();

return newOpts;
}

function renderIcon(opts, canvas) {
opts = buildOpts(opts || {});
var imageData = createImageData(opts.size);
var width = Math.sqrt(imageData.length);

canvas.width = canvas.height = opts.size * opts.scale;

var cc = canvas.getContext('2d');
cc.fillStyle = opts.bgcolor;
cc.fillRect(0, 0, canvas.width, canvas.height);
cc.fillStyle = opts.color;

for(var i = 0; i < imageData.length; i++) {

// if data is 0, leave the background
if(imageData[i]) {
var row = Math.floor(i / width);
var col = i % width;

// if data is 2, choose spot color, if 1 choose foreground
cc.fillStyle = (imageData[i] == 1) ? opts.color : opts.spotcolor;

cc.fillRect(col * opts.scale, row * opts.scale, opts.scale, opts.scale);
}
}
return canvas;
}

function createIcon(opts) {
var canvas = document.createElement('canvas');

renderIcon(opts, canvas);

return canvas;
}

var api = {
create: createIcon,
render: renderIcon
};

if (typeof module !== "undefined") {
module.exports = api;
}
if (typeof window !== "undefined") {
window.blockies = api;
}

})();
1 change: 0 additions & 1 deletion js/app/lib/blockies.min.js

This file was deleted.

Loading

0 comments on commit 927ee71

Please sign in to comment.