mirror of
https://github.com/pezkuwichain/phishing.git
synced 2026-07-22 07:55:45 +00:00
File diff suppressed because one or more lines are too long
+1
-1
@@ -10,4 +10,4 @@ plugins:
|
|||||||
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
|
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
|
||||||
spec: "@yarnpkg/plugin-version"
|
spec: "@yarnpkg/plugin-version"
|
||||||
|
|
||||||
yarnPath: .yarn/releases/yarn-2.4.0.cjs
|
yarnPath: .yarn/releases/yarn-2.4.1.cjs
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ const config = require('@polkadot/dev/config/jest.cjs');
|
|||||||
module.exports = Object.assign({}, config, {
|
module.exports = Object.assign({}, config, {
|
||||||
moduleNameMapper: {},
|
moduleNameMapper: {},
|
||||||
modulePathIgnorePatterns: [
|
modulePathIgnorePatterns: [
|
||||||
'<rootDir>/build'
|
'<rootDir>/build',
|
||||||
|
'<rootDir>/packages/phishing/build'
|
||||||
],
|
],
|
||||||
resolver: '@polkadot/dev/config/jest-resolver.cjs'
|
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/)']
|
||||||
});
|
});
|
||||||
+3
-3
@@ -7,7 +7,7 @@
|
|||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"typescript": "^4.1.5"
|
"typescript": "^4.2.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "polkadot-dev-build-ts",
|
"build": "polkadot-dev-build-ts",
|
||||||
@@ -23,12 +23,12 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.13.8",
|
"@babel/core": "^7.13.8",
|
||||||
"@polkadot/dev": "^0.61.30",
|
"@polkadot/dev": "^0.62.5",
|
||||||
"@types/jest": "^26.0.20"
|
"@types/jest": "^26.0.20"
|
||||||
},
|
},
|
||||||
"version": "0.6.2",
|
"version": "0.6.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pinata/sdk": "^1.1.12",
|
"@pinata/sdk": "^1.1.13",
|
||||||
"dnslink-cloudflare": "^3.0.0"
|
"dnslink-cloudflare": "^3.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/phishing",
|
"name": "@polkadot/phishing",
|
||||||
"version": "0.6.2",
|
"version": "0.6.2",
|
||||||
|
"type": "module",
|
||||||
"description": "Simple phishing scripts from a central source",
|
"description": "Simple phishing scripts from a central source",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
@@ -12,10 +13,10 @@
|
|||||||
"repository": "github.com:polkadot-js/phishing",
|
"repository": "github.com:polkadot-js/phishing",
|
||||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/phishing#readme",
|
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/phishing#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.13.8",
|
"@babel/runtime": "^7.13.9",
|
||||||
"@polkadot/util": "^5.9.2",
|
"@polkadot/util": "^6.0.1-5",
|
||||||
"@polkadot/util-crypto": "^5.9.2",
|
"@polkadot/util-crypto": "^6.0.1-5",
|
||||||
"@polkadot/x-fetch": "^5.9.2"
|
"@polkadot/x-fetch": "^6.0.1-5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/js-yaml": "^4.0.0",
|
"@types/js-yaml": "^4.0.0",
|
||||||
|
|||||||
@@ -3,23 +3,11 @@
|
|||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
import { fetch } from '@polkadot/x-fetch';
|
import { fetchWithTimeout } from './fetch';
|
||||||
|
|
||||||
import { retrieveAddrList } from '.';
|
import { retrieveAddrList } from '.';
|
||||||
|
|
||||||
const TICKS = '```';
|
const TICKS = '```';
|
||||||
|
|
||||||
// a timeout with a 2s timeout
|
|
||||||
async function fetchWithTimeout (url: string, timeout = 2000): Promise<Response> {
|
|
||||||
const controller = new AbortController();
|
|
||||||
const id = setTimeout(() => controller.abort(), timeout);
|
|
||||||
const response = await fetch(url, { signal: controller.signal });
|
|
||||||
|
|
||||||
clearTimeout(id);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
// loop through each site for a number of times, applying the transform
|
// loop through each site for a number of times, applying the transform
|
||||||
async function loopSome (site: string, matcher: () => Promise<string[] | null>): Promise<[string, string[]]> {
|
async function loopSome (site: string, matcher: () => Promise<string[] | null>): Promise<[string, string[]]> {
|
||||||
const found: string[] = [];
|
const found: string[] = [];
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// Copyright 2020-2021 @polkadot/phishing authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import { fetch } from '@polkadot/x-fetch';
|
||||||
|
|
||||||
|
// a fetch with a 2s timeout
|
||||||
|
export async function fetchWithTimeout (url: string, timeout = 2000): Promise<Response> {
|
||||||
|
const controller = new AbortController();
|
||||||
|
const id = setTimeout(() => controller.abort(), timeout);
|
||||||
|
const response = await fetch(url, { signal: controller.signal });
|
||||||
|
|
||||||
|
clearTimeout(id);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
@@ -5,7 +5,8 @@ import type { AddressList, HostList } from './types';
|
|||||||
|
|
||||||
import { u8aEq } from '@polkadot/util';
|
import { u8aEq } from '@polkadot/util';
|
||||||
import { decodeAddress } from '@polkadot/util-crypto';
|
import { decodeAddress } from '@polkadot/util-crypto';
|
||||||
import { fetch } from '@polkadot/x-fetch';
|
|
||||||
|
import { fetchWithTimeout } from './fetch';
|
||||||
|
|
||||||
// Equivalent to https://raw.githubusercontent.com/polkadot-js/phishing/master/{address,all}.json
|
// Equivalent to https://raw.githubusercontent.com/polkadot-js/phishing/master/{address,all}.json
|
||||||
const ADDRESS_JSON = 'https://polkadot.js.org/phishing/address.json';
|
const ADDRESS_JSON = 'https://polkadot.js.org/phishing/address.json';
|
||||||
@@ -36,7 +37,7 @@ export async function retrieveAddrList (allowCached = true): Promise<AddressList
|
|||||||
return cacheAddrList;
|
return cacheAddrList;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(ADDRESS_JSON);
|
const response = await fetchWithTimeout(ADDRESS_JSON);
|
||||||
const list = (await response.json()) as AddressList;
|
const list = (await response.json()) as AddressList;
|
||||||
|
|
||||||
cacheAddrEnd = now + CACHE_TIMEOUT;
|
cacheAddrEnd = now + CACHE_TIMEOUT;
|
||||||
@@ -71,7 +72,7 @@ export async function retrieveHostList (allowCached = true): Promise<HostList> {
|
|||||||
return cacheHostList;
|
return cacheHostList;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(ALL_JSON);
|
const response = await fetchWithTimeout(ALL_JSON);
|
||||||
const list = (await response.json()) as HostList;
|
const list = (await response.json()) as HostList;
|
||||||
|
|
||||||
cacheHostEnd = now + CACHE_TIMEOUT;
|
cacheHostEnd = now + CACHE_TIMEOUT;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
// Copyright 2017-2021 @polkadot/phishing authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
// Auto-generated by @polkadot/dev, do not edit
|
// Auto-generated by @polkadot/dev, do not edit
|
||||||
|
|||||||
Reference in New Issue
Block a user