MediaWiki:Whois.js
Замечание. Возможно, после сохранения вам придётся очистить кэш своего браузера, чтобы увидеть изменения.
- Firefox / Safari: Удерживая клавишу Shift, нажмите на панели инструментов Обновить либо нажмите Ctrl-F5 или Ctrl-R (⌘-R на Mac)
- Google Chrome: Нажмите Ctrl-Shift-R (⌘-Shift-R на Mac)
- Internet Explorer: Удерживая Ctrl, нажмите Обновить либо нажмите Ctrl-F5
- Opera: Перейдите в Menu → Настройки (Opera → Настройки на Mac), а затем Безопасность → Очистить историю посещений → Кэшированные изображения и файлы
// <source lang="javascript"> ////////CLIENT SIDE CHECKUSER IP info retriever///////////// //security override HTTP request //ALSO, reduce IE security settings //For FF/NS, go enable, see "http://esw.w3.org/topic/SparqlCalendarDemoUsage#FAQ" //Basically, enable "signed.applets.codebase_principal_support" in about:config addOnloadHook(WHOIScheck) function WHOIScheck() { if (location.href.indexOf('Special:CheckUser') ==-1) return; var body=document.getElementById('bodyContent'); if (!body) return; addTab("javascript:CU_comprehensive()", "WHOIS all IPs", "ca-checkall", "Check all IPs", ""); } // function makeCURequestXML_DNS(type, url, parameters) { if(window.XMLHttpRequest) { try {netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } catch (e) {alert("Permission UniversalBrowserRead denied. Please enable 'signed.applets.codebase_principle_support' through 'about:config' in your browser."); } http_request = false; http_request = new XMLHttpRequest(); if (!http_request) {alert('Cannot create XMLHTTP instance'); return false;} http_request.onreadystatechange = CU_comprehensive_check_WHOIS; http_request.open(type, url, true); http_request.send(parameters); } else if (window.ActiveXObject) { try {http_request = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) { try {http_request = new ActiveXObject("Microsoft.XMLHTTP");} catch (e){} } if (!http_request) {showError(ERROR_XML);} http_request.onreadystatechange = CU_comprehensive_check_WHOIS; http_request.open(type, url, true); http_request.send(parameters); } } // // function makeCURequestXML_WHOIS(type, url, parameters) { if(window.XMLHttpRequest) { try {netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } catch (e) {alert("Permission UniversalBrowserRead denied. Please enable 'signed.applets.codebase_principle_support' through 'about:config' in your browser."); } http_request = false; http_request = new XMLHttpRequest(); if (!http_request) {alert('Cannot create XMLHTTP instance'); return false;} http_request.onreadystatechange = CU_comprehensive_check_parse; http_request.open(type, url, true); http_request.send(parameters); } else if (window.ActiveXObject) { try {http_request = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) { try {http_request = new ActiveXObject("Microsoft.XMLHTTP");} catch (e){} } if (!http_request) {showError(ERROR_XML);} http_request.onreadystatechange = CU_comprehensive_check_parse; http_request.open(type, url, true); http_request.send(parameters); } } // //IP/WHOIS for CU principle results// CU_li_index = 0; CU_li_ip_list = '|'; function CU_comprehensive() { var results = document.getElementById('bodyContent').getElementsByTagName('ul')[0]; if (!results) {alert('There are no elements in this list.'); return;} if (!results.getElementsByTagName('li')[0]) {alert('There are no elements in this list.'); return;} var ls = results.getElementsByTagName('li'); if (!ls[0].getElementsByTagName('a')[0]) {alert('There are no expected elements in this list.'); return;} if (document.getElementById('contentSub').innerHTML.search(/Checking all IPs, please wait...|All data retrieved:/) != -1) {alert('Results already shown.'); return;} document.getElementById('contentSub').innerHTML += '<br>Checking all IPs, please wait...'; CU_comprehensive_check(); } function CU_comprehensive_check() { var list = document.getElementById('bodyContent').getElementsByTagName('ul')[0]; if (list.getElementsByTagName('li')[CU_li_index] && list.getElementsByTagName('li')[CU_li_index].getElementsByTagName('a')[0]) { var link = list.getElementsByTagName('li')[CU_li_index].getElementsByTagName('a')[0].href; var name = list.getElementsByTagName('li')[CU_li_index].getElementsByTagName('a')[0].innerHTML; // Must be an IP address, and one that we didn't already do if (name.search(/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(:{1,2}[0-9A-Fa-f]{1,4}|::$){1,7})$/) !=-1 && CU_li_ip_list.indexOf('|' + name + '|') ==-1) { var URL = 'http://www.dnsstuff.com/tools/ipall.ch?domain=' + name; CU_li_ip_list += name + '|'; CU_comprehensive_check_DNS(URL); } else {CU_li_index+=1; CU_comprehensive_check();} } else if (list.getElementsByTagName('li')[CU_li_index]) {CU_li_index+=1; CU_comprehensive_check();} else { document.getElementById('contentSub').innerHTML = '<br><strong><span style="color:darkblue;">All data retrieved:</span> DNS/WHOIS scan completed.</strong>'; } } function CU_comprehensive_check_DNS(URL) { var list = document.getElementById('bodyContent').getElementsByTagName('ul')[0]; var name = list.getElementsByTagName('li')[CU_li_index].getElementsByTagName('a')[0].innerHTML; document.getElementById('contentSub').innerHTML = '<br><strong>Retrieving DNS XML page data for ' + name + '...</strong>'; makeCURequestXML_DNS("GET",URL,null); } function CU_comprehensive_check_WHOIS() { if (http_request.readyState != 4) return; xml_DNS_user_CU = http_request.responseText; var list = document.getElementById('bodyContent').getElementsByTagName('ul')[0]; var name = list.getElementsByTagName('li')[CU_li_index].getElementsByTagName('a')[0].innerHTML; var URL = 'http://www.dnsstuff.com/tools/whois.ch?ip=' + name; document.getElementById('contentSub').innerHTML = '<br><strong>Retrieving WHOIS XML page data for ' + name + '...</strong>'; makeCURequestXML_WHOIS("GET",URL,null); } function CU_comprehensive_check_parse() { if (http_request.readyState != 4) return; xml_WHOIS_CU = http_request.responseText; var list = document.getElementById('bodyContent').getElementsByTagName('ul')[0]; var name = list.getElementsByTagName('li')[CU_li_index].getElementsByTagName('a')[0].innerHTML; document.getElementById('contentSub').innerHTML = '<br><strong>Parsing WHOIS XML page data for ' + name + '...</strong>'; //WHOIS //parse WHOIS results var OrgName=''; var Address=''; var City=''; var StateProv=''; var Country=''; var CIDR=''; var Location=''; // A data chunk may appear at the top // Get user location if( xml_WHOIS_CU.indexOf('Location:') !=-1) {Location += xml_WHOIS_CU.split('Location:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ']';} // Focus... if (xml_WHOIS_CU.indexOf('<TR><TD><PRE>') !=-1) {xml_WHOIS_CU = http_request.responseText.split('<TR><TD><PRE>')[1];} xml_WHOIS_CU = xml_WHOIS_CU.split('</PRE></TD></TR>')[0].split('<PRE><BR>')[0]; // Get name if (xml_WHOIS_CU.indexOf('OrgName:') !=-1) {OrgName += xml_WHOIS_CU.split('OrgName:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} else if (xml_WHOIS_CU.indexOf('org-name:') !=-1) {OrgName += xml_WHOIS_CU.split('org-name:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} else if (xml_WHOIS_CU.indexOf('organisation:') !=-1) {OrgName += xml_WHOIS_CU.split('organisation:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} // Get address if (xml_WHOIS_CU.indexOf('Address:') !=-1) {Address += xml_WHOIS_CU.split('Address:')[1].split(/[\n\r]\w+:/)[0].split(']')[0] + ', ';} var address_lines = xml_WHOIS_CU.split('address:'); if (address_lines[1]) {Address += address_lines[1].split(/[\n\r]\w+:/)[0].split(']')[0] + ', ';} if (address_lines[2]) {Address += address_lines[2].split(/[\n\r]\w+:/)[0].split(']')[0] + ', ';} if (address_lines[3]) {Address += address_lines[3].split(/[\n\r]\w+:/)[0].split(']')[0] + ', ';} if (address_lines[4]) {Address += address_lines[4].split(/[\n\r]\w+:/)[0].split(']')[0] + ', ';} if (address_lines[5]) {Address += address_lines[5].split(/[\n\r]\w+:/)[0].split(']')[0] + ', ';} // Get city if ( City=='' && xml_WHOIS_CU.indexOf('city:') !=-1) {City += '<u>' + xml_WHOIS_CU.split('city:')[1].split('\n')[0].split('\r')[0].split(']')[0] + '</u>' + ', ';} // Get state if (xml_WHOIS_CU.indexOf('StateProv:') !=-1) {StateProv += xml_WHOIS_CU.split('StateProv:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} else if (xml_WHOIS_CU.indexOf('stateprov:') !=-1) {StateProv += xml_WHOIS_CU.split('stateprov:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} // Get country if ( Country=='' && xml_WHOIS_CU.indexOf('Country:') !=-1) {Country += xml_WHOIS_CU.split('Country:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} else if ( Country=='' && xml_WHOIS_CU.indexOf('country:') !=-1) {Country += xml_WHOIS_CU.split('country:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} // Get CIDR if (xml_WHOIS_CU.indexOf('CIDR:') !=-1) {CIDR = xml_WHOIS_CU.split('CIDR:')[1].split('\n')[0].split('\r')[0].split(']')[0];} else if (xml_WHOIS_CU.indexOf('route:') !=-1) {CIDR = xml_WHOIS_CU.split('route:')[1].split('\n')[0].split('\r')[0].split(']')[0];} else if (xml_WHOIS_CU.indexOf('inetnum:') !=-1) {CIDR = xml_WHOIS_CU.split('inetnum:')[1].split('\n')[0].split('\r')[0].split(']')[0];} // join them var output_IP_info = '<strong>' + OrgName + '</strong>' + Address + City + '<strong>' + StateProv + '</strong>' + '<i>' + Country + '</i>'; // add CIDR if (CIDR !='') output_IP_info += '<br/><span style="color:darkred;">CIDR:</span>' + CIDR; // Parse DNS items document.getElementById('contentSub').innerHTML = '<br><strong>Parsing DNS XML page data for ' + name + '...</strong>'; if (xml_DNS_user_CU.indexOf('<PRE>') != -1) {xml_DNS_user_CU = xml_DNS_user_CU.split('<PRE>')[1].split('</PRE>')[0];} var rev_DNS_info = ''; if (xml_DNS_user_CU.indexOf('Reverse DNS:') !=-1) {rev_DNS_info = '<strong>' + xml_DNS_user_CU.split('Reverse DNS:')[1].split('\n')[0].split('\r')[0] + '</strong>';} output_IP_info += ' <span style="color:darkred;">RDNS</span>:' + rev_DNS_info; output_IP_info = output_IP_info.replace(/Internet Assigned Numbers Authority/,'IANA'); // Add location if (Location !='') output_IP_info += '<br/><span style="color:darkred;">Location:</span>' + Location; link = '<a href="http://www.dnsstuff.com/tools/whois.ch?%26ip%3D' + name + '">(Full)</a> '; list.getElementsByTagName('li')[CU_li_index].innerHTML += '<br/><div style="background-color: #f9f9f9; border: 1px solid #8888aa; padding: 3px;">' + link + output_IP_info + '</div>'; // CU_li_index += 1; CU_comprehensive_check(); } ////////////// //</source>