Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

added phishfort blacklist #2113

Merged
merged 2 commits into from
Oct 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions app/includes/background/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
localStorage.getItem("iosiro-blacklisted-domains") === null
? getDomains("iosiro")
: checkIfDataIsRecent("iosiro");
localStorage.getItem("phishfort-blacklisted-domains") === null
? getDomains("phishfort")
: checkIfDataIsRecent("phishfort");

localStorage.getItem("409h-whitelisted-domains") === null
? getDomains("409h")
Expand Down Expand Up @@ -47,6 +50,15 @@ function querycB(tabs) {
identifer: "iosiro"
};

let phishfort = {
timestamp: 0,
domains: [],
format: "plain",
repo:
"https://raw.githubusercontent.com/phishfort/phishfort-lists/master/blacklists/domains.json",
identifer: "phishfort"
};

let whitelistDef = {
timestamp: 0,
domains: [],
Expand All @@ -59,15 +71,20 @@ function querycB(tabs) {
const ealBlacklisted = localStorage.getItem("eal-blacklisted-domains")
? JSON.parse(localStorage.getItem("eal-blacklisted-domains"))
: eal;

const iosiroBlacklisted = localStorage.getItem("iosiro-blacklisted-domains")
? JSON.parse(localStorage.getItem("iosiro-blacklisted-domains"))
: iosiro;

const phishfortBlacklisted = localStorage.getItem("phishfort-blacklisted-domains")
? JSON.parse(localStorage.getItem("phishfort-blacklisted-domains"))
: phishfort;

const whitelisted = localStorage.getItem("409h-whitelisted-domains")
? JSON.parse(localStorage.getItem("409h-whitelisted-domains"))
: whitelistDef;

const allDomains = ealBlacklisted.domains.concat(iosiroBlacklisted.domains);
const allDomains = ealBlacklisted.domains.concat(iosiroBlacklisted.domains).concat(phishfortBlacklisted.domains);
let urlRedirect;
let foundWhitelist = whitelisted.domains.find(dom => {
if (tabs[0] !== undefined) {
Expand Down Expand Up @@ -128,7 +145,7 @@ function extractRootDomain(url) {

function checkIfDataIsRecent(str) {
let storedName =
str === "eal" || str === "iosiro"
str === "eal" || str === "iosiro" || str === "phishfort"
? str + "-blacklisted-domains"
: str + "-whitelisted-domains";
let dataObj = JSON.parse(localStorage.getItem(storedName));
Expand Down Expand Up @@ -158,6 +175,14 @@ function getDomains(str) {
repo:
"https://raw.githubusercontent.com/iosiro/counter_phishing_blacklist/master/blacklists/domains.json",
identifer: "iosiro"
},
phishfort: {
timestamp: 0,
domains: [],
format: "plain",
repo:
"https://raw.githubusercontent.com/phishfort/phishfort-lists/master/blacklists/domains.json",
identifer: "phishfort"
}
};

Expand All @@ -174,10 +199,10 @@ function getDomains(str) {

let newName;

if (str && str !== "" && (str === "eal" || str === "iosiro")) {
if (str && str !== "" && (str === "eal" || str === "iosiro" || str == "phishfort")) {
newName = str + "-blacklisted-domains";
setInStorage(blackListDomains[str], newName);
} else if (str && str !== "" && (str !== "eal" || str !== "iosiro")) {
} else if (str && str !== "" && (str !== "eal" || str !== "iosiro" || str != "phishfort")) {
newName = str + "-whitelisted-domains";
setInStorage(whiteListDomains[str], newName);
} else {
Expand Down
2 changes: 2 additions & 0 deletions app/includes/header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
or
<a href="https://myetherwallet.github.io/knowledge-base/migration/moving-from-private-key-to-metamask.html" target="_blank" rel="noopener noreferrer">MetaMask</a>
or
<a href="https://chrome.google.com/webstore/detail/phishfort-protect/bdiohckpogchppdldbckcdjlklanhkfc" target="_blank" rel="noopener noreferrer">PhishFort</a>
or
<a href="https://chrome.google.com/webstore/detail/cryptonite-by-metacert/keghdcpemohlojlglbiegihkljkgnige" target="_blank" rel="noopener noreferrer">Cryptonite</a>
</span>
</div>
Expand Down
31 changes: 27 additions & 4 deletions chrome-extension/background/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
localStorage.getItem("iosiro-blacklisted-domains") === null
? getDomains("iosiro")
: checkIfDataIsRecent("iosiro");
localStorage.getItem("phishfort-blacklisted-domains") === null
? getDomains("phishfort")
: checkIfDataIsRecent("phishfort");

localStorage.getItem("409h-whitelisted-domains") === null
? getDomains("409h")
Expand Down Expand Up @@ -47,6 +50,15 @@ function querycB(tabs) {
identifer: "iosiro"
};

let phishfort = {
timestamp: 0,
domains: [],
format: "plain",
repo:
"https://raw.githubusercontent.com/phishfort/phishfort-lists/master/blacklists/domains.json",
identifer: "phishfort"
};

let whitelistDef = {
timestamp: 0,
domains: [],
Expand All @@ -62,12 +74,15 @@ function querycB(tabs) {
const iosiroBlacklisted = localStorage.getItem("iosiro-blacklisted-domains")
? JSON.parse(localStorage.getItem("iosiro-blacklisted-domains"))
: iosiro;
const phishfortBlacklisted = localStorage.getItem("phishfort-blacklisted-domains")
? JSON.parse(localStorage.getItem("phishfort-blacklisted-domains"))
: phishfort;

const whitelisted = localStorage.getItem("409h-whitelisted-domains")
? JSON.parse(localStorage.getItem("409h-whitelisted-domains"))
: whitelistDef;

const allDomains = ealBlacklisted.domains.concat(iosiroBlacklisted.domains);
const allDomains = ealBlacklisted.domains.concat(iosiroBlacklisted.domains).concat(phishfortBlacklisted.domains);
let urlRedirect;
let foundWhitelist = whitelisted.domains.find(dom => {
if (tabs[0] !== undefined) {
Expand Down Expand Up @@ -128,7 +143,7 @@ function extractRootDomain(url) {

function checkIfDataIsRecent(str) {
let storedName =
str === "eal" || str === "iosiro"
str === "eal" || str === "iosiro" || str === "phishfort"
? str + "-blacklisted-domains"
: str + "-whitelisted-domains";
let dataObj = JSON.parse(localStorage.getItem(storedName));
Expand Down Expand Up @@ -158,6 +173,14 @@ function getDomains(str) {
repo:
"https://raw.githubusercontent.com/iosiro/counter_phishing_blacklist/master/blacklists/domains.json",
identifer: "iosiro"
},
phishfort: {
timestamp: 0,
domains: [],
format: "plain",
repo:
"https://raw.githubusercontent.com/phishfort/phishfort-lists/master/blacklists/domains.json",
identifer: "phishfort"
}
};

Expand All @@ -174,10 +197,10 @@ function getDomains(str) {

let newName;

if (str && str !== "" && (str === "eal" || str === "iosiro")) {
if (str && str !== "" && (str === "eal" || str === "iosiro" || str === "phishfort")) {
newName = str + "-blacklisted-domains";
setInStorage(blackListDomains[str], newName);
} else if (str && str !== "" && (str !== "eal" || str !== "iosiro")) {
} else if (str && str !== "" && (str !== "eal" || str !== "iosiro" || str !== "phishfort")) {
newName = str + "-whitelisted-domains";
setInStorage(whiteListDomains[str], newName);
} else {
Expand Down
2 changes: 2 additions & 0 deletions chrome-extension/phishing.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
or
<a href="https://myetherwallet.github.io/knowledge-base/migration/moving-from-private-key-to-metamask.html" target="_blank" rel="noopener noreferrer">MetaMask</a>
or
<a href="https://chrome.google.com/webstore/detail/phishfort-protect/bdiohckpogchppdldbckcdjlklanhkfc" target="_blank" rel="noopener noreferrer">PhishFort</a>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tehnlulz do you mind moving this change to app/includes/header.tpl; You're changing the compiled version. It would get replaced when we compile for release.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Sorry about that and thanks for the catch. Will move over now.

or
<a href="https://chrome.google.com/webstore/detail/cryptonite-by-metacert/keghdcpemohlojlglbiegihkljkgnige" target="_blank" rel="noopener noreferrer">Cryptonite</a>
</span>
</div>
Expand Down