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.
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 » Thu Oct 26, 2017 3:05 pm
This tcl works well but has a detail does not work the option:
no such nick or
dokers No such nick in line 64
proc no:nick { from keyword arguments } {
the option is active but not working
Code: Select all
############################################################################
# BlackIP 1.6
#!ip <ip> / <host> / <nickname>
# - Changed source website
# - Now supports IPv6
# - Now supports eggdrop version less than 1.8.0
#
#To activate .chanset #channel +ip | BlackTools : .set +ip
#
#To work, put the two tcl's in config from the arhive : json.tcl , http.tcl
# (if you don't have them instaled)
#
# BLaCkShaDoW ProductionS
###########################################################################
#Set here who can execute the command (-|- for all)
set ip_flags "-|-"
############################################################################
bind pub $ip_flags !ip black:ip:check
package require http
package require json
setudef flag ip
proc black:ip:check {nick host hand chan arg} {
set ip [lindex [split $arg] 0]
set ::chan $chan
set ::ip $ip
if {![channel get $chan ip]} {
return
}
if {$ip == ""} {
puthelp "NOTICE $nick :\[BlackIP\] USAGE: \002!ip\002 <ip>/\002<host>\002/<nick>"
return
}
set check_ipv6 [regexp {^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$} $ip]
set check_ipv4 [regexp {^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$} $ip]
if {![string match -nocase "*:*" $ip] && ![string match -nocase "*.*" $ip]} {
putquick "WHOIS $ip $ip"
bind raw - 401 no:nick
bind raw - 311 check:for:nick
return
}
if {$check_ipv6 == "0" && $check_ipv4 == "0"} {
set getv6 [catch {exec host -t AAAA $ip 2>/dev/null} results]
set check_ipv6 [regexp {^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$} [lindex $results 4]]
if {$check_ipv6 == "1"} {
check:ip [lindex $results 4] $chan 2 $ip
return
}
dnslookup $ip solve:ip $chan
}
check:ip $ip $chan 0 none
}
proc no:nick { from keyword arguments } {
set chan $::chan
set ip $::ip
puthelp "PRIVMSG $chan :\[\00304$ip\003]\ is not Online."
unbind raw - 401 no:nick
unbind raw - 311 check:for:nick
}
proc solve:ip {ip host receive chan} {
if {$receive == "1"} {
check:ip $ip $chan 2 $host
} else {
puthelp "PRIVMSG $chan :\[\00304X\003\] unable to resolve address \00314$host\003."
}
}
proc solve:nick:ip {ip host receive chan nick} {
if {$receive == "1"} {
check:ip $ip $chan 3 "$host $nick"
} else {
puthelp "PRIVMSG $chan :\[\00304X\003\] unable to resolve address \00314$host\003 from \00303$nick\003."
}
}
proc check:for:nick { from keyword arguments } {
set chan $::chan
set getip [lindex [split $arguments] 3]
set getnick [lindex [split $arguments] 1]
set check_ipv6 [regexp {^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$} $getip]
set check_ipv4 [regexp {^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$} $getip]
if {$check_ipv6 == "0" && $check_ipv4 == "0"} {
set getv6 [catch {exec host -t AAAA $getip 2>/dev/null} results]
set check_ipv6 [regexp {^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$} [lindex $results 4]]
if {$check_ipv6 == "1"} {
check:ip [lindex $results 4] $chan 3 "$getip $getnick"
unbind raw - 311 check:for:nick
unbind raw - 401 no:nick
return
}
dnslookup $getip solve:nick:ip $chan $getnick
unbind raw - 311 check:for:nick
unbind raw - 401 no:nick
return
}
check:ip $getip $chan 0 $getnick
unbind raw - 311 check:for:nick
unbind raw - 401 no:nick
}
proc check:ip {ip chan status arg} {
global botnick
set noinfo 0
set ipq [http::config -useragent "lynx"]
set ipq [::http::geturl "http://ip-api.com/json/$ip"]
set data [http::data $ipq]
::http::cleanup $ipq
set parse [::json::json2dict $data]
set location ""
set hostname ""
set org ""
foreach {name info} $parse {
if {[string equal -nocase $name "hostname"]} {
if {$info != "No Hostname"} {
set hostname $info
}
}
if {[string equal -nocase $name "city"]} {
if {$info != ""} {
lappend location $info
}
}
if {[string equal -nocase $name "regionName"]} {
if {$info != ""} {
lappend location $info
}
}
if {[string equal -nocase $name "country"]} {
if {$info != ""} {
lappend location $info
}
}
if {[string equal -nocase $name "org"]} {
if {$info != ""} {
set org $info
}
}
if {[string equal -nocase $name "status"]} {
if {$info != ""} {
if {$info == "fail"} {
set noinfo 1
}
}
}
}
if {$noinfo == "1"} {
return
}
if {$org != ""} {
set org_text "|\00302 ORG: \00310$org\003"
} else { set org_text "" }
set location [join $location ", "]
if {$status != 0} {
if {$status == "1"} {
if {$hostname != ""} {
putserv "PRIVMSG $chan :\00302NickName: \00303$arg\003 | \00302Ip: \00304$ip\003 | \00302Host: \00304$hostname\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
} else {
putserv "PRIVMSG $chan :\00302NickName: \00303$arg\003 | \00302Ip: \00304$ip\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
}
}
if {$status == "2"} {
putserv "PRIVMSG $chan :\00302Host: \00306$arg\003 | \00302Ip: \00304$ip\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
}
if {$status == "3"} {
putserv "PRIVMSG $chan :\00302NickName: \00303[lindex [split $arg] 1]\003 | \00302Host: \00306[lindex [split $arg] 0]\003"
if {$hostname != ""} {
putserv "PRIVMSG $chan :\00302Ip: \00304$ip\003 | \00302Host: \00304$hostname\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
} else {
putserv "PRIVMSG $chan :\00302Ip: \00304$ip\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
}
}
} else {
if {$hostname != ""} {
putserv "PRIVMSG $chan :\00302Ip: \00304$ip\003 | \00302Host: \00304$hostname\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
} else {
putserv "PRIVMSG $chan :\00302Ip: \00304$ip\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
}
}
}
putlog "BlackIP 1.6 (IPv6 support) by BLaCkShaDoW Loaded"
BLaCkShaDoW
Op
Posts: 120 Joined: Sun Jan 11, 2009 4:50 am
Location: Romania
Contact:
Post
by BLaCkShaDoW » Fri Oct 27, 2017 2:44 am
Hello
Please change within the script
to
That should do the trick
Good Day.
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 » Fri Oct 27, 2017 4:45 pm
Thanks bro
perfect.
Code: Select all
############################################################################
# BlackIP 1.6
#!ip <ip> / <host> / <nickname>
# - Changed source website
# - Now supports IPv6
# - Now supports eggdrop version less than 1.8.0
#
#To activate .chanset #channel +ip | BlackTools : .set +ip
#
#To work, put the two tcl's in config from the arhive : json.tcl , http.tcl
# (if you don't have them instaled)
#
# BLaCkShaDoW ProductionS
###########################################################################
#Set here who can execute the command (-|- for all)
set ip_flags "-|-"
############################################################################
bind pub $ip_flags !ip black:ip:check
package require http
package require json
setudef flag ip
proc black:ip:check {nick host hand chan arg} {
set ip [lindex [split $arg] 0]
set ::chan $chan
set ::ip $ip
if {![channel get $chan ip]} {
return
}
if {$ip == ""} {
puthelp "NOTICE $nick :\[BlackIP\] USAGE: \002!ip\002 <ip>/\002<host>\002/<nick>"
return
}
set check_ipv6 [regexp {^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$} $ip]
set check_ipv4 [regexp {^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$} $ip]
if {![string match -nocase "*:*" $ip] && ![string match -nocase "*.*" $ip]} {
putquick "WHOIS $ip"
bind raw - 401 no:nick
bind raw - 311 check:for:nick
return
}
if {$check_ipv6 == "0" && $check_ipv4 == "0"} {
set getv6 [catch {exec host -t AAAA $ip 2>/dev/null} results]
set check_ipv6 [regexp {^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$} [lindex $results 4]]
if {$check_ipv6 == "1"} {
check:ip [lindex $results 4] $chan 2 $ip
return
}
dnslookup $ip solve:ip $chan
}
check:ip $ip $chan 0 none
}
proc no:nick { from keyword arguments } {
set chan $::chan
set ip $::ip
puthelp "PRIVMSG $chan :\[\00304$ip\003]\ is not Online."
unbind raw - 401 no:nick
unbind raw - 311 check:for:nick
}
proc solve:ip {ip host receive chan} {
if {$receive == "1"} {
check:ip $ip $chan 2 $host
} else {
puthelp "PRIVMSG $chan :\[\00304X\003\] unable to resolve address \00314$host\003."
}
}
proc solve:nick:ip {ip host receive chan nick} {
if {$receive == "1"} {
check:ip $ip $chan 3 "$host $nick"
} else {
puthelp "PRIVMSG $chan :\[\00304X\003\] unable to resolve address \00314$host\003 from \00303$nick\003."
}
}
proc check:for:nick { from keyword arguments } {
set chan $::chan
set getip [lindex [split $arguments] 3]
set getnick [lindex [split $arguments] 1]
set check_ipv6 [regexp {^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$} $getip]
set check_ipv4 [regexp {^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$} $getip]
if {$check_ipv6 == "0" && $check_ipv4 == "0"} {
set getv6 [catch {exec host -t AAAA $getip 2>/dev/null} results]
set check_ipv6 [regexp {^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$} [lindex $results 4]]
if {$check_ipv6 == "1"} {
check:ip [lindex $results 4] $chan 3 "$getip $getnick"
unbind raw - 311 check:for:nick
unbind raw - 401 no:nick
return
}
dnslookup $getip solve:nick:ip $chan $getnick
unbind raw - 311 check:for:nick
unbind raw - 401 no:nick
return
}
check:ip $getip $chan 0 $getnick
unbind raw - 311 check:for:nick
unbind raw - 401 no:nick
}
proc check:ip {ip chan status arg} {
global botnick
set noinfo 0
set ipq [http::config -useragent "lynx"]
set ipq [::http::geturl "http://ip-api.com/json/$ip"]
set data [http::data $ipq]
::http::cleanup $ipq
set parse [::json::json2dict $data]
set location ""
set hostname ""
set org ""
foreach {name info} $parse {
if {[string equal -nocase $name "hostname"]} {
if {$info != "No Hostname"} {
set hostname $info
}
}
if {[string equal -nocase $name "city"]} {
if {$info != ""} {
lappend location $info
}
}
if {[string equal -nocase $name "regionName"]} {
if {$info != ""} {
lappend location $info
}
}
if {[string equal -nocase $name "country"]} {
if {$info != ""} {
lappend location $info
}
}
if {[string equal -nocase $name "org"]} {
if {$info != ""} {
set org $info
}
}
if {[string equal -nocase $name "status"]} {
if {$info != ""} {
if {$info == "fail"} {
set noinfo 1
}
}
}
}
if {$noinfo == "1"} {
return
}
if {$org != ""} {
set org_text "|\00302 ORG: \00310$org\003"
} else { set org_text "" }
set location [join $location ", "]
if {$status != 0} {
if {$status == "1"} {
if {$hostname != ""} {
putserv "PRIVMSG $chan :\00302NickName: \00303$arg\003 | \00302Ip: \00304$ip\003 | \00302Host: \00304$hostname\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
} else {
putserv "PRIVMSG $chan :\00302NickName: \00303$arg\003 | \00302Ip: \00304$ip\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
}
}
if {$status == "2"} {
putserv "PRIVMSG $chan :\00302Host: \00306$arg\003 | \00302Ip: \00304$ip\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
}
if {$status == "3"} {
putserv "PRIVMSG $chan :\00302NickName: \00303[lindex [split $arg] 1]\003 | \00302Host: \00306[lindex [split $arg] 0]\003"
if {$hostname != ""} {
putserv "PRIVMSG $chan :\00302Ip: \00304$ip\003 | \00302Host: \00304$hostname\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
} else {
putserv "PRIVMSG $chan :\00302Ip: \00304$ip\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
}
}
} else {
if {$hostname != ""} {
putserv "PRIVMSG $chan :\00302Ip: \00304$ip\003 | \00302Host: \00304$hostname\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
} else {
putserv "PRIVMSG $chan :\00302Ip: \00304$ip\003 |\00302 Location: \00314$location\003 |\00302 ORG: \00310$org\003"
}
}
}
putlog "BlackIP 1.6 (IPv6 support) by BLaCkShaDoW Loaded"
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 » Sat Mar 03, 2018 10:03 am
new error
in partyline
this error only appears when a nickname has special characters
example the nickname .ip
{N}ick
Code: Select all
[13:59:16] Tcl error [bc_whois]: list element in braces followed by "ick" instead of space
the good thing is that it gives result of the request
Code: Select all
<@Kantuta> 02NickName: 03{N}ick | 02Host: 06scz-190-104-20-00214.wimaxtigo.bo
<@Kantuta> 02Ip: 04190.104.20.214 |02 Location: 14Santa Cruz, Bolivia, Departamento de Santa Cruz |02 ORG: 10Telefónica Celular de Bolivia S.A.
some solution for nicknames with special characters
BLaCkShaDoW
Op
Posts: 120 Joined: Sun Jan 11, 2009 4:50 am
Location: Romania
Contact:
Post
by BLaCkShaDoW » Sun Mar 04, 2018 8:31 am
The "bc_whois" procedure isn't part of the BlackIP TCL. It's another procedure from another tcl loaded in your eggdrop that responds to the RAW for WHOIS <nick>. I guess bc_whois stands for bad chan whois..but it's a guess
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 » Mon Mar 05, 2018 12:50 pm
if correct is another tcl... badchan
friend can help me
and if the details is when a nickname uses special characters
when it's a common nickname the tcl works very well
example :
{N}ick
* {N}ick (~ix@181.188.139.21) has joined #beni2
Code: Select all
pbind RAW - 319 bc_whois
proc bc_whois {from key arg} {
global botnick bchan bcqueue bcnicks chanbadtimerz banmask
set arg [join $arg]
set nick [lindex $arg 1]
if {[info exists bcnicks($nick)]} {set chan $bcnicks($nick)} {return 0}
set chans [string tolower [lrange $arg 2 e]]
if {[lsearch $bchan(exempt) $chan] == -1 && $bchan(global) != ""} {set bans $bchan(global)} {set bans ""}
if {[lsearch $bchan(chans) $chan] > -1} {set bans "$bans $bchan($chan)"}
foreach onchansbns [channels] {
if {[onchan $nick $onchansbns] && ($nick != $botnick)} {
set banmask [bmaskhost [getchanhost $nick $onchansbns]]
foreach tok $chans {
set tok [string trimleft $tok ":@+"]
foreach ban $bans {
if {[string match [lindex $ban 0] $tok]} {
newchanban $onchansbns $banmask badchan "[lrange $ban 1 e]" $chanbadtimerz ;
break
}
}
}
}
}
}
Ezekiel
Voice
Posts: 21 Joined: Tue Dec 16, 2014 8:05 am
Post
by Ezekiel » Tue Mar 06, 2018 1:45 am
you should check, because there is a new version of this tcl already released: BlackIP.tcl 1.7. Search it on BlackShadoW's official website or tclarchive...
----
(07:46:22 AM) <@tester> !ip {N}ick
(07:46:24 AM) <@lamestbot> Nick: {N}ick | Host: using.blacktools.systems
(07:46:25 AM) <@lamestbot> IP: 2607:fcd0:106
:de6b:d0d6 | Localizacion: Los Angeles, United States, California | ORG: QuadraNet
----
works well, no more DCC error..