mirror of
https://github.com/pezkuwichain/phishing.git
synced 2026-04-22 04:28:01 +00:00
Nightly CI checks updates (#89)
* Nightly CI checks updates * Remove unused replace
This commit is contained in:
@@ -18,14 +18,7 @@ ${error}
|
||||
}
|
||||
}
|
||||
|
||||
function delayLoop (): Promise<void> {
|
||||
return new Promise((resolve): void => {
|
||||
setTimeout(() => resolve(), 1500);
|
||||
});
|
||||
}
|
||||
|
||||
// shared between polkadot.center & polkadot-event.com (addresses are also the same on first run)
|
||||
async function checkGetWallet (ours: Record<string, string[]>, site: string): Promise<void> {
|
||||
async function loopSome (ours: Record<string, string[]>, site: string, matcher: () => Promise<string[] | null>): Promise<void> {
|
||||
const all = Object.values(ours).reduce((all: string[], addrs: string[]): string[] => {
|
||||
all.push(...addrs);
|
||||
|
||||
@@ -33,22 +26,22 @@ async function checkGetWallet (ours: Record<string, string[]>, site: string): Pr
|
||||
}, []);
|
||||
const found: string[] = [];
|
||||
|
||||
for (let i = 0; i < 25; i++) {
|
||||
for (let i = 0; i < 20; i++) {
|
||||
try {
|
||||
const result = await (await fetch(`https://${site}/get_wallet.php`)).json() as Record<string, string>;
|
||||
const addresses = await matcher();
|
||||
|
||||
if (result && result.wallet) {
|
||||
const wallet = result.wallet.replace('\r', '');
|
||||
|
||||
if (!found.includes(wallet)) {
|
||||
found.push(wallet);
|
||||
}
|
||||
if (addresses) {
|
||||
addresses.forEach((address): void => {
|
||||
if (address && !found.includes(address)) {
|
||||
found.push(address);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
await delayLoop();
|
||||
await new Promise<boolean>((resolve) => setTimeout(() => resolve(true), Math.floor((Math.random() * 750) + 1000)));
|
||||
}
|
||||
|
||||
console.log(site, JSON.stringify(found));
|
||||
@@ -58,6 +51,29 @@ async function checkGetWallet (ours: Record<string, string[]>, site: string): Pr
|
||||
assertAndLog(missing.length === 0, `Missing entries found for ${site}: ${JSON.stringify(missing)}`);
|
||||
}
|
||||
|
||||
// shared between polkadot.center & polkadot-event.com (addresses are also the same on first run)
|
||||
async function checkGetWallet (ours: Record<string, string[]>, site: string): Promise<void> {
|
||||
await loopSome(ours, site, async (): Promise<string[] | null> => {
|
||||
const result = await (await fetch(`https://${site}/get_wallet.php`)).json() as Record<string, string>;
|
||||
|
||||
return (result && result.wallet)
|
||||
? [result.wallet.replace('\r', '').trim()]
|
||||
: null;
|
||||
});
|
||||
}
|
||||
|
||||
// shared between polkadotlive.network & polkadots.network
|
||||
async function checkTrnsctin (ours: Record<string, string[]>, site: string, url: string): Promise<void> {
|
||||
await loopSome(ours, site, async (): Promise<string[] | null> => {
|
||||
const result = await (await fetch(url)).text();
|
||||
const match = result.match(/<p id="trnsctin">(.*?)<\/p>/g);
|
||||
|
||||
return match && match.length
|
||||
? match.map((v) => v.replace(/<\/?p( id="trnsctin")?>/g, '').trim())
|
||||
: null;
|
||||
});
|
||||
}
|
||||
|
||||
describe('addrcheck', (): void => {
|
||||
let ours: Record<string, string[]>;
|
||||
|
||||
@@ -73,4 +89,23 @@ describe('addrcheck', (): void => {
|
||||
it('has all entries from polkadot-event.com', async (): Promise<void> => {
|
||||
await checkGetWallet(ours, 'polkadot-event.com');
|
||||
});
|
||||
|
||||
it('has the addresses for polkadotlive.network', async (): Promise<void> => {
|
||||
await checkTrnsctin(ours, 'polkadotlive.network', 'https://polkadotlive.network/block-assets/index.html');
|
||||
});
|
||||
|
||||
it('has the addresses for polkadots.network', async (): Promise<void> => {
|
||||
await checkTrnsctin(ours, 'polkadots.network', 'https://polkadots.network/block.html');
|
||||
});
|
||||
|
||||
it('has the addresses for dot4.org', async (): Promise<void> => {
|
||||
await loopSome(ours, 'dot4.org', async (): Promise<string[] | null> => {
|
||||
const result = await (await fetch('https://dot4.org/promo/')).text();
|
||||
const match = result.match(/<p class="payment-title">(.*?)<\/p>/g);
|
||||
|
||||
return match && match.length
|
||||
? match.map((v) => v.replace(/<\/?p( class="payment-title")?>/g, '').trim())
|
||||
: null;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user