mirror of
https://github.com/pezkuwichain/phishing.git
synced 2026-04-22 03:18:06 +00:00
List of known phishing addresses (for use in wallets) (#57)
* Add list of known addresses * Sorted * Add polkadot.express * typo * Add checkAddress & tests * Update comments * Return error * U8a cache
This commit is contained in:
+13
-3
@@ -7,14 +7,24 @@ function sortSection (values) {
|
||||
return values.sort((a, b) => a.localeCompare(b));
|
||||
}
|
||||
|
||||
const original = JSON.parse(fs.readFileSync('all.json', 'utf-8'));
|
||||
function sortAddress (values) {
|
||||
return Object
|
||||
.entries(values)
|
||||
.sort(([a], [b]) => a.localeCompare(b))
|
||||
.map(([key, addresses]) => [key, sortSection(addresses)])
|
||||
.reduce((all, [key, addresses]) => ({ ...all, [key]: addresses }), {});
|
||||
}
|
||||
|
||||
const addr = JSON.parse(fs.readFileSync('address.json', 'utf-8'));
|
||||
const all = JSON.parse(fs.readFileSync('all.json', 'utf-8'));
|
||||
const meta = JSON.parse(fs.readFileSync('urlmeta.json', 'utf-8'));
|
||||
|
||||
// sorted order for all entries
|
||||
const allow = sortSection(original.allow);
|
||||
const deny = sortSection(original.deny);
|
||||
const allow = sortSection(all.allow);
|
||||
const deny = sortSection(all.deny);
|
||||
|
||||
// rewrite with all our entries (newline included)
|
||||
fs.writeFileSync('address.json', `${JSON.stringify(sortAddress(addr), null, 2)}\n`);
|
||||
fs.writeFileSync('all.json', `${JSON.stringify({ allow, deny }, null, 2)}\n`);
|
||||
|
||||
// find out what we don't have
|
||||
|
||||
Reference in New Issue
Block a user