Locating via IP
Posted by wonder
Wednesday, March 21, 2007
Description: Locates a nick/IP to city, state, and country
Use: @locate ip/nick
example: @locate [clan]bob1337 or @locate 123.456.78.91
Does not work with someone with a masked ip. (blah.user.gamesurge) and some certain ISPs.
P.S: Can you unban me now? I requested myself for accidently pasting a script over a year ago :( and I havent been unbanned yet QQ
Use: @locate ip/nick
example: @locate [clan]bob1337 or @locate 123.456.78.91
Does not work with someone with a masked ip. (blah.user.gamesurge) and some certain ISPs.
P.S: Can you unban me now? I requested myself for accidently pasting a script over a year ago :( and I havent been unbanned yet QQ
on *:text:@locate*:*:{
set %ipaddchan $chan
if ( $gettok($2,1,46) isnum 1-99 ) {
set %resolved $2
iplocate
}
elseif ( $gettok($2,1,$chr(10)) isletter abcdefghijklmnopqrstuvwxyz ) {
dns $address($2,1)
}
}
on *:DNS:{
if ($raddress == $null) { msg # $+ %ipaddchan IP could not be resolved. | halt }
set %resolved $raddress
iplocate
}
ALIAS iplocate {
set %iploc 1
sockclose iploc
sockopen iploc dnsstuff.com 80
}
ALIAS halnohtml var %haltmp , %i = $regsub($1-,/(<[^>]+>)/g,$chr(32),%haltmp) | return %haltmp
on *:SOCKOPEN:iploc: {
sockwrite -n $sockname GET /tools/ipall.ch?ip= $+ %resolved HTTP/1.1
sockwrite -n $sockname Host: www.melissadata.com
sockwrite -n $sockname User-agent: mIRC/ $+ $version
sockwrite -n $sockname $crlf
}
on *:SOCKREAD:iploc: {
if ($sockerr > 0) { return }
var %haltmp | sockread %haltmp
while ($sockbr) {
if ( *City (per outside source):* iswm %haltmp ) {
set %ipcity $gettok($remove($halnohtml(%haltmp),$chr(40) $+ per,outside,source $+ $chr(41),city,$chr(58)),1,44))
set %ipstate $gettok($remove($halnohtml(%haltmp),$chr(40) $+ per,outside,source $+ $chr(41),city,$chr(58)),2,44))
msg %ipaddchan IP: %resolved
msg %ipaddchan City: %ipcity
msg %ipaddchan State: %ipstate
}
if ( *Country (per outside source):* iswm %haltmp ) {
set %ipcountry $remove($halnohtml(%haltmp),$chr(40) $+ per,outside,source $+ $chr(41),city,$chr(58),$chr(91),$chr(93),US,Country)))
msg %ipaddchan Country: %ipcountry
inc %iploc
}
set %mytemp $halnohtml(%haltmp)
sockread %haltmp
}
}