﻿{"id":1122,"date":"2022-10-13T17:49:49","date_gmt":"2022-10-13T09:49:49","guid":{"rendered":"https:\/\/byy3.com\/?p=1122"},"modified":"2022-10-13T18:08:35","modified_gmt":"2022-10-13T10:08:35","slug":"%e9%80%9a%e8%bf%87%e7%88%ac%e8%99%ab%e8%8e%b7%e5%8f%96%e5%85%8d%e8%b4%b9ip%e4%bb%a3%e7%90%86%ef%bc%8c%e6%90%ad%e5%bb%ba%e8%87%aa%e5%b7%b1%e7%9a%84ip%e6%b1%a0%ef%bc%88https%ef%bc%89","status":"publish","type":"post","link":"https:\/\/byy3.com\/?p=1122","title":{"rendered":"\u901a\u8fc7\u722c\u866b\u83b7\u53d6\u514d\u8d39IP\u4ee3\u7406\uff0c\u642d\u5efa\u81ea\u5df1\u7684IP\u6c60\uff08https\uff09"},"content":{"rendered":"<p>\u524d\u8a00<br \/>\n\u5e38\u89c1\u7684\u53cd\u722c\u866b\u63aa\u65bd\u4e4b\u4e00\uff0c\u5c31\u662f\u67e5\u770b\u7528\u6237\u53d1\u8d77\u8bf7\u6c42\u7684IP\u5730\u5740\uff0c\u82e5\u5f88\u9891\u7e41\uff0c\u5219\u5c01IP\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u52a8\u6001\u4ee3\u7406IP\u6c60\u5b9e\u73b0\u53cd\u722c\u866b\u3002\u767e\u5ea6\u641c\u7d22\uff1a\u722c\u866bIP\u6c60\uff0c \u5c31\u6709\u5f88\u591a\u7f51\u7ad9\uff0c\u8fd9\u4e9b\u7f51\u7ad9\u4e00\u822c\u90fd\u6709\u63d0\u4f9b\u514d\u8d39\u7684\u4ee3\u7406IP\u3002\u4f46\u662f\u8fd9\u4e9bIP\u8d28\u91cf\u4e0d\u9ad8\uff0c\u9700\u8981\u81ea\u5df1\u624b\u52a8\u590d\u5236\u7c98\u8d34\uff0c\u6d4b\u8bd5\u540e\u518d\u4f7f\u7528\uff0c\u6548\u7387\u5e95\u4e0b\u3002\u6211\u4eec\u53ef\u4ee5\u5199\u4e2a\u722c\u866b\uff0c\u6279\u91cf\u83b7\u53d6\u514d\u8d39IP\uff0c\u81ea\u52a8\u6d4b\u8bd5\u540e\uff0c\u518d\u4f7f\u7528\u3002<\/p>\n<p>\u672c\u7bc7\u6587\u7ae0\u4f7f\u7528\u7684\u76ee\u6807\u7f51\u5740\u4e3a\uff1aproxy list\u3002\u672c\u6559\u7a0b\u4e2d\u4e0d\u89e3\u6790\u9875\u9762\uff0c\u800c\u662f\u76f4\u63a5\u83b7\u53d6json\u683c\u5f0f\u3002\u56e0\u4e3aHTTP\u8f83\u5c11\uff0c\u6240\u4ee5\u672c\u6587\u7ae0\u53ea\u83b7\u53d6\u5176\u4e2dHTTPS\u7c7b\u578b\u7684IP\u5730\u5740\u3002\u4f7f\u7528\u7684\u68c0\u67e5IP\u7684\u7f51\u5740\u4e3a\uff1ahttps:\/\/icanhazip.com\/<\/p>\n<p>\u8bfb\u8005\u53ef\u4ee5\u76f4\u63a5\u590d\u5236\u6240\u6709\u4ee3\u7801\uff0c\u65b0\u5efapy\u6587\u4ef6\u540e\uff0c\u7c98\u8d34\u8fd0\u884c\u5373\u53ef\u30022021.4.5\u4eb2\u6d4b\u6709\u6548<\/p>\n<p>\u6b64\u6559\u7a0b\u4e3a\u83b7\u53d6https\u7684\uff0c\u83b7\u53d6http\u7684\u6559\u7a0b\u4e3a\uff1a\u901a\u8fc7\u722c\u866b\u83b7\u53d6\u514d\u8d39IP\u4ee3\u7406\uff0c\u642d\u5efa\u81ea\u5df1\u7684IP\u6c60\uff08http\uff09<\/p>\n<p>\u7b80\u4ecb<br \/>\n\u4f20\u5165URL\u5730\u5740\uff0c\u8fd4\u56de\u53ef\u7528\u7684IP\u5730\u5740list\u5217\u8868<\/p>\n<p>__init __ :\u8bbe\u7f6e\u8bf7\u6c42\u5934\uff0c\u8bf7\u6c42\u5730\u5740\uff08\u76f4\u63a5\u662fjson\u683c\u5f0f\uff09<br \/>\ncheck_ip : \u68c0\u67e5IP\u5730\u5740\u662f\u5426\u53ef\u7528\uff0c\u8fd4\u56de\u53ef\u7528\u7684\u5f53\u524d\u9875\u9762\u4e0a\u7684IP\u5730\u5740list\u548c\u7aef\u53e3\u53f7<br \/>\nrun: \u7a0b\u5e8f\u4e3b\u4ee3\u7801<br \/>\n\u4ee3\u7801<br \/>\nimport requests<br \/>\nimport json<\/p>\n<p>class FreeIP():<br \/>\ndef __init__(self):<br \/>\nself.url = \"http:\/\/proxylist.fatezero.org\/proxy.list\"<br \/>\nself.headers = {\"User-Agent\": \"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/84.0.4147.89 Safari\/537.36\"}<\/p>\n<p>def check_ip(self, ip_list):<br \/>\ncorrect_ip = []<br \/>\nfor ip in ip_list:<br \/>\nif len(correct_ip) &gt; 10: # \u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u8fdb\u884c\u66f4\u6539\u6216\u8005\u6ce8\u91ca\u6389<br \/>\nbreak<br \/>\nip_port = \"{}:{}\".format(ip[\"host\"],ip[\"port\"])<br \/>\nproxies = {'https': ip_port}<br \/>\ntry:<br \/>\nresponse = requests.get('https:\/\/icanhazip.com\/', proxies=proxies,<br \/>\ntimeout=3).text # \u5982\u679c\u8bf7\u6c42\u8be5\u7f51\u5740\uff0c\u8fd4\u56de\u7684IP\u5730\u5740\u4e0e\u4ee3\u7406IP\u4e00\u81f4\uff0c\u5219\u8ba4\u4e3a\u4ee3\u7406\u6210\u529f<br \/>\n# \u53ef\u4ee5\u66f4\u6539timeout\u65f6\u95f4<br \/>\nif response.strip() == ip[\"host\"]:<br \/>\nprint(\"\u53ef\u7528\u7684IP\u5730\u5740\u4e3a\uff1a{}\".format(ip_port))<br \/>\ncorrect_ip.append(ip_port)<br \/>\nexcept:<br \/>\nprint(\"\u4e0d\u53ef\u7528\u7684IP\u5730\u5740\u4e3a\uff1a{}\".format(ip_port))<br \/>\nreturn correct_ip<\/p>\n<p>def run(self):<br \/>\nresponse = requests.get(url=self.url).content.decode()<\/p>\n<p>ip_list = []<br \/>\nproxies_list = response.split('\\n')<\/p>\n<p>for proxy_str in proxies_list:<br \/>\ntry:<br \/>\nproxy = {}<br \/>\nproxy_json = json.loads(proxy_str)<br \/>\nif proxy_json[\"anonymity\"] == \"high_anonymous\" and proxy_json[\"type\"] == \"https\":<br \/>\nhost = proxy_json['host']<br \/>\nport = proxy_json['port']<br \/>\nproxy[\"host\"] = host<br \/>\nproxy[\"port\"] = port<br \/>\nip_list.append(proxy)<br \/>\nprint(\"{}\u7b26\u5408https\u548c\u9ad8\u533f\u6761\u4ef6\".format(host))<br \/>\nexcept:<br \/>\nprint(proxy_str)<\/p>\n<p>correct_ip = self.check_ip(ip_list)<br \/>\nprint(\"\u53ef\u7528\u7684IP\u5730\u5740\u6709{}\u4e2a\".format(len(correct_ip)))<br \/>\nprint(correct_ip)<\/p>\n<p>if __name__ == '__main__':<br \/>\nip = FreeIP()<br \/>\nip.run()<\/p>\n<p>\u5982\u4f55\u8c03\u7528\u7ed3\u679c<br \/>\n\uff08\u4e0d\u63a8\u8350\uff09\u53ef\u4ee5\u5c06\u6b64\u4ee3\u7801\u590d\u5236\u5230\u81ea\u5df1\u7684\u722c\u866b\u4ee3\u7801\u91cc\uff0c\u6bcf\u6b21\u8c03\u7528free_ip.get_ip()\uff0c\u83b7\u5f97list\u3002\u8be5\u65b9\u6cd5\u4e0d\u63a8\u8350\uff0c\u56e0\u4e3a\u4f1a\u4f7f\u7f51\u7ad9\u5e76\u53d1\u91cf\u5927\uff0c\u5e76\u4e14\u5c0f\u578b\u722c\u866b\u9879\u76ee\u4e0d\u9700\u8981\u8fd9\u4e48\u591a\u4ee3\u7406IP\u3002<br \/>\n\uff08\u63a8\u8350\uff09\u624b\u52a8\u590d\u5236\u63a7\u5236\u53f0\u91cc\u7684IP\u5730\u5740\u4fe1\u606f\uff0c\u7c98\u8d34\u5230\u4ee3\u7801\u4e2d\uff0c\u4f5c\u4e3a\u521d\u59cb\u5316IP\u5730\u5740\uff0c\u7136\u540e\u6bcf\u6b21\u968f\u673a\u9009\u62e9\u4e00\u4e2aIP\u5730\u5740\u8bf7\u6c42\u3002<br \/>\nurl = 'https:\/\/icanhazip.com\/'<br \/>\n# \u6ce8\u610f\uff0c\u5e95\u4e0b\u7684[]\u5185\u5bb9\u4e3a\u590d\u5236\u7c98\u8d34\u4e0a\u7684<br \/>\nip =['149.28.58.133:8080', '134.209.218.104:8080', '157.245.252.104:8080', '157.230.85.89:8080', '62.151.183.160:3128', '68.183.102.160:8080', '44.192.64.137:80', '134.209.70.67:8080', '169.57.1.84:80', '157.230.208.88:8080', '157.230.227.106:8080']<br \/>\nfor i in range(100):<br \/>\ntry:<br \/>\nreal_ip = random.choice(ip)<br \/>\nproxy = {'https':real_ip}<br \/>\nres_text = requests.get(url=url,proxies=proxy, timeout = 5)<br \/>\nprint(\"\u6210\u529f{}\".format(real_ip))<br \/>\nexcept:<br \/>\nprint(\"{}\u4e0d\u53ef\u7528\".format(real_ip))<br \/>\nip.remove(real_ip)<\/p>\n<p>\u603b\u7ed3<br \/>\nHTTPS\u7aef\u53e3\u53f7\uff0c\u53ef\u4ee5\u8bf7\u6c42http\u3001https\u7f51\u5740<br \/>\n\u6709\u7684\u540c\u5b66\u8bbe\u7f6e\u8bf7\u6c42\u7684\u65f6\u5019\uff0c\u53d1\u73b0\u5728\u8bbe\u7f6eproxy\u65f6\uff0c\u5982\u679c\u4e3ahttp\uff0c\u800c\u76ee\u6807url\u4e3ahttps\uff0c\u4e5f\u80fd\u8bf7\u6c42\u6210\u529f\u3002\u8fd9\u662f\u8bef\u533a\uff0c\u56e0\u4e3a\u5982\u679cproxy\u91cc\u7684\u7c7b\u578b\u548curl\u7c7b\u578b\u4e0d\u540c\u65f6\uff0c\u8bf7\u6c42\u7684IP\u5730\u5740\u5e76\u4e0d\u662f\u4ee3\u7406IP\u5730\u5740\uff0c\u800c\u662f\u672c\u673a\u7684IP\uff0c\u5177\u4f53\u53ef\u4ee5\u901a\u8fc7IP\u5730\u5740\u7f51\u7ad9\u5b9e\u9a8c<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-899\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2021\/02\/2021020320164081.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"392\" height=\"219\" title=\"\u901a\u8fc7\u722c\u866b\u83b7\u53d6\u514d\u8d39IP\u4ee3\u7406\uff0c\u642d\u5efa\u81ea\u5df1\u7684IP\u6c60\uff08https\uff09\u63d2\u56fe\" alt=\"\u901a\u8fc7\u722c\u866b\u83b7\u53d6\u514d\u8d39IP\u4ee3\u7406\uff0c\u642d\u5efa\u81ea\u5df1\u7684IP\u6c60\uff08https\uff09\u63d2\u56fe\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u5e38\u89c1\u7684\u53cd\u722c\u866b\u63aa\u65bd\u4e4b\u4e00\uff0c\u5c31\u662f\u67e5\u770b\u7528\u6237\u53d1\u8d77\u8bf7\u6c42\u7684IP\u5730\u5740\uff0c\u82e5\u5f88\u9891\u7e41\uff0c\u5219\u5c01IP\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u52a8\u6001\u4ee3\u7406IP\u6c60 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,1,21],"tags":[748,749,750,753,752,751],"class_list":["post-1122","post","type-post","status-publish","format-standard","hentry","category-python","category-net-security","category-script","tag-https","tag-753","tag-752","tag-751"],"_links":{"self":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/1122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1122"}],"version-history":[{"count":0,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/1122\/revisions"}],"wp:attachment":[{"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}