aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/is-phish.js
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-08-05 02:45:22 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-08-05 02:45:22 +0800
commit89a4fef1e4043323c89bf8aea8600a16353c4d1b (patch)
tree2305525899aa31dd80c3d6bfcfadb6de4cfda783 /app/scripts/lib/is-phish.js
parentfa3df576bcf879904b303c4ed1015d27db64642d (diff)
parentc4cb371ce8ddad10d575b4ddb6cb85fe4689ca59 (diff)
downloadtangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.tar
tangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.tar.gz
tangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.tar.bz2
tangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.tar.lz
tangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.tar.xz
tangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.tar.zst
tangerine-wallet-browser-89a4fef1e4043323c89bf8aea8600a16353c4d1b.zip
Merge branch 'master' into transactionControllerRefractor
Diffstat (limited to 'app/scripts/lib/is-phish.js')
-rw-r--r--app/scripts/lib/is-phish.js38
1 files changed, 0 insertions, 38 deletions
diff --git a/app/scripts/lib/is-phish.js b/app/scripts/lib/is-phish.js
deleted file mode 100644
index 68c09e4ac..000000000
--- a/app/scripts/lib/is-phish.js
+++ /dev/null
@@ -1,38 +0,0 @@
-const levenshtein = require('fast-levenshtein')
-const blacklistedMetaMaskDomains = ['metamask.com']
-let blacklistedDomains = require('etheraddresslookup/blacklists/domains.json').concat(blacklistedMetaMaskDomains)
-const whitelistedMetaMaskDomains = ['metamask.io', 'www.metamask.io']
-const whitelistedDomains = require('etheraddresslookup/whitelists/domains.json').concat(whitelistedMetaMaskDomains)
-const LEVENSHTEIN_TOLERANCE = 4
-const LEVENSHTEIN_CHECKS = ['myetherwallet', 'myetheroll', 'ledgerwallet', 'metamask']
-
-
-// credit to @sogoiii and @409H for their help!
-// Return a boolean on whether or not a phish is detected.
-function isPhish({ hostname, updatedBlacklist = null }) {
- var strCurrentTab = hostname
-
- // check if the domain is part of the whitelist.
- if (whitelistedDomains && whitelistedDomains.includes(strCurrentTab)) { return false }
-
- // Allow updating of blacklist:
- if (updatedBlacklist) {
- blacklistedDomains = blacklistedDomains.concat(updatedBlacklist)
- }
-
- // check if the domain is part of the blacklist.
- const isBlacklisted = blacklistedDomains && blacklistedDomains.includes(strCurrentTab)
-
- // check for similar values.
- let levenshteinMatched = false
- var levenshteinForm = strCurrentTab.replace(/\./g, '')
- LEVENSHTEIN_CHECKS.forEach((element) => {
- if (levenshtein.get(element, levenshteinForm) <= LEVENSHTEIN_TOLERANCE) {
- levenshteinMatched = true
- }
- })
-
- return isBlacklisted || levenshteinMatched
-}
-
-module.exports = isPhish