You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Name: IP & Domain Lookup// Description: Get information about an IP address or domain// Author: Vedinsoh// GitHub: @Vedinsohimport"@johnlindquist/kit";importnetfrom"node:net";import{URL}from"node:url";constgetLookupData=async(query)=>{// Reference: https://ip-api.com/docs/api:jsonconstresponse=awaitget(`http://ip-api.com/json/${query}?fields=status,message,continent,country,countryCode,regionName,city,zip,lat,lon,timezone,isp,org,as,query`);if(response.data.status==="fail"){thrownewError(response.data.message);}returnresponse.data;};letlookupQuery=awaitarg({placeholder: "Enter IP address or domain",validate: (value)=>{if(net.isIP(value)!==0){returntrue;}else{try{newURL(`https://${value}`);returntrue;}catch(e){return"Please enter a valid IP address or domain";}}},});constdata=awaitgetLookupData(lookupQuery);div(md(`# IP Lookup: ${lookupQuery}- **IP:** ${data.query}- **ISP:** ${data.isp}- **Organization:** ${data.org}- **AS:** ${data.as}- **Continent:** ${data.continent}- **Country:** ${data.country} (${data.countryCode})- **Region:** ${data.regionName}- **City:** ${data.city}- **Zip Code:** ${data.zip}- **Latitude:** ${data.lat}- **Longitude:** ${data.lon}- **Timezone:** ${data.timezone}`));
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Open ip-lookup in Script Kit
Beta Was this translation helpful? Give feedback.
All reactions