Ip Check for Eggdrop

By FordLawnmower on Jun 20, 2011

This script grabs some ip information from www.melissadata.com and returns it to irc.
Default trigger is: !ipinfo
Syntax: !ipinfo 1.2.3.4
Chanset: +ipinfo
ScreenShot: Image

##############################################################################################
##  ## Ipinfo.tcl for eggdrop by Ford_Lawnmower irc.geekshed.net #Script-Help    ##  ##
##############################################################################################
##   To use this script you must set channel flag +ipinfo (ie .chanset #chan +ipinfo)     ##
##############################################################################################
##############################################################################################
##  ##                             Start Setup.                                         ##  ##
##############################################################################################
## Change the character between the "" below to change the command character/trigger.       ##
set Ipinfocmdchar "!"
proc Ipinfo {nick host hand chan search} {
  if {[lsearch -exact [channel info $chan] +ipinfo] != -1} {
## Change the format codes between the "" below to change the color/state of the text.      ##
    set titlef "\0034"
    set textf "\003\002"
##  Change ipinforesults to the order and results you want posted to the channel.           ##
    set ipinforesults "ip host country city state area postal isp"
##############################################################################################
##  ##                           End Setup.                                              ## ##
##############################################################################################
    set country ""
    set city ""
    set state ""
    set area ""
    set postal ""
    set isp ""
    set host ""
    set ip ""
    set Ipinfosite "whatismyipaddress.com"
    if {$search == ""} { 
    putserv "PRIVMSG $chan :${textf}You must provide an ip address to check!"
    } else {
      set Ipinfourl "/ip/${search}"
      if {[catch {set Ipinfosock [socket -async $Ipinfosite 80]} sockerr]} {
        putlog "$Ipinfosite $Ipinfourl $sockerr error"
        return 0
      } else {
        puts $Ipinfosock "GET $Ipinfourl HTTP/1.0"
        puts $Ipinfosock "Host: $Ipinfosite"
        puts $Ipinfosock "User-Agent: Opera 9.6"
        puts $Ipinfosock ""
        flush $Ipinfosock
        while {![eof $Ipinfosock]} {
          set Ipinfovar " [gets $Ipinfosock] "
          putlog $Ipinfovar
       if {[regexp {<div align='center' class='Lookupserror'>([^<]*)<b>([^<]*)<\/b>([^<]*)<br>([^<]*)<\/div>} $Ipinfovar]} {
         putserv "PRIVMSG $chan : ${titlef}Syntax error: ${textf}Ip must be in the form of 1.2.3.4"
         close $Ipinfosock
            return 0
       } elseif {[regexp -nocase {ISP\:<[^<]*><[^<]*>([^<]*)<} $Ipinfovar match isp]} {
         set isp "${titlef}ISP:\017${textf}[ipinforecode $isp]"
            if {[regexp -nocase {Hostname\:<[^<]*><[^<]*>([^<]*)<} $Ipinfovar match host]} {
              set host "${titlef}Host:\017${textf}[ipinforecode $host]"
            }
            if {[regexp -nocase {IP\:<[^<]*><[^<]*>([^<]*)<} $Ipinfovar match ip]} {
              set ip "${titlef}IP:\017${textf}[ipinforecode $ip]"
            }
          } elseif {[regexp -nocase {Country\:<[^<]*><[^<]*>([^<]*)<} $Ipinfovar match country]} {
         set country "${titlef}Country:\017${textf}[ipinforecode $country]"
          } elseif {[regexp -nocase {State\/Region\:<[^<]*><[^<]*>([^<]*)<} $Ipinfovar match state]} {
         set state "${titlef}State:\017${textf}[ipinforecode $state]"
          } elseif {[regexp -nocase {City\:<[^<]*><[^<]*>([^<]*)<} $Ipinfovar match city]} {
         set city "${titlef}City:\017${textf}[ipinforecode $city]"
          } elseif {[regexp -nocase {Area\sCode\:<[^<]*><[^<]*>([^<]*)<} $Ipinfovar match area]} {
         set area "${titlef}Area Code:\017${textf}[ipinforecode $area]"
          } elseif {[regexp -nocase {Postal\sCode\:<[^<]*><[^<]*>([^<]*)<} $Ipinfovar match postal]} {
         set postal "${titlef}Postal Code:\017${textf}[ipinforecode $postal]"
          } elseif {[regexp -nocase {<\/body>} $Ipinfovar]} {
            putserv "PRIVMSG $chan : [subst [regsub -all -nocase {(\S+)} $ipinforesults {$\1}]]"
       }
        }
        close $Ipinfosock
        return 0 
      }
    }
  }
}
proc ipinforecode { textin } {
  return [subst [regsub -nocase -all {&#([0-9]{1,5});} $textin {\u\1}]]
}
bind pub - ${Ipinfocmdchar}ipinfo Ipinfo
setudef flag ipinfo
putlog "Ipinfo Script v 1.3 by Ford_Lawnmower successfully loaded! irc.geekshed.net #Script-Help"

Comments

Sign in to comment.
fahadmehar   -  Oct 26, 2016

Make it short " !ip "

 Respond  
FordLawnmower   -  Nov 30, 2014

Updated

anotherrace  -  Dec 07, 2014

yay!

Sign in to comment

nutty   -  Aug 21, 2014

tested in 1.8 works like a charm :)

 Respond  
RIcko   -  Jun 29, 2012

Looks like we have a fan, but still .. he have no right to use it

 Respond  
Jethro   -  Jun 29, 2012

Off topic here, Ford. Have you guys noticed sedotz used mIRC creator's picture as his or her avatar? lol I know that ain't Khaled because of his English and its grammar.

 Respond  
RIcko   -  Jun 29, 2012

Any other way of making it look like Napa's one for mIRC?

Im actually an admin in a server and i need this for a quick lookup (a one line lookup)

 Respond  
RIcko   -  Jun 27, 2012

@FordLawnmower, i used that one before but it used to give wrong info from time to time when i tested the results both in the dialog and http://www.ip-adress.com/ip_tracer/

 Respond  
FordLawnmower   -  Jun 27, 2012

@RIcko this script has some extra stuff but will also do the bot portion you see here: http://www.hawkee.com/snippet/6073/

 Respond  
RIcko   -  Jun 27, 2012

This one has more specific info, i wish it was made for mIRC :/

 Respond  
iDLE   -  Apr 19, 2012

Tcl error [Ipinfo]: list element in quotes followed by """ instead of space

Any idea? :(

 Respond  
sedotz   -  Apr 02, 2012

is this still work ?? cos i can load the tcl but no respon at all

 Respond  
napa182   -  Feb 20, 2012

lol @ Xpl0reR
The output for the one I made for msl is as so

<@napa182> @ipl 113.10.164.138
<&Sick0> :[IP Address]: 113.10.164.138 :[City]: Hong Kong :[State or Region]: Hong Kong (Sar) :[Country]: Hong Kong :[ISP]: NWT IDC Data Service. :[Latitude & Longitude]: 22.247860 114.203384 :[Domain]: 10-EASYLINK.NET.HK

it's not hard to make it into one line as most people can change it to do so.

 Respond  
xplo   -  Feb 20, 2012

It would be nice to have all of this in a single line of text and not spamming channels with all those lines.
10/10 as usual. nice script.

 Respond  
H2O   -  Sep 01, 2011

FordLawnmower great work as always. i run a few of your scripts. great work man!

 Respond  
irchainscriptz   -  Jun 30, 2011

yup nice work many ppl on koach.com will love this snippet. 10/10

 Respond  
FordLawnmower   -  Jun 29, 2011

Thanks Walkman :)

 Respond  
Walkman   -  Jun 27, 2011

wow nice , gud job fordlawnmower :)

 Respond  
FordLawnmower   -  Jun 22, 2011

Thanks napa182 :)

 Respond  
napa182   -  Jun 21, 2011

Nice work Ford. I had made a IP look up using that same web site in msl awhile ago. It seems to get the data right for the most part. again nice work. 9/10 +like
the only thing i didn't use was the zip code in mine, but i did include the latitude & longitude.

 Respond  
FordLawnmower   -  Jun 21, 2011

@stop I do not have a full script posted.
I do have this addon for mIRC to help with eggdrop connections : http://www.hawkee.com/snippet/7785/
Thanks Aha2Y :)

 Respond  
Jordyk19   -  Jun 21, 2011

Very nice, as always.

 Respond  
stop   -  Jun 21, 2011

FordLawnmower: what iRC are you using? can i download it too? hehe.

 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.