parent
87cb5f0c67
commit
dde5a337f6
8 changed files with 171888 additions and 7 deletions
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,18 @@ |
||||
import { readFileSync, writeFileSync } from 'fs'; |
||||
|
||||
const data = readFileSync('./asn.map', { encoding: 'utf8', flag: 'r' }); |
||||
const lines = data.split('\n'); |
||||
const asnMap = lines.reduce((acc, line) => { |
||||
const split = line.split(','); |
||||
const asn = split.shift(); |
||||
let name = split.join(','); |
||||
if (name.startsWith('"')) { |
||||
name = name |
||||
.substring(1, name.length-1) |
||||
.replaceAll('""', '"'); |
||||
} |
||||
acc[asn] = name; |
||||
return acc; |
||||
}, {}); |
||||
|
||||
writeFileSync('./asn.json', JSON.stringify(asnMap, null, '\t')); |
@ -0,0 +1,5 @@ |
||||
#!/bin.bash |
||||
wget -O asn-ipv4.csv https://cdn.jsdelivr.net/npm/@ip-location-db/asn/asn-ipv4.csv |
||||
wget -O asn-ipv6.csv https://cdn.jsdelivr.net/npm/@ip-location-db/asn/asn-ipv6.csv |
||||
cat asn-ipv* | cut -d ',' -f 3- | sort | uniq > asn.map |
||||
rm *.csv |
Loading…
Reference in new issue