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 

BlackIP 1.6 by BLaCkShaDoW

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 166
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Thu Oct 26, 2017 3:05 pm    Post subject: BlackIP 1.6 by BLaCkShaDoW Reply with quote

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:
############################################################################
# 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"

_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
BLaCkShaDoW
Halfop


Joined: 11 Jan 2009
Posts: 94
Location: Romania

PostPosted: Fri Oct 27, 2017 2:44 am    Post subject: BlackIP 1.6 by BLaCkShaDoW Reply with quote

Hello
Please change within the script
Code:
putserv "WHOIS $ip $ip"

to
Code:
putserv "WHOIS $ip"


That should do the trick
Good Day.
_________________
BLaCkShaDoW Productions @ WwW.TclScripts.Net
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 166
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Fri Oct 27, 2017 4:45 pm    Post subject: Re: BlackIP 1.6 by BLaCkShaDoW Reply with quote

Thanks bro Smile perfect.

Code:
############################################################################
# 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"

_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 166
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sat Mar 03, 2018 10:03 am    Post subject: Re: BlackIP 1.6 by BLaCkShaDoW Reply with quote

new error
in partyline
this error only appears when a nickname has special characters
example the nickname .ip {N}ick
Code:

[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:
 <@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
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
BLaCkShaDoW
Halfop


Joined: 11 Jan 2009
Posts: 94
Location: Romania

PostPosted: Sun Mar 04, 2018 8:31 am    Post subject: Re: BlackIP 1.6 by BLaCkShaDoW Reply with quote

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 Razz
_________________
BLaCkShaDoW Productions @ WwW.TclScripts.Net
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 166
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Mon Mar 05, 2018 12:50 pm    Post subject: Re: BlackIP 1.6 by BLaCkShaDoW Reply with quote

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:
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
     }
    }
   }
  }
 }
}

_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Ezekiel
Voice


Joined: 16 Dec 2014
Posts: 12

PostPosted: Tue Mar 06, 2018 1:45 am    Post subject: Reply with quote

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:3204::de6b:d0d6 | Localizacion: Los Angeles, United States, California | ORG: QuadraNet
----

works well, no more DCC error..
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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