| View previous topic :: View next topic |
| Author |
Message |
BhasIRC Voice
Joined: 02 Jan 2010 Posts: 27 Location: south africa
|
Posted: Mon Jan 04, 2010 2:53 pm Post subject: ip lookup |
|
|
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 |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Mon Jan 04, 2010 5:46 pm Post subject: Re: ip lookup |
|
|
| 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
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: | # 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  _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
BhasIRC Voice
Joined: 02 Jan 2010 Posts: 27 Location: south africa
|
Posted: Mon Jan 04, 2010 6:42 pm Post subject: |
|
|
| 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 |
|
 |
BhasIRC Voice
Joined: 02 Jan 2010 Posts: 27 Location: south africa
|
Posted: Mon Jan 04, 2010 6:43 pm Post subject: |
|
|
| when i said this is my code i ment this is my code as in here it is lol anyways thanks |
|
| Back to top |
|
 |
|
|
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
|
|