IP Locator v1.7

By DeaD_LoRD on Jan 17, 2018

Commands: !ip 1.2.3.4 - .ip 1.2.3.4 - @ip 1.2.3.4

#ip on

on *:text:*:#:{ if (?ip iswm $1 && $2 && $left($1,1) isin .@!) { ipit $2 # } }
on *:input:#:{ if (?ip iswm $1 && $server && /* !iswm $1 && $2 && $left($1,1) isin .@!) { ipit $2 # } }

  set %color $chr(3) $+ $gettok(02 03 04 05 06 07 10 11 12 13 14 15,$rand(1,12),32)
  set %cololove $chr(3) $+ $gettok(03 04 05 06 07 09 10 11 12 13 14 15,$rand(1,12),32)

alias c { return  $+ %color $+ -=- }

alias -l ipit {
  if (127.* iswm $1 || 192.168.* iswm $1 || 10.* iswm $1 || *localhost* iswm $1) { msg $2 No local addresses! | return }
  sockclose ipit
  sockopen ipit ip-api.com 80
  sockmark ipit $1
  %newchan = $2
  %line = ""
}
on *:sockopen:ipit:{
  if ($sockerr) { msg %newchan [IPinfo] $c Open Error! | unset %newchan %line | return }
  sockwrite -n $sockname GET $+(/json/,$sock($sockname).mark) HTTP/1.1
  sockwrite -n $sockname Host: ip-api.com
  sockwrite -n $sockname Connection: keep-alive
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname Accept-Language: en-us
  sockwrite -n $sockname User-Agent: Mozilla/4.0
  sockwrite -n $sockname Content-Type: text/html
  sockwrite -n $sockname $str($crlf,2)  
}
on *:sockread:ipit:{
  if ($sockerr) { msg %newchan [IPinfo] $c Read Error! | unset %newchan %line | return }
  var %x
  sockread -f %x
  tokenize 32 %x

  if ($+(*,$chr(123),*) iswm $1-) {
    var %a = 1, %b, %x, %x2
    while ($gettok($1-,%a,44)) {
      %b = $v1
      %x = $remove($gettok(%b,1,58),")
      %x2 = $remove($gettok(%b,2,58),")
      if ($+($chr(123),as) != %x && %x != zip) { set -u5 $eval($+(%,%x),1) %x2 }
      inc %a
    }
  }
  if (%country) {
    %line = 9[10I4p10I4n10F4o9] $c IP: $+ %cololove $sock($sockname).mark 
    if (%country) { %line = %line $c Country: $+ %cololove %country $c }
    if (%city) { %line = %line City: $+ %cololove %city $c }
    if (%regionName) { %line = %line State: $+ %cololove %regionName $c }
    if (%isp) { %line = %line ISP: $+ %cololove %isp $c }
    if (%lon) { %line = %line Longitude: $+ %cololove %lon $c }
    if (%lat) { %line = %line Latitude: $+ %cololove %lat $c }
    sockclose $sockname
    endit
  }
}
alias -l endit { 
  if (!%line) { msg %newchan [IpInfo] $c Nothing Found! }
  else { msg %newchan $gettok(%line,1--2,32) }
  unset %line %newchan %city %regionName %country %lat %lon %isp
}
#ip end

Comments

Sign in to comment.
sherazzun   -  Nov 13, 2018

its good can you please advice if result show in notice??

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.