{"id":1164,"date":"2022-09-11T17:44:00","date_gmt":"2022-09-11T09:44:00","guid":{"rendered":"https:\/\/www.behindgfw.com\/archives\/?p=1164"},"modified":"2022-09-13T13:25:17","modified_gmt":"2022-09-13T05:25:17","slug":"one-click-query-of-server-location","status":"publish","type":"post","link":"https:\/\/www.behindgfw.com\/archives\/2022\/09\/one-click-query-of-server-location.html","title":{"rendered":"\u4e00\u952e\u67e5\u8be2\u670d\u52a1\u5668\u5730\u7406\u4f4d\u7f6e"},"content":{"rendered":"<p>\u5728\u6d4f\u89c8\u7f51\u7ad9\u65f6\uff0c\u7ecf\u5e38\u4f1a\u6709\u770b\u4e00\u4e0b\u7f51\u7ad9\u670d\u52a1\u5668\u653e\u5728\u5730\u7403\u90a3\u4e2a\u89d2\u843d\u7684\u9700\u6c42\uff0c\u518d\u987a\u4fbf\u770b\u4e00\u4e0bwhois\u4fe1\u606f&#8230;\u5f53\u7136\u4f60\u53ef\u4ee5\u767b\u5f55\u4e00\u4e9b\u4e13\u95e8\u7684whois\u7b49\u5de5\u5177\u7c7b\u7f51\u7ad9\u8fdb\u884c\u67e5\u8be2\uff0c\u8fd9\u91cc\u4ecb\u7ecd\u4e00\u4e2a\u7b80\u4fbf\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u5176\u5b9e\u6d4f\u89c8\u5668\u5730\u5740\u680f\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884cjavascript\uff0c\u628a\u8fd9\u4e9bjs\u4ee3\u7801\u4fdd\u5b58\u4e3a\u4e66\u7b7e\uff0c\u5c31\u53ef\u4ee5\u8fbe\u5230\u4e0a\u8ff0\u8981\u6c42\u3002<\/p>\n<p>\u76f4\u63a5\u4e0a\u4ee3\u7801<\/p>\n<blockquote><p>javascript:<br \/>\nurl=&#8217;https:\/\/223.5.5.5\/resolve?name=&#8217;+top.location.hostname+&#8217;&amp;type=A&amp;short=1&#8242;;<br \/>\nconsole.log(url);<br \/>\nfetch(url)<br \/>\n.then(response=&gt;response.json())<br \/>\n.then(json=&gt;{<br \/>\nconsole.log(json);<br \/>\nconsole.log(&#8216;json.length=&#8217;+json.length);<br \/>\nfor(var i=0;i&lt;json.length;i++)<br \/>\n{<br \/>\nwindow.open(&#8216;https:\/\/db-ip.com\/&#8217;+json[i],&#8217;_blank&#8217;)<br \/>\n}<br \/>\n}<br \/>\n)<br \/>\n.catch(err=&gt;console.log(&#8216;Request Failed&#8217;,err));<\/p><\/blockquote>\n<p>\u89e3\u91ca\u4e00\u4e0b,\u9996\u5148top.location.hostname\u83b7\u53d6\u57df\u540d\uff0c\u901a\u8fc7\u963f\u91cc\u7684\u516c\u5171DNS API\uff08<code>'https:\/\/223.5.5.5\/resolve?name='+top.location.hostname+'&amp;type=A&amp;short=1'<\/code>\uff09\u67e5\u8be2\u57df\u540d\u5bf9\u5e94ip\u5730\u5740\uff0c\u4e3a\u4ec0\u4e48\u901a\u8fc7\u7b2c\u4e09\u65b9\u670d\u52a1\u5462\uff1f\u56e0\u4e3ajs\u662f\u76f4\u63a5\u83b7\u53d6\u4e0d\u4e86\u670d\u52a1\u5668ip\u7684\uff0cAPI\u8fd4\u56de\u4e00\u4e2aip\u5730\u5740json\u6570\u7ec4\uff0c\u5206\u522b\u53d6\u51fa\u5728db-ip.com\u8fdb\u884c\u67e5\u8be2\u3002\u5c06\u4e0b\u9762\u7684\u4ee3\u7801\u4fdd\u5b58\u4e3a\u4e66\u7b7e\u5730\u5740\u70b9\u51fb\u8bd5\u4e00\u4e0b\u3002<\/p>\n<blockquote><p>javascript:url=&#8217;https:\/\/223.5.5.5\/resolve?name=&#8217;+top.location.hostname+&#8217;&amp;type=A&amp;short=1&#8242;;console.log(url);fetch(url) .then(response=&gt;response.json()) .then(json=&gt;{console.log(json);console.log(&#8216;json.length=&#8217;+json.length);for(var i=0;i&lt;json.length;i++){window.open(&#8216;https:\/\/db-ip.com\/&#8217;+json[i],&#8217;_blank&#8217;)}}) .catch(err=&gt;console.log(&#8216;Request Failed&#8217;,err));<\/p><\/blockquote>\n<p>\u6ce8\u610f\uff1a1\u3001\u5982\u679c\u670d\u52a1\u5668\u5bf9\u5e94\u591a\u4e2aip\u5730\u5740\uff0c\u4f60\u9700\u8981\u5173\u95ed\u6d4f\u89c8\u5668\u7684\u9632\u5f39\u51fa\u7a97\u53e3\uff0c\u5426\u5219\u9ed8\u8ba4\u67e5\u8be2\u7b2c\u4e00\u4e2a\u3002<\/p>\n<p>2\u3001\u4ee3\u7801\u91cc\u52a0\u4e86\u4e00\u4e9b\u63a7\u5236\u53f0\u8f93\u51fa\uff0c\u4f60\u4e5f\u53ef\u4ee5\u5220\u9664\u6389\u3002<\/p>\n<p>3\u3001\u5fc5\u987b\u4ee5&#8221;javascript:&#8221;\u5f00\u5934\uff0c\u4e0a\u8ff0\u4ee3\u7801\u4fdd\u5b58\u65f6\u9700\u5199\u5728\u4e00\u884c\u91cc\uff0c\u8fd9\u91cc\u662f\u4e3a\u4e86\u6d4f\u89c8\u65b9\u4fbf\u3002<\/p>\n<p>\u5176\u4ed6\uff0c\u6bd4\u5982\u76f4\u63a5\u67e5\u8be2\u7f51\u7ad9whois\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<p><code>javascript:window.open('http:\/\/whois.chinaz.com\/?DomainName='+top.location.hostname,'_blank');<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u6d4f\u89c8\u7f51\u7ad9\u65f6\uff0c\u7ecf\u5e38\u4f1a\u6709\u770b\u4e00\u4e0b\u7f51\u7ad9\u670d\u52a1\u5668\u653e\u5728\u5730\u7403\u90a3\u4e2a\u89d2\u843d\u7684\u9700\u6c42\uff0c\u518d\u987a\u4fbf\u770b\u4e00\u4e0bwhois\u4fe1\u606f&#8230;\u5f53\u7136\u4f60\u53ef [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[21],"class_list":["post-1164","post","type-post","status-publish","format-standard","hentry","category-blog","tag-javascript"],"_links":{"self":[{"href":"https:\/\/www.behindgfw.com\/archives\/wp-json\/wp\/v2\/posts\/1164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.behindgfw.com\/archives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.behindgfw.com\/archives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.behindgfw.com\/archives\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.behindgfw.com\/archives\/wp-json\/wp\/v2\/comments?post=1164"}],"version-history":[{"count":11,"href":"https:\/\/www.behindgfw.com\/archives\/wp-json\/wp\/v2\/posts\/1164\/revisions"}],"predecessor-version":[{"id":1178,"href":"https:\/\/www.behindgfw.com\/archives\/wp-json\/wp\/v2\/posts\/1164\/revisions\/1178"}],"wp:attachment":[{"href":"https:\/\/www.behindgfw.com\/archives\/wp-json\/wp\/v2\/media?parent=1164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.behindgfw.com\/archives\/wp-json\/wp\/v2\/categories?post=1164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.behindgfw.com\/archives\/wp-json\/wp\/v2\/tags?post=1164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}