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 finder

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

ip finder

Post by Arnold_X-P »

Please I need help in the repair of this tcl does not generate the requested information

Code: Select all

bind pub - .ip msg_ipwhois
proc msg_ipwhois {nick uhost hand chan text} {
  global botnick
  if {$text == "" } {putquick "PRIVMSG $chan :You have to use true command for look up whois information. Command: !ip ipnumber";return}
        if {[string match -nocase "*" $text]} {
  set connect [::http::geturl http://whatismyipaddress.com/ip/$text]
  set files [::http::data $connect]
  ::http::cleanup $files
    regexp -- {ISP:</th><td>(.*?)</td></tr><tr><th>Organization} $files - isp
    regexp -- {Country:</th><td>(.*?) <img src=} $files - country
    regexp -- {Hostname:</th><td>(.*?)</td></tr>} $files - hostname
    regexp -- {State/Region:</th><td>(.*?)</td></tr>} $files - state
    regexp -- {City:</th><td>(.*?)</td></tr>} $files - city
if {[info exists country]} {
        puthelp "privmsg $chan :IP: $text - ISP: $isp - Hostname: $hostname - Country: $country"
if {[info exists state]} {
        puthelp "privmsg $chan :State: $state - City: $city"
 }

 } else {  puthelp "privmsg $chan :Invalid address or IP not found" }

   }
}
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
CrazyCat
Revered One
Posts: 1236
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

The website has changed, now the regex must look like:

Code: Select all

regexp -- {<p class="information"><span>Hostname:</span><span>(.+)</span>} $files - hostname
regexp -- {<p class="information"><span>ISP:</span><span>(.+)</span>} $files - isp
regexp -- {<p class="information"><span>State/Region:</span><span>(.+)</span>} $files - state
regexp -- {<p class="information"><span>Country:</span><span>(.+)</span>} $files - country
regexp -- {<p class="information"><span>City:</span><span>(.+)</span>} $files - city
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

thanks crazycat
something is wrong

Code: Select all

[16:35] <@Arnold_X-P> .ip 200.87.208.0
[16:35] <@reebot> Invalid address or IP not found
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
CrazyCat
Revered One
Posts: 1236
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Because this website now use https.
Load tls package and register https, change the url to use https.

And some other providers of info about IP have an api returning json, which is easier to use in tcl. You'd better use one of them. A little search in the forum may give you some results of working scripts.
Post Reply