egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ip lookup

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
BhasIRC
Voice


Joined: 02 Jan 2010
Posts: 27
Location: south africa

PostPosted: Mon Jan 04, 2010 2:53 pm    Post subject: ip lookup Reply with quote

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:
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
Back to top
View user's profile Send private message Visit poster's website
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Mon Jan 04, 2010 5:46 pm    Post subject: Re: ip lookup Reply with quote

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:
#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... Sad

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:
# 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 Wink
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
BhasIRC
Voice


Joined: 02 Jan 2010
Posts: 27
Location: south africa

PostPosted: Mon Jan 04, 2010 6:42 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
BhasIRC
Voice


Joined: 02 Jan 2010
Posts: 27
Location: south africa

PostPosted: Mon Jan 04, 2010 6:43 pm    Post subject: Reply with quote

when i said this is my code i ment this is my code as in here it is lol anyways thanks
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber