mirror of
https://github.com/pezkuwichain/phishing.git
synced 2026-07-24 07:45:42 +00:00
Add polkastater.link (#274)
* Add polkastater.link * Use matching fo category
This commit is contained in:
@@ -113,6 +113,7 @@
|
|||||||
"polkastarter.eu.com",
|
"polkastarter.eu.com",
|
||||||
"polkastarter.fund",
|
"polkastarter.fund",
|
||||||
"polkastarter.ws",
|
"polkastarter.ws",
|
||||||
|
"polkastater.link",
|
||||||
"polkaswitch.online",
|
"polkaswitch.online",
|
||||||
"polkawallets.site",
|
"polkawallets.site",
|
||||||
"polkdot-live.network",
|
"polkdot-live.network",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { load as yamlParse } from 'js-yaml';
|
|||||||
|
|
||||||
import { fetch } from '@polkadot/x-fetch';
|
import { fetch } from '@polkadot/x-fetch';
|
||||||
|
|
||||||
import { retrieveHostList } from '.';
|
import ourSiteList from '../../../all.json';
|
||||||
|
|
||||||
interface CryptoScamEntry {
|
interface CryptoScamEntry {
|
||||||
addresses: Record<string, string[]>;
|
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 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';
|
const ETHPHISH = 'https://raw.githubusercontent.com/MetaMask/eth-phishing-detect/master/src/config.json';
|
||||||
|
|
||||||
describe('crosscheck', (): void => {
|
describe('crosscheck', (): void => {
|
||||||
let ours: string[];
|
const ours: string[] = ourSiteList.deny;
|
||||||
|
|
||||||
beforeAll(async (): Promise<void> => {
|
beforeAll((): void => {
|
||||||
jest.setTimeout(120000);
|
jest.setTimeout(120000);
|
||||||
ours = (await retrieveHostList()).deny;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has all the relevant entries from CryptoScamDb', async (): Promise<void> => {
|
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
|
// this is a hack, the text slipped in upstream
|
||||||
const scamDb = yamlParse(raw.replace('∂ç', '')) as CryptoScamEntry[];
|
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 }) =>
|
const missing = filtered.filter(({ url }) =>
|
||||||
!ours.includes(url.replace(/https:\/\/|http:\/\//, '').split('/')[0])
|
!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> => {
|
it('has polkadot/kusama entries from eth-phishing-detect', async (): Promise<void> => {
|
||||||
const ethDb = await (await fetch(ETHPHISH)).json() as EthPhishing;
|
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));
|
const missing = filtered.filter((url) => !ours.includes(url));
|
||||||
|
|
||||||
console.log('eth-phishing-detect found\n', JSON.stringify(filtered, null, 2));
|
console.log('eth-phishing-detect found\n', JSON.stringify(filtered, null, 2));
|
||||||
|
|||||||
Reference in New Issue
Block a user