Tag Archives: powershell ip address

Powershell ile Public IP Adresleri Hakkında Bilgi Toplamak

Public IP adresiniz ve lokasyon bilgisiniz çekmek için aşağıdaki komutu kullanabilirsiniz.
Invoke-RestMethod -Uri ‘ipinfo.io/json’

Farklı bir IP adresi hakkında bilgi almak için de kullanılabilir.
Invoke-RestMethod -Uri ‘http://ipinfo.io/Ipadresi/json’

Bilgisayarınızdaki hangi uygulamanın hangi port üzerinden internete eriştiğini öğrenmek için aşağıdaki scripti kullanılabilirsiniz. Örnekteki script için 443 portu kullanılmıştır. Farklı bir port girebilirsiniz.



$Process = @{
    Name='Process'
    Expression={
 
        (Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue).Path
       
        }
}

$IpOwner = @{
    Name='RemoteAuthority'
    Expression={
        $ip = $_.RemoteAddress
        $info = Invoke-RestMethod -Uri "http://ipinfo.io/$ip/json"
        '{0} ({1})' -f $info.Org, $info.City
    }
}

 
Get-NetTCPConnection -RemotePort 443 -State Established | 
 
  Where-Object RemoteAddress |
 
  Select-Object -Property $IPOwner, RemoteAddress, OwningProcess, $Process