Kod: Kodu kopyalamak için üzerine çift tıklayın!
alias sorgula {
if (!$1) { echo -a Örnek: /sorgula 1.2.3.4 | return }
unset %head.done
set %ip.raw $null
set %ip.addr $1
sockopen -e ip.lookup ipwho.is 443
}
on *:sockopen:ip.lookup:{
if ($sockerr) { echo -a Bağlantı hatası. | return }
sockwrite -nt $sockname GET /json/$+ %ip.addr HTTP/1.1
sockwrite -nt $sockname Host: ipwho.is
sockwrite -nt $sockname User-Agent: mIRC
sockwrite -nt $sockname Connection: close
sockwrite -nt $sockname $crlf
}
on *:sockread:ip.lookup:{
var %l
sockread %l
; header bitti mi?
if (!$len(%l)) { set %head.done 1 | return }
if (%l == $chr(13)) { set %head.done 1 | return }
if (!%head.done) return
; json verisini ekle
set %ip.raw %ip.raw %l
}
on *:sockclose:ip.lookup:{
if (%ip.raw == $null) {
echo -a Sunucu veri göndermedi.
unset %ip.*
return
}
var %j = %ip.raw
var %asn = Bulunamadı
var %ulke = Bulunamadı
var %kita = Bulunamadı
var %bolge = Bulunamadı
var %sehir = Bulunamadı
var %isp = Bulunamadı
var %tur = Bulunamadı
var %domain = Bulunamadı
if ($regex(%j,/"asn":\s*([0-9]+)/)) set %asn $regml(1)
if ($regex(%j,/"country":"([^"]+)"/)) set %ulke $regml(1)
if ($regex(%j,/"continent":"([^"]+)"/)) set %kita $regml(1)
if ($regex(%j,/"region":"([^"]+)"/)) set %bolge $regml(1)
if ($regex(%j,/"city":"([^"]+)"/)) set %sehir $regml(1)
if ($regex(%j,/"isp":"([^"]+)"/)) set %isp $regml(1)
if ($regex(%j,/"type":"([^"]+)"/)) set %tur $regml(1)
if ($regex(%j,/"domain":"([^"]+)"/)) set %domain $regml(1)
echo -a ASN: $fixutf(%asn)
echo -a Ülke: $fixutf(%ulke)
echo -a Kıta: $fixutf(%kita)
echo -a Bölge: $fixutf(%bolge)
echo -a Şehir: $fixutf(%sehir)
echo -a ISP: $fixutf(%isp)
echo -a Tür: $fixutf(%tur)
echo -a Domain: $fixutf(%domain)
unset %ip.*
unset %head.done
}
alias fixutf {
return $replace($1-,\u0130,İ,\u0131,ı,\u00dc,Ü,\u00fc,ü,\u011e,Ğ,\u011f,ğ,
\u015e,Ş,\u015f,ş,\u00d6,Ö,\u00f6,ö,\u00c7,Ç,\u00e7,ç)
}