显示客户端IP的详细信息
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
5.5 KiB

function getInfo(){$.get("/info/"+$("input").val(),(function(data){if(console.log(data),"F"!=data.status){if($("input").val()||$("input").val(data.ip),$("button").text("Search"),$("table").show(1e3),$("#ip").text(data.ip),data.city=null==data.city?"Unknow":data.city,data.region=null==data.region?"Unknow":data.region,data.country=null==data.country?"Unknow":data.country,data.timezone=null==data.timezone?"Unknow":data.timezone,data.isp=null==data.isp?"Unknow":data.isp,data.scope=null==data.scope?"Unknow":data.scope,data.detail=null==data.detail||" "==data.detail?"Unknow":data.detail,$("#city").text(data.city),$("#region").text(data.region),$("#country").text(data.country),$("#timezone").text(data.timezone),$("#isp").text(data.isp),$("#scope").text(data.scope),$("#detail").text(data.detail),null==data.as)$("#as").text("Unknow");else{$("#as").text(data.as);var asUri="https://bgpview.io/asn/"+data.as.substr(2);$("#as").html('<a href="'+asUri+'" target="_blank" title="AS information">'+data.as+"</a>")}if(null==data.loc)$("#loc").text("Unknow"),clear();else{var earthUri="https://earth.google.com/web/@"+data.loc+",0a,398836d,1y,0h,0t,0r";$("#loc").html('<a href="'+earthUri+'" target="_blank" title="View on Google Earth">'+data.loc+"</a>"),draw(parseFloat(data.loc.split(",")[0]),parseFloat(data.loc.split(",")[1]))}}else errorIP()}))}function getVersion(){$.get("/version",(function(data){console.log(data),data.qqwry=data.qqwry.slice(0,4)+"-"+data.qqwry.slice(4,6)+"-"+data.qqwry.slice(6,8),data.ipip=data.ipip.slice(0,4)+"-"+data.ipip.slice(4,6)+"-"+data.ipip.slice(6,8);var data_ver="";data_ver+="echoIP: "+data.echoip+"\n",data_ver+="纯真数据库: "+data.qqwry+"\n",data_ver+="IPIP.net数据库: "+data.ipip,alert(data_ver)}))}function trim(str){return str.replace(/(^\s*)|(\s*$)/g,"")}function errorIP(){$("button").text("Illegal IP"),$("button").css({"border-color":"#ff406f","background-color":"#ff406f"}),$("input").focus()}function checkIP(ip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.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3})|([0-9A-Fa-f]{1,4}:(:[0-9A-Fa-f]{1,4}){0,4}:(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3})|(:(:[0-9A-Fa-f]{1,4}){0,5}:(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}))$/,V4=ipStr.match(regIPv4),V6=ipStr.match(regIPv6);return null===V4&&null===V6?"error":"ok"}function getQuery(name){var reg=new RegExp("(^|&)"+name+"=([^&]*)(&|$)"),result=window.location.search.substr(1).match(reg);return null!=result?unescape(result[2]):null}function clear(){var map;new mapboxgl.Map({container:"map",style:"mapbox://styles/mapbox/streets-v11",center:[0,0],zoom:1}).on("load",(function(){console.log("reset map")}))}function draw(x,y){var map=new mapboxgl.Map({container:"map",style:"mapbox://styles/mapbox/streets-v11",center:[y,x],zoom:3}),size=100,pulsingDot={width:100,height:100,data:new Uint8Array(4e4),onAdd:function(){var canvas=document.createElement("canvas");canvas.width=this.width,canvas.height=this