Tools

News

Notícias

Classificados

Cursos

Broker

IPv4:

IPv6:

 

UpOrDown
Ping
MTR
Smokeping
MTU Detect
Portscan
DNS
HTTP/SSL
My IP
IP Calc
IP Extractor
Uptime Monitor

My IP

Recupere seu endereço IPv4/IPv6 público por meio de uma interface web simples ou endpoint API. Integre a detecção instantânea de IP do cliente em scripts e aplicativos para configurações de rede dinâmicas.

IPv4:
IPv6:

Use um dos métodos abaixo em seu aplicativo ou linha de comando.
O retorno será sempre o IPv4 ou IPv6 do solicitante.

Existem 3 hosts disponíveis que detectam IP.

  • ip.isp.tools – Detecta IPv4 ou IPv6. Responde com o IP usado na conexão.
  • ipv4.isp.tools – Força a resolução apenas de IPv4.
  • ipv6.isp.tools – Força a resolução apenas de IPv6.

Escolha um dos hosts e chame-o usando o comando curl.

Exemplo:

				
					curl ip.isp.tools
curl ipv4.isp.tools
curl ipv6.isp.tools
				
			

Você também pode forçar o curl a se conectar a uma versão:

				
					$ curl -4 ip.isp.tools
$ curl -6 ip.isp.tools
				
			

Ou automatize inserindo-o em ~/.bashrc:

				
					$ printf '\n# ISP.Tools IP helpers
ip()   { [ "$#" -eq 0 ] && curl -fsSL ip.isp.tools   || command ip   "$@"; }
ipv4() { [ "$#" -eq 0 ] && curl -fsSL ipv4.isp.tools || command ipv4 "$@"; }
ipv6() { [ "$#" -eq 0 ] && curl -fsSL ipv6.isp.tools || command ipv6 "$@"; }
export -f ip ipv4 ipv6\n' >> ~/.bashrc && source ~/.bashrc
				
			

E use assim:

				
					$ ip
179.104.127.31

$ ipv4
179.104.127.31

$ ipv6
2804:1e68:300f:d1af:f8d9:dfa1:3278:acb3
				
			
				
					// Javascript 
const fetch = require('node-fetch');
const url   = 'https://ip.isp.tools/json';
fetch(url)
  .then(res  => res.json())
  .then(data => console.log(data.ip));

				
			
				
					// React: fetch and hooks
import React, { useState, useEffect } from 'react';

function IPDisplay() {
  const [ip, setIp] = useState('');

  useEffect(() => {
    fetch('https://ip.isp.tools/json')
      .then(res => res.json())
      .then(data => setIp(data.ip))
      .catch(err => console.error(err));
  }, []);

  return (
    <div>
      <h1>Your IP:</h1>
      <p>{ip ? ip : "Loading..."}</p>
    </div>
  );
}

export default IPDisplay;

				
			
				
					// React: fetch with async/await
import React, { useState, useEffect } from 'react';

function IPFetcher() {
  const [ip, setIp] = useState('');

  useEffect(() => {
    async function fetchIp() {
      try {
        const res = await fetch('https://ip.isp.tools/json');
        const data = await res.json();
        setIp(data.ip);
      } catch (error) {
        console.error(error);
      }
    }
    fetchIp();
  }, []);

  return (
    <div>
      <h2>Your IP Address</h2>
      <p>{ip || 'Loading...'}</p>
    </div>
  );
}

export default IPFetcher;

				
			
				
					<div x-data="{ ip: 'Loading...' }" x-init="fetch('https://ip.isp.tools/json')
    .then(response => response.json())
    .then(data => { ip = data.ip })
    .catch(error => { ip = 'Error fetching IP' })">
  <h1>Your IP Address:</h1>
  <p x-text="ip"></p>
</div>
				
			
				
					<template>
  <div>
    <h1>Your IP Address:</h1>
    <p>{{ ip }}</p>
  </div>
</template>

<script>
import { ref, onMounted } from 'vue';

export default {
  setup() {
    const ip = ref('Loading...');

    onMounted(async () => {
      try {
        const response = await fetch('https://ip.isp.tools/json');
        const data = await response.json();
        ip.value = data.ip;
      } catch (error) {
        ip.value = 'Error fetching IP';
        console.error(error);
      }
    });

    return { ip };
  }
};
</script>

				
			
				
					<script>
  let ip = 'Loading...';

  async function getIp() {
    try {
      const response = await fetch('https://ip.isp.tools/json');
      const data = await response.json();
      ip = data.ip;
    } catch (error) {
      ip = 'Error fetching IP';
      console.error(error);
    }
  }

  getIp();
</script>

<h1>Your IP Address:</h1>
<p>{ip}</p>

				
			
				
					import requests

request = requests.get('https://ip.isp.tools/json').json()
ip = request['ip']
type_ip = request['type']
print(ip, type_ip)

				
			
				
					<?php
$data = json_decode(file_get_contents('https://ip.isp.tools/json'), true);
echo "IP: {$data['ip']} — Type: {$data['type']}\n";

				
			
				
					package main

import (
  "encoding/json"
  "fmt"
  "net/http"
)

func main() {
  resp, _ := http.Get("https://ip.isp.tools/json")
  defer resp.Body.Close()
  var d struct{ IP string }
  json.NewDecoder(resp.Body).Decode(&d)
  fmt.Println(d.IP)
}

				
			
				
					import java.net.http.*; import java.net.URI; import com.fasterxml.jackson.databind.*;

public class Main {
  public static void main(String[] args)throws Exception {
    String b = HttpClient.newHttpClient()
      .send(HttpRequest.newBuilder(URI.create("https://ip.isp.tools/json")).build(),
            HttpResponse.BodyHandlers.ofString())
      .body();
    System.out.println(new ObjectMapper()
      .readTree(b).get("ip").asText());
  }
}

				
			
				
					using System;
using System.Net.Http;
using System.Text.Json;
class Program {
  static async System.Threading.Tasks.Task Main() {
    var j = await new HttpClient()
      .GetStringAsync("https://ip.isp.tools/json");
    Console.WriteLine(
      JsonDocument.Parse(j)
        .RootElement.GetProperty("ip")
        .GetString()
    );
  }
}

				
			
				
					require 'net/http'
require 'json'

data = JSON.parse(Net::HTTP.get(URI('https://ip.isp.tools/json')))
puts data['ip']

				
			
				
					#!/bin/bash
ip=$(curl -s https://ip.isp.tools/json | jq -r .ip)
echo $ip

				
			
				
					$ip = (Invoke-RestMethod -Uri 'https://ip.isp.tools/json').ip
Write-Host $ip
				
			
				
					@echo off
for /f "tokens=2 delims=:" %%a in ('curl -s https://ip.isp.tools/json ^| findstr "ip"') do set IP=%%a
set IP=%IP:"=%
echo %IP%

				
			
				
					#!/bin/zsh
ip=$(curl -s https://ip.isp.tools/json | jq -r .ip)
echo $ip

				
			
				
					#!/usr/bin/swift
import Foundation

let url = URL(string: "https://ip.isp.tools/json")!
let data = try! Data(contentsOf: url)
let obj  = try! JSONSerialization.jsonObject(with: data) as! [String:Any]
print(obj["ip"] as! String)

				
			
				
					use reqwest::blocking::get;
use serde_json::Value;

fn main() {
    let resp = get("https://ip.isp.tools/json").unwrap().text().unwrap();
    let ip   = serde_json::from_str::<Value>(&resp).unwrap()["ip"].as_str().unwrap();
    println!("{}", ip);
}

				
			
				
					import 'dart:convert';
import 'dart:io';

void main() async {
  var resp = await HttpClient()
      .getUrl(Uri.parse('https://ip.isp.tools/json'))
      .then((r) => r.close())
      .then((r) => r.transform(utf8.decoder).join());
  print(json.decode(resp)['ip']);
}

				
			

O ISP.Tools sobrevive graças aos anúncios.

Considere desativar seu bloqueador de anúncios.
Prometemos não ser intrusivos.

Consentimento para cookies

Utilizamos cookies para melhorar a sua experiência no nosso site.

Ao utilizar o nosso site, você concorda com o uso de cookies. Saiba mais