Advertisement
westor

/IPL - IP Lookup addon for JuanAM (v3.0)

Nov 18th, 2014
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 4.60 KB | None | 0 0
  1. alias ipl {
  2.   if (!$1) { echo -at 10 You must enter the IP address to find, in this format 12 $+ /ip 111.111.111.111 | return }
  3.   if ($remove($1,.) !isnum) { echo -at Error: Your IP address is not correct, try again! | return }
  4.   var %s = InfoIP_ $+ $ticks $+ _ $+ $rand(1,10000000)
  5.   if ($sock(%s)) { sockclose %s }
  6.   .timer[ $+ %s $+ ] 1 10 ipl_error %s $1
  7.   echo -at ***** Searching informations for IP:  $+ $1 $+  *****
  8.   sockopen %s geoip.flagfox.net 80
  9.   sockmark %s $1
  10. }
  11.  
  12. ON *:SOCKOPEN:InfoIP_*: {
  13.   if ($sockerr) { echo -at ERROR: Connection problem, Could not connect to the page! | sockclose $sockname | return }
  14.   sockwrite -nt $sockname GET /?ip= $+ $sock($sockname).mark HTTP/1.1
  15.   sockwrite -nt $sockname User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
  16.   sockwrite -nt $sockname Accept-Language: *
  17.   sockwrite -nt $sockname Host: $sock($sockname).addr
  18.   sockwrite -nt $sockname Connection: close
  19.   sockwrite -nt $sockname $crlf
  20. }
  21.  
  22. ON *:SOCKREAD:InfoIP_*: {
  23.   if ($sockerr) { echo -at ERROR: Connection reading problem, Could not read from the page! | sockclose $sockname | return }
  24.   var %r
  25.   sockread %r
  26.   var %r = $remove(%r,$chr(9),$chr(10),$chr(13))
  27.   ;  echo -at READ: %r
  28.   if ($sockbr == 0) { return }
  29.   if (*<a href="http://en.wikipedia.org/wiki/* iswm %r) && ($left(%r,2) == <a) && (*target="_blank" title="Wikipedia entry for* iswm %r) { echo -at 12Continent:1 $httpstrip(%r) $+  }
  30.   if (*<span style="white-space: nowrap"><a href="http://en.wikipedia.org/wiki/* iswm %r) && (*target="_blank" title="* iswm %r) {
  31.     var %country = $httpstrip(%r)
  32.     set -e %country_ [ $+ [ $sockname ] ] %country
  33.     echo -at 12Country:1 %country $+ 
  34.   }
  35.   if (*var myLatLng* iswm %r) { echo -at 12Latitude & Longitude:1 $remove($gettok(%r,2,40),$chr(41),;) $+  }
  36.   if ($left(%r,8) == content:) && (*<br>* iswm %r) {
  37.     echo -at 12Hostname:1 $gettok($gettok(%r,2,39),1,60) $+ 
  38.     var %city = $remove($gettok($gettok(%r,2,39),3,60),br>)
  39.     if ($chr(44) isin %city) { var %city = $gettok(%city,1,44) }
  40.     if (%city) && (%country_ [ $+ [ $sockname ] ] !== %city) { echo -at 12City:1 %city $+  }
  41.     elseif (!%city) { echo -at 12City:1 Unknown $+  }
  42.   }
  43.   if (*<span style="white-space: nowrap">* iswm %r) && (*</span></td>* iswm %r) { echo -at 12Metropolis Area:1 $httpstrip(%r) $+  }
  44.   if (%time_ [ $+ [ $sockname ] ]) && (<td align="left" >* iswm %r) { return }
  45.   if (%time_ [ $+ [ $sockname ] ]) { echo -at 12Local Time:1 $httpstrip(%r) $+  | unset %time_ [ $+ [ $sockname ] ] }
  46.   if ($left(%r,5) == Local) && (*</td>* iswm %r) { set -e %time_ [ $+ [ $sockname ] ] 1 }
  47.  
  48.   if (%code_ [ $+ [ $sockname ] ]) && (<td align="left" >* iswm %r) { return }
  49.   if (%code_ [ $+ [ $sockname ] ]) { echo -at 12Country Code:1 $httpstrip(%r) $+  | unset %code_ [ $+ [ $sockname ] ] }
  50.   if (*<td align="left">Country Code</td>* iswm %r) { set -e %code_ [ $+ [ $sockname ] ] 1 }
  51.  
  52.   if (%reg_ [ $+ [ $sockname ] ]) && (<td align="left" >* iswm %r) { return }
  53.   if (%reg_ [ $+ [ $sockname ] ]) { echo -at 12Region:1 $httpstrip(%r) $+  | unset %reg_ [ $+ [ $sockname ] ] }
  54.   if (*<td align="left">Region</td>* iswm %r) { set -e %reg_ [ $+ [ $sockname ] ] 1 }
  55.  
  56.   if (%post_ [ $+ [ $sockname ] ]) && (<td align="left" >* iswm %r) { return }
  57.   if (%post_ [ $+ [ $sockname ] ]) { echo -at 12Postal Code:1 $httpstrip(%r) $+  | unset %post_ [ $+ [ $sockname ] ] }
  58.   if (*<td align="left">Postal Code</td>* iswm %r) { set -e %post_ [ $+ [ $sockname ] ] 1 }
  59.  
  60.   if (%isp_ [ $+ [ $sockname ] ]) { echo -at 12ISP:1 $httpstrip(%r) $+  | unset %isp_ [ $+ [ $sockname ] ] }
  61.   if (*<td align="left" width="33%">* iswm %r) { set -e %isp_ [ $+ [ $sockname ] ] 1 }
  62. }
  63.  
  64. ON *:SOCKCLOSE:InfoIP_*: {
  65.   .timer[ $+ $sockname $+ ] off
  66.   unset %reg_ [ $+ [ $sockname ] ]
  67.   unset %post_ [ $+ [ $sockname ] ]
  68.   unset %code_ [ $+ [ $sockname ] ]
  69.   unset %country_ [ $+ [ $sockname ] ]
  70.   unset %time_ [ $+ [ $sockname ] ]
  71.   echo -at ***** End of  $+ $sock($sockname).mark $+  IP lookup *****
  72. }
  73.  
  74. alias ipl_error {
  75.   if (!$1) { return }
  76.   echo -at ERROR: There was an connection established problem with the IPL with the $qt($2) ip lookup, try again later!
  77.   if ($sock($1)) { sockclose $1 }
  78. }
  79.  
  80. alias httpstrip {
  81.   var %xx = $replace($1-,&#x26;,$chr(38),$chr(124),-,$chr(125),-,&#125;,-,&#124;,-,&quot;,$chr(34),&amp;,&,&lt;,<,&gt;,>,&nbsp;,$chr(32),&#x26;#039;,$chr(39),$chr(13),$chr(32))
  82.   var %x = $remove(%xx,<![CDATA[,]]>,$chr(2),$chr(4),$chr(9),$chr(31),$chr(22),$chr(29),$chr(10),$chr(13))
  83.   var %i = $regsub(%x,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x)
  84.   return %x
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement