Last active
April 22, 2021 15:54
-
-
Save Xvezda/8f1bd408d8f419d20b3d878c6b222150 to your computer and use it in GitHub Desktop.
통신사 IP의 준말로 '"통피"'라고 부르기도 한다. - https://namu.wiki/w/%ED%86%B5%EC%8B%A0%EC%82%AC%20IP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function iterateIPRange(start, end) { | |
const prefix = start.split('.')[0] | |
console.assert(prefix === end.split('.')[0]) | |
const from = start.split('.')[1] | |
const to = end.split('.')[1] | |
const results = [] | |
for (let i = from; i <= to; ++i) { | |
results.push([prefix, i].join('.')) | |
} | |
return results | |
} | |
let pool = new Set() | |
Array.prototype.slice | |
.call(document | |
.querySelector('table') | |
.querySelectorAll('tr') | |
) | |
.map(tr => Array.prototype.map | |
.call(tr.querySelectorAll('td,th'), cell => { | |
const text = cell.innerText | |
const alt = cell.querySelector('*[alt],*[title]') | |
if (text.trim() === '' && alt) { | |
return alt.getAttribute('alt') || alt.getAttribute('title') | |
} else { | |
return text | |
} | |
}) | |
) | |
.slice(1).map((row, i) => { | |
const head = row[0] | |
const addrs = row.slice(1).map((cell, j) => { | |
const matched = cell.match(/\d{1,3}\.\d{1,3}\s\~\s\d{1,3}\.\d{1,3}|\d{1,3}\.\d{1,3}/g) | |
const results = [] | |
matched.forEach(match => { | |
console.log(match) | |
if (match.includes('~')) { | |
Array.prototype.push | |
.apply(results, iterateIPRange(...match.split('~').map(x => x.trim()))) | |
} else { | |
results.push(match) | |
} | |
}) | |
return results | |
}) | |
return addrs.reduce((acc, addr, j) => { | |
if (acc[head] === undefined) { | |
acc[head] = [] | |
} | |
Array.prototype.push.apply(acc[head], addr.map(a => ({name: titles[j][0], value: a}))) | |
return acc | |
}, {}) | |
}) | |
.reduce((acc, speed, i) => { | |
const key = Object.keys(speed)[0] | |
const filtered = Object.values(speed)[0].filter((v, j) => { | |
return !pool.has(v.value) && pool.add(v.value) | |
}) | |
return Array.prototype.concat | |
.apply(acc, filtered.map(({name, value}) => `${value}-${name}[${key}]`)) | |
}, []) | |
.sort() | |
.join('\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106.101-LG[5G] | |
106.102-LG[LTE] | |
110.70-KT[3G] | |
117.111-LG[LTE] | |
118.235-KT[LTE] | |
175.223-KT[3G] | |
203.226-SK[3G] | |
211.234-SK[3G] | |
211.246-KT[3G] | |
211.36-LG[LTE] | |
223.32-SK[LTE] | |
223.33-SK[LTE] | |
223.34-SK[LTE] | |
223.35-SK[LTE] | |
223.36-SK[LTE] | |
223.37-SK[LTE] | |
223.38-SK[LTE] | |
223.39-SK[LTE] | |
223.40-SK[LTE] | |
223.41-SK[LTE] | |
223.42-SK[LTE] | |
223.43-SK[LTE] | |
223.44-SK[LTE] | |
223.45-SK[LTE] | |
223.46-SK[LTE] | |
223.47-SK[LTE] | |
223.48-SK[LTE] | |
223.49-SK[LTE] | |
223.50-SK[LTE] | |
223.51-SK[LTE] | |
223.52-SK[LTE] | |
223.53-SK[LTE] | |
223.54-SK[LTE] | |
223.55-SK[LTE] | |
223.56-SK[LTE] | |
223.57-SK[LTE] | |
223.58-SK[LTE] | |
223.59-SK[LTE] | |
223.60-SK[LTE] | |
223.61-SK[LTE] | |
223.62-SK[LTE] | |
223.63-SK[LTE] | |
27.160-SK[LTE] | |
27.161-SK[LTE] | |
27.162-SK[LTE] | |
27.163-SK[LTE] | |
27.164-SK[LTE] | |
27.165-SK[LTE] | |
27.166-SK[LTE] | |
27.167-SK[LTE] | |
27.168-SK[LTE] | |
27.169-SK[LTE] | |
27.170-SK[LTE] | |
27.171-SK[LTE] | |
27.172-SK[LTE] | |
27.173-SK[LTE] | |
27.174-SK[LTE] | |
27.175-SK[LTE] | |
27.176-SK[LTE] | |
27.177-SK[LTE] | |
27.178-SK[LTE] | |
27.179-SK[LTE] | |
27.180-SK[LTE] | |
27.181-SK[LTE] | |
27.182-SK[LTE] | |
27.183-SK[LTE] | |
39.7-KT[3G] | |
61.43-LG[3G] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Android: Select -> Share -> Copy