Extract IPv4 Address from ipaddress.com

This is a tool to extract IPv4 Address from ipaddress.com

目前为 2022-12-27 提交的版本。查看 最新版本

// ==UserScript==
// @name         Extract IPv4 Address from ipaddress.com
// @namespace    https://freysu.github.io/
// @version      0.1
// @description  This is a tool to extract IPv4 Address from ipaddress.com
// @author       FreySu
// @match        *://*.ipaddress.com/site/*
// @icon         https://icons.duckduckgo.com/ip2/ipaddress.com.ico
// @license      MIT
// @grant        GM_setClipboard
// @grant        GM_registerMenuCommand
// @grant        GM_unregisterMenuCommand
// @run-at       document-body
// ==/UserScript==

;(function () {
  'use strict'
  GM_registerMenuCommand('Extract All address to the clipboard', function () {
    main()
  })
  function main() {
    var domainUrl = ''
    var firstSearchNodeArr = document.querySelectorAll('.box table tbody th')
    for (let i of firstSearchNodeArr) {
      if (i.innerText === 'Domain') {
        domainUrl = i.nextElementSibling.innerText
        break
      }
    }
    if(!domainUrl.length){
        domainUrl = new URL(location.href).pathname.split("/")[2]
    }
    var text = ''
    for (let i of document.querySelector('.map-container .comma-separated')
      .childNodes) {
      text += `${i.innerText} ${domainUrl}\n`
    }
    try {
      text.length && GM_setClipboard(text.substring(0,text.length-1))
      text.length && alert(`All IP address are copied to the clipboard.\nResult:\n---\n${text.substring(0,text.length-1)}\n---`)
    } catch (e) {
      console.error(e.message)
      return alert('Sorry! I encountered a problem! Please manually copy!')
    }
  }
})()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址