Skip to content

Commit

Permalink
Merge branch 'ft-punycode'
Browse files Browse the repository at this point in the history
* ft-punycode:
  Added release notes
  Increased version number, and loaded the punycode script
  Added logic to do the punycode decode on levenshtien - I don't want weird characters in the json blacklist
  Added logic to do punycode decode so the levenshtien with myetherwallet works better with unicode characters
  Added punycode js source - thanks to https://github.com/bestiejs/punycode.js
  • Loading branch information
409H committed Sep 30, 2017
2 parents 25e087a + 9808b81 commit d6b2e80
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ a [pull request](https://github.com/409H/EtherAddressLookup/compare) with the ch

## Changelog

### v1.8

* Improved Levenshtien edit distance check for MyEtherWallet and punycode domains.

### v1.7

* Added the ability for EAL to check your browser history to see if you have been on a domain that has since been blacklisted.

### v1.6

* Added the ability to bookmark up to 6 domains with their favicon showing.

### v1.5

* Added report domain button.
Expand Down
16 changes: 11 additions & 5 deletions js/DomainBlacklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,19 @@
return;
}

//Levenshtein - @sogoiii
var strCurrentTab = strCurrentTab.replace(/www\./g,'');
var isBlacklisted = arrBlacklistedDomains.includes(strCurrentTab);
var source = strCurrentTab.replace(/\./g,'');
var intHolisticMetric = levenshtein(source, 'myetherwallet');
var intHolisticLimit = 7 // How different can the word be?
var blHolisticStatus = (intHolisticMetric > 0 && intHolisticMetric < intHolisticLimit) ? true : false;

//Only do Levenshtein if it's not blacklisted
//Levenshtein - @sogoiii
var blHolisticStatus = false;
if(isBlacklisted === false) {
var strCurrentTab = punycode.toUnicode(strCurrentTab);
var source = strCurrentTab.replace(/\./g, '');
var intHolisticMetric = levenshtein(source, 'myetherwallet');
var intHolisticLimit = 7 // How different can the word be?
blHolisticStatus = (intHolisticMetric > 0 && intHolisticMetric < intHolisticLimit) ? true : false;
}

if (isBlacklisted || blHolisticStatus ) {
window.location.href = "https://harrydenley.com/EtherAddressLookup/phishing.html#"+ (window.location.href);
Expand Down
2 changes: 2 additions & 0 deletions js/app/lib/punycode.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "EtherAddressLookup",
"short_name": "EtherAddressLookup",
"description": "Adds links to strings that look like Ethereum addresses to your favorite blockchain explorer.",
"version": "1.7.1",
"version": "1.8",

"browser_action": {
"default_icon": "images/icon.png",
Expand All @@ -23,7 +23,7 @@
"content_scripts":[{
"run_at": "document_start",
"matches": ["http://*/*", "https://*/*"],
"js": ["js/DomainBlacklist.js"]
"js": ["js/app/lib/punycode.min.js", "js/DomainBlacklist.js"]
},{
"run_at": "document_end",
"matches": ["http://*/*", "https://*/*"],
Expand Down

0 comments on commit d6b2e80

Please sign in to comment.