Skip to content
ashi876 edited this page Jul 26, 2017 · 5 revisions
<title>Index of /ip.html</title> <textarea name="rawips" rows="20" cols="25" onkeyup="javascript:convert()" onblur="javascript:convert()" spellcheck="false" placeholder="请把包含 IP 地址的文本粘贴到此处"></textarea> <textarea name="jsonips" rows="20" cols="25" spellcheck="false" style="background-color:#F3F3F3;" readonly="true" placeholder="GoA格式的IP地址将显示在此"></textarea> <textarea name="jsonips" rows="20" cols="25" spellcheck="false" style="background-color:#F3F3F3;" readonly="true" placeholder="普通格式的IP地址将显示在此"></textarea>
IPv4 IPv6

{{.Message}}

提取文本中IP并整理为goa模式

<script type="text/javascript"> var proxyprovided = (typeof(IPHTMLVISABLE) != "undefined"); window.onload = function () { var message = document.getElementsByName('message_shown'); var error = document.getElementsByName('error_message'); if (proxyprovided) { message[0].style.display = ''; error[0].style.display = 'none'; } else { message[0].style.display = 'none'; error[0].style.display = ''; } }
function convert() {
	var text1 = document.getElementsByTagName('textarea')[0];
	var text2 = document.getElementsByTagName('textarea')[1];
	var text3 = document.getElementsByTagName('textarea')[2];
	if (text1.value != "") {
		regex = /([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/g;
		if (document.getElementById('ipv6').checked) {
			regex = /((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))/g
		}
		var matches = text1.value.match(regex)
		if (matches != null) {
			matches = matches.sort().filter(function(el,i,a){if(i==a.indexOf(el))return 1;return 0})
			text2.value = matches.join("\|") + "\|";
			text3.value = matches.join("\n") ;
			enable_submit(true);
			// text2.select();
		} else {
			enable_submit(false);
			text2.value = "没有检测到 IP 地址";
		}
	} else {
		enable_submit(false);
		text2.value = "";
	}
}
</script>
Clone this wiki locally