Python ile IP tespit uygulaması

'Herodot

Asistan Moderatör
30 Eyl 2017
415
270
Kuvâ-yi Milliye
Selam Dostlar,

Bu konuda biraz acemiyim, IP adresinden profesyonel tespitler yapabileceğim uygulama geliştirmeye çalışıyorum.
Aşağıda bir şeyler kodladım, sizin fikriniz var mı ?
IP adresinden ne kadar bilgilere ulaşabiliriz herhangi bir API bağlantısı olmadan



import socket
import requests

def ip_geolocation(ip_address):
try:
hostname = socket.gethostbyaddr(ip_address)[0]
print(f"Hostname: {hostname}")
except socket.herror:
print("Hostname not found")

try:
ip_info = socket.gethostbyname_ex(ip_address)
ips = ip_info[2]
print("IP addresses:")
for ip in ips:
print(f"- {ip}")
except socket.gaierror:
print("IP addresses not found")

try:
url = f"The trusted source for IP address data, leading IP data provider{ip_address}/json"
response = requests.get(url)
data = response.json()
country = data.get('country')
region = data.get('region')
city = data.get('city')
postal = data.get('postal')
print(f"Country: {country}")
print(f"Region: {region}")
print(f"City: {city}")
print(f"Postal Code: {postal}")
except requests.exceptions.RequestException:
print("Location data not found")

# Örnek kullanım
ip_address = "8.8.8.8" # İstediğiniz IP adresini buraya girin

ip_geolocation(ip_address)[/CODE][/ICODE]
 

erkngrbz

Üye
21 Tem 2019
94
1
Selam Dostlar,

Bu konuda biraz acemiyim, IP adresinden profesyonel tespitler yapabileceğim uygulama geliştirmeye çalışıyorum.
Aşağıda bir şeyler kodladım, sizin fikriniz var mı ?
IP adresinden ne kadar bilgilere ulaşabiliriz herhangi bir API bağlantısı olmadan



import socket
import requests

def ip_geolocation(ip_address):
try:
hostname = socket.gethostbyaddr(ip_address)[0]
print(f"Hostname: {hostname}")
except socket.herror:
print("Hostname not found")

try:
ip_info = socket.gethostbyname_ex(ip_address)
ips = ip_info[2]
print("IP addresses:")
for ip in ips:
print(f"- {ip}")
except socket.gaierror:
print("IP addresses not found")

try:
url = f"The trusted source for IP address data, leading IP data provider{ip_address}/json"
response = requests.get(url)
data = response.json()
country = data.get('country')
region = data.get('region')
city = data.get('city')
postal = data.get('postal')
print(f"Country: {country}")
print(f"Region: {region}")
print(f"City: {city}")
print(f"Postal Code: {postal}")
except requests.exceptions.RequestException:
print("Location data not found")

# Örnek kullanım
ip_address = "8.8.8.8" # İstediğiniz IP adresini buraya girin

ip_geolocation(ip_address)[/CODE][/ICODE]
Elline sağlık
 

Muslukcu

Katılımcı Üye
17 Kas 2021
699
262
Tesisat dükkanı
Selam Dostlar,

Bu konuda biraz acemiyim, IP adresinden profesyonel tespitler yapabileceğim uygulama geliştirmeye çalışıyorum.
Aşağıda bir şeyler kodladım, sizin fikriniz var mı ?
IP adresinden ne kadar bilgilere ulaşabiliriz herhangi bir API bağlantısı olmadan



import socket
import requests

def ip_geolocation(ip_address):
try:
hostname = socket.gethostbyaddr(ip_address)[0]
print(f"Hostname: {hostname}")
except socket.herror:
print("Hostname not found")

try:
ip_info = socket.gethostbyname_ex(ip_address)
ips = ip_info[2]
print("IP addresses:")
for ip in ips:
print(f"- {ip}")
except socket.gaierror:
print("IP addresses not found")

try:
url = f"The trusted source for IP address data, leading IP data provider{ip_address}/json"
response = requests.get(url)
data = response.json()
country = data.get('country')
region = data.get('region')
city = data.get('city')
postal = data.get('postal')
print(f"Country: {country}")
print(f"Region: {region}")
print(f"City: {city}")
print(f"Postal Code: {postal}")
except requests.exceptions.RequestException:
print("Location data not found")

# Örnek kullanım
ip_address = "8.8.8.8" # İstediğiniz IP adresini buraya girin

ip_geolocation(ip_address)[/CODE][/ICODE]
Yorum satırları ile betimlemen ve daha renkli bir çalışma yapman daha faydalı olur eline sağlik
 

Nostral

Üye
22 Ağu 2021
201
49
Selam Dostlar,

Bu konuda biraz acemiyim, IP adresinden profesyonel tespitler yapabileceğim uygulama geliştirmeye çalışıyorum.
Aşağıda bir şeyler kodladım, sizin fikriniz var mı ?
IP adresinden ne kadar bilgilere ulaşabiliriz herhangi bir API bağlantısı olmadan



import socket
import requests

def ip_geolocation(ip_address):
try:
hostname = socket.gethostbyaddr(ip_address)[0]
print(f"Hostname: {hostname}")
except socket.herror:
print("Hostname not found")

try:
ip_info = socket.gethostbyname_ex(ip_address)
ips = ip_info[2]
print("IP addresses:")
for ip in ips:
print(f"- {ip}")
except socket.gaierror:
print("IP addresses not found")

try:
url = f"The trusted source for IP address data, leading IP data provider{ip_address}/json"
response = requests.get(url)
data = response.json()
country = data.get('country')
region = data.get('region')
city = data.get('city')
postal = data.get('postal')
print(f"Country: {country}")
print(f"Region: {region}")
print(f"City: {city}")
print(f"Postal Code: {postal}")
except requests.exceptions.RequestException:
print("Location data not found")

# Örnek kullanım
ip_address = "8.8.8.8" # İstediğiniz IP adresini buraya girin

ip_geolocation(ip_address)[/CODE][/ICODE]
edinebileceğin en derin bilgi ip adresinin hangi ilçeye ait olduğudur.
 
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.