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.
Help for those learning Tcl or writing their own scripts.
-
nobody
- Voice
- Posts: 19
- Joined: Fri Apr 03, 2020 10:01 pm
Post
by nobody »
sysusr wrote:Forgot to reply back. Script works flawless now. Thank you
can you post the complete working script here bro , if you don't mind?
ππ
·π
΄π
½ π
½π
Ύππ
·π
Έπ
½π
Ά π
Άπ
Ύπ
΄π ππ
Έπ
Άπ
·π, π
Άπ
Ύ π
»π
΄π
΅π!
-
simo
- Revered One
- Posts: 1108
- Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo »
Code: Select all
package require http
package require json
bind pub m|- !ginfo Pub:Geo:INFO
proc Pub:Geo:INFO {nick uhost hand chan text} {
if {[scan $text {%s} lookup] != 1} {
puthelp "NOTICE $nick :Error, syntax is: !Ginfo <ip>"
return
}
if {![regexp {([0-9]+\.)([0-9]+\.)([0-9]+\.)([0-9]+)} $lookup]} {
puthelp "NOTICE $nick :Error, the IP you mentioned is not valid."
return
}
catch {set http [::http::geturl http://ipinfo.io/$lookup/json -timeout 6000]} error
set data [::http::data $http]
set json [::json::json2dict $data]
::http::cleanup $http
set keys [dict keys $json]
foreach ele {ip hostname city region country loc postal phone org} {
set $ele [expr {[lsearch $keys $ele] > -1 ? [dict get $json $ele] : "n/a"}]
}
puthelp "NOTICE $nick :IP: $ip - Hostname: $hostname - City: $city - Region: $region - Country: $country - Location: $loc - Organization: $org"
}
-
caesar
- Mint Rubber
- Posts: 3778
- Joined: Sun Oct 14, 2001 8:00 pm
- Location: Mint Factory
Post
by caesar »
And the version that uses
ip library to do the IP v4 and v6 validation rather than that regexp that won't match IP v6:
Code: Select all
package require http
package require json
package require ip
bind raw - NOTICE server:notices
proc server:notices {from keyword text} {
if {![string match -nocase "*client connecting*" $text]} return
set lookup [lindex [split $text] 6]
if {[::ip::version $lookup] < 4} return
catch {set http [::http::geturl http://ipinfo.io/$lookup/json -timeout 6000]} error
set data [::http::data $http]
set json [::json::json2dict $data]
::http::cleanup $http
set keys [dict keys $json]
foreach ele {ip hostname city region country loc postal phone org} {
set $ele [expr {[lsearch $keys $ele] > -1 ? [dict get $json $ele] : "n/a"}]
}
puthelp "PRIVMSG #Opers :$nick - $ip - $country"
}
Once the game is over, the king and the pawn go back in the same box.
-
nobody
- Voice
- Posts: 19
- Joined: Fri Apr 03, 2020 10:01 pm
Post
by nobody »
this is good for ircop?
ππ
·π
΄π
½ π
½π
Ύππ
·π
Έπ
½π
Ά π
Άπ
Ύπ
΄π ππ
Έπ
Άπ
·π, π
Άπ
Ύ π
»π
΄π
΅π!
-
nobody
- Voice
- Posts: 19
- Joined: Fri Apr 03, 2020 10:01 pm
Post
by nobody »
how to see errors?
<guy> witch rehash
-witch- Reloading scripts/settings..
<guy> !test
-witch- Error, syntax is: !Ginfo <ip>
<guy> !test 1.1.1.1
- no response at all im currently using blackip.tcl using ip-info.com service but i found ipinfo.io near to accurate.
ππ
·π
΄π
½ π
½π
Ύππ
·π
Έπ
½π
Ά π
Άπ
Ύπ
΄π ππ
Έπ
Άπ
·π, π
Άπ
Ύ π
»π
΄π
΅π!
-
BLaCkShaDoW
- Op
- Posts: 120
- Joined: Sun Jan 11, 2009 4:50 am
- Location: Romania
-
Contact:
Post
by BLaCkShaDoW »
Hello, why do you say that ipinfo.io is more accurate then the the source from BlackIP.tcl ?
-
nobody
- Voice
- Posts: 19
- Joined: Fri Apr 03, 2020 10:01 pm
Post
by nobody »
good morning, because that's my opinion when i tried checking the ip on both website.
ππ
·π
΄π
½ π
½π
Ύππ
·π
Έπ
½π
Ά π
Άπ
Ύπ
΄π ππ
Έπ
Άπ
·π, π
Άπ
Ύ π
»π
΄π
΅π!
-
caesar
- Mint Rubber
- Posts: 3778
- Joined: Sun Oct 14, 2001 8:00 pm
- Location: Mint Factory
Post
by caesar »
The command is !ginfo ip not !test ip, unless you changed the command from !ginfo to !test.
Once the game is over, the king and the pawn go back in the same box.