This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

ip lookup

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
B
BhasIRC
Voice
Posts: 27
Joined: Sat Jan 02, 2010 7:05 am
Location: south africa
Contact:

ip lookup

Post by BhasIRC »

ok see this script should give me the state the ip comes from the country the isp of the ip but it just gives me the country this is my code

Code: Select all

bind pub -|- !whereis whereis 
setudef flag whereis 
package require http 

# Set your filtered list here with or without wildcards, 
# only these will be displayed and the order you choose 
# here is the exact order in which it will be output. To 
# display everything, all the site has to offer and see 
# what there is to choose from, use a single wildcard, 
# "*", in the list below. 

variable whereisFilter [list "city:" "country:"] 

proc whereis {nick uhost hand chan text} { 
   # flag 
   # useragent 
   ::http::config -useragent "Mozilla/5.0 ; Gecko" 
   # geturl, with error handler 
   catch { set http [::http::geturl "http://www.ip-adress.com/ip_tracer/$text" -timeout 5000] } error 
   # error condition 1: invalid http session 
   if {![string match -nocase "::http::*" $error]} { 
      putserv "privmsg $chan :[string totitle $error] \( http://www.ip-adress.com/ip_tracer/$text \)" 
      return 0 
   } 
   # error condition 2: http error 
   if {![string equal -nocase [::http::status $http] "ok"]} { 
      putserv "privmsg $chan :[string totitle [::http::status $http]] \( http://www.ip-adress.com/ip_tracer/$text \)" 
      return 0 
   } 
   # no error, get data 
   set data [::http::data $http] 
   # cleanup http token 
   ::http::cleanup $http 
   # cleanse html for parsing 
   regsub -all {\[<.*?>\]} $data "" data 
   regsub -all "<script.*?>.*?</script>" $data "" data 
   regsub -all "<a href.*?</a>" $data "" data 
   regsub -all "<img src=.*?>" $data "" data 
   regsub -all {(?:\n|\t|\v|\r|</span>)} $data "" data 
   regsub -all {<span.*?>} $data "" data 
   # can we retrieve table fields? 
   while {[regexp -nocase -- {<th>(.*?)</th>.*?<td>(.*?)</td>} $data x type attrib]} { 
      lappend output "[string totitle [string trim [string map {"IP country code" "country code" "IP address" " "} $type]]] [string trim $attrib]" 
      regsub -nocase -- {<th>.*?</th>.*?<td>.*?</td>} $data "" data 
   } 
   # do we have output? 
   if {[info exists output]} { 
     # yes, determine what exactly to output... 
     foreach entry $::whereisFilter { 
        foreach attribute $output { 
           # does the attribute match any filter masks? 
           if {[string match -nocase $entry [lindex [split $attribute] 0]]} { 
              # yes, add to spam list 
              lappend spamline $attribute 
           } 
        } 
      } 
      # was a spam list created? 
      if {[info exists spamline]} { 
         # if created, does it have any contents? 
         if {[llength $spamline]} { 
            # yes, spam first 9 
            puthelp "privmsg $chan :[join [lrange $spamline 0 8] " ~ "]" 
            # more than 9? 
            if {[llength $spamline] > 15} { 
               # yes, spam the rest 
               puthelp "privmsg $chan :[join [lrange $spamline 9 [llength $spamline]] " ~ "]" 
            } 
         } 
      } else { 
         # we have output but nothing in the spam list, declare 
         puthelp "privmsg $chan :$text returns some useful information for me to reply with, but filtering is preventing me from showing you... ;/" 
      } 
   } else { 
      # we have no output at all, declare 
      puthelp "privmsg $chan :$text returns no useful information for me to reply with... ;/" 
   } 
# eof 
}
Thanks In Advance
Zainul
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Re: ip lookup

Post by speechles »

BhasIRC wrote:ok see this script should give me the state the ip comes from the country the isp of the ip but it just gives me the country this is my code

Code: Select all

#snipped code#
Thanks In Advance
Zainul
Um, your code... are you serious? Because my good sir, your either lying, exaggerating, or you've simply made a mistake meaning "my code" as in what your using, not "my code" as in code you've written. FYI, it's my code and you've ripped all credits from it... :(

The reason you don't get a city is because your over-quota (free mode is 5 queries per day). The new version of _MY_ script supports multiple accounts (free or pay) and all sorts of crazy action missles (aka features galore).

Code: Select all

# Whereis IP geolocation scrape script (v1.4)
# by speechles - Proof-of-concept 
# :: November 27, 2009
# -- Cookies / Referer / 302 Redirects ---
From this thread: http://forum.egghelp.org/viewtopic.php?t=16823&start=37
From this link: http://ereader.kiczek.com/whereis.tcl
From this guy: me ;)
B
BhasIRC
Voice
Posts: 27
Joined: Sat Jan 02, 2010 7:05 am
Location: south africa
Contact:

Post by BhasIRC »

its not my code at all its a code i downloaded sorry if i some how made u feel it was mine i am new to tcl
B
BhasIRC
Voice
Posts: 27
Joined: Sat Jan 02, 2010 7:05 am
Location: south africa
Contact:

Post by BhasIRC »

when i said this is my code i ment this is my code as in here it is lol anyways thanks
Post Reply