Add polkastater.link (#274)

* Add polkastater.link

* Use matching fo category
This commit is contained in:
Jaco
2021-04-21 14:25:31 +03:00
committed by GitHub
parent 1afa5808fa
commit f9038fb496
2 changed files with 12 additions and 6 deletions
+1
View File
@@ -113,6 +113,7 @@
"polkastarter.eu.com",
"polkastarter.fund",
"polkastarter.ws",
"polkastater.link",
"polkaswitch.online",
"polkawallets.site",
"polkdot-live.network",
+11 -6
View File
@@ -6,7 +6,7 @@ import { load as yamlParse } from 'js-yaml';
import { fetch } from '@polkadot/x-fetch';
import { retrieveHostList } from '.';
import ourSiteList from '../../../all.json';
interface CryptoScamEntry {
addresses: Record<string, string[]>;
@@ -39,15 +39,20 @@ ${TICKS}
}
}
function matchName (_url: string): boolean {
const url = (_url || '').toLowerCase();
return !!url && (url.includes('polka') || url.includes('kusa'));
}
const CRYPTODB = 'https://raw.githubusercontent.com/CryptoScamDB/blacklist/master/data/urls.yaml';
const ETHPHISH = 'https://raw.githubusercontent.com/MetaMask/eth-phishing-detect/master/src/config.json';
describe('crosscheck', (): void => {
let ours: string[];
const ours: string[] = ourSiteList.deny;
beforeAll(async (): Promise<void> => {
beforeAll((): void => {
jest.setTimeout(120000);
ours = (await retrieveHostList()).deny;
});
it('has all the relevant entries from CryptoScamDb', async (): Promise<void> => {
@@ -55,7 +60,7 @@ describe('crosscheck', (): void => {
// this is a hack, the text slipped in upstream
const scamDb = yamlParse(raw.replace('∂ç', '')) as CryptoScamEntry[];
const filtered = scamDb.filter(({ subcategory }) => subcategory === 'Polkadot');
const filtered = scamDb.filter(({ name, subcategory }) => matchName(subcategory) || matchName(name));
const missing = filtered.filter(({ url }) =>
!ours.includes(url.replace(/https:\/\/|http:\/\//, '').split('/')[0])
);
@@ -68,7 +73,7 @@ describe('crosscheck', (): void => {
it('has polkadot/kusama entries from eth-phishing-detect', async (): Promise<void> => {
const ethDb = await (await fetch(ETHPHISH)).json() as EthPhishing;
const filtered = ethDb.blacklist.filter((url) => url.includes('polkadot') || url.includes('kusama'));
const filtered = ethDb.blacklist.filter((url) => matchName(url));
const missing = filtered.filter((url) => !ours.includes(url));
console.log('eth-phishing-detect found\n', JSON.stringify(filtered, null, 2));