View previous topic :: View next topic |
Author |
Message |
Arnold_X-P Op

Joined: 30 Oct 2006 Posts: 178 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Tue Jan 23, 2018 5:25 pm Post subject: tcl recognizes with temporary access for nicks |
|
|
this tcl recognizes with temporary access to the one who gives him a password..
the error it gives in partyline
Code: | [16:01:44] Tcl error [pRecogniseCommand]: invalid command name "addhost" |
Some friend who can help me.
Code: | # recognise.tcl for arfer DALnet channel #atlantis
# ------------------------------------------------------------------------------------------------------------------- #
# -------------------- syntax --------------------------------------------------------------------------------------- #
# syntax assuming default command 'recognise'
# /msg <botnick> recognise <password>
# ------------------------------------------------------------------------------------------------------------------- #
# -------------------- configuration -------------------------------------------------------------------------------- #
# set here the \msg command to use
set vRecogniseCommand "access"
# set here the password, only a - z, A - Z, 0 - 9 (6 characters minimum)
set vRecognisePassword "PaSSord27"
# set here how long in minutes the bot should recognise you 180 min. = 3 hours
set vRecogniseTime 180
# ------------------------------------------------------------------------------------------------------------------- #
# -------------------- code ----------------------------------------------------------------------------------------- #
set vRecogniseVersion 1.0
bind MSG - $vRecogniseCommand pRecogniseCommand
proc pRecogniseCommand {nick uhost hand text} {
global vRecognisePassword
if {[regexp -nocase -- {^[a-z0-9]{6,}$} $vRecognisePassword]} {
set arguments [regsub -all -- {\s{2,}} [stripcodes bcruag [string trim $text]] { }]
if {[llength [split $arguments]] == 1} {
if {[string equal $arguments $vRecognisePassword]} {
if {[onchan $nick]} {
pRecognisePromote $nick $uhost
} else {pRecogniseOutput 001 $nick $hand 0}
} else {pRecogniseOutput 002 $nick $hand $arguments}
} else {pRecogniseOutput 003 $nick $hand 0}
} else {pRecogniseOutput 004 $nick $hand 0}
return 0
}
proc pRecogniseOutput {number nick hand xtra1} {
global vRecogniseCommand vRecogniseTime
switch -- $number {
001 {set output "-error- you must be on a bot channel to use this command"}
002 {set output "-error- password $xtra1 not recognised"}
003 {set output "-error- correct usage /msg <botnick> $vRecogniseCommand <password>"}
004 {set output "-error- incorrectly configured password in script"}
005 {set output "a new userfile record has been temporarily created giving you +n (global owner status). it will be deleted $vRecogniseTime minutes from now"}
006 {set output "the flag +n (global owner status) has been temporarily granted in your userfile record. it will be rescinded $vRecogniseTime minutes from now"}
007 {set output "you are already recognised by the handle $hand as having +n (global owner status)"}
008 {set output "a temporary host $xtra1 has been added to your userfile record giving you +n (global owner status). it will be removed $vRecogniseTime minutes from now"}
default {}
}
putserv "NOTICE $nick :$output"
return 0
}
proc pRecognisePromote {nick uhost} {
global vRecogniseTime
scan $uhost {%[^@]@%s} user host
set user [string trimleft $user ~]
set mask *!*$user@[pRecogniseMaskhost $host]
switch -- [validuser $nick] {
0 {
# nick not in userfile and host not recognised
# create user record with +n
if {[string equal [nick2hand $nick] \*]} {
set hand $nick
adduser $hand
chattr $hand +n
save
pRecogniseOutput 005 $nick $hand 0
timer $vRecogniseTime [list pRecogniseDemote $nick $hand 001]
# nick not in userfile but host recognised
} else {
set hand [nick2hand $nick]
# hand does not have +n flag
# add +n to userfile record
if {![matchattr [nick2hand $nick] n]} {
set flags [chattr $hand]
set hosts [getuser $hand HOSTS]
chattr $hand +n
save
pRecogniseOutput 006 $nick $hand 0
timer $vRecogniseTime [list pRecogniseDemote $nick $hand 002 $flags $hosts]
# hand already has +n
# do nothing
} else {pRecogniseOutput 007 $nick $hand 0}
}
}
1 {
set hand $nick
set flags [chattr $hand]
set hosts [getuser $hand HOSTS]
# nick in userfile record but host not recognised
# add host and +n if not already there
if {[string equal [nick2hand $nick] \*]} {
addhost $hand $mask
save
if {![matchattr $hand n]} {
chattr $hand +n
save
}
pRecogniseOutput 008 $nick $hand $mask
timer $vRecogniseTime [list pRecogniseDemote $nick $hand 002 $flags $hosts]
} else {
# nick in userfile and host recognised
# add +n if not already there
if {![matchattr $hand n]} {
chattr $hand +n
save
timer $vRecogniseTime [list pRecogniseDemote $nick $hand 002 $flags $hosts]
# +n already there
# do nothing
} else {pRecogniseOutput 007 $nick $hand 0}
}
}
default {}
}
return 0
}
proc pRecogniseDemote {nick hand type {flags ""} {hosts ""}} {
switch -- $type {
001 {
# delete the newly created userfile record
deluser $hand
save
}
002 {
# remove all user flags and reinstate only the ones that existed previously
chattr $hand -nmtaoylgvfpqrdkxjcbwzeuh
chattr $hand +$flags
# remove all hosts and reinstate only the ones that existed previously
setuser $hand HOSTS
foreach host $hosts {
addhost $hand $host
}
save
}
default {}
}
return 0
}
proc pRecogniseMaskhost {host} {
switch -- [regexp -- {^([0-9]{1,3}.){3}[0-9]{1,3}$} $host] {
0 {
switch -- [regexp -all -- {\.} $host] {
0 - 1 {set mask $host}
2 - 3 {set mask *.[join [lrange [split $host .] 1 end] .]}
default {set mask *.[join [lrange [split $host .] 2 end] .]}
}
}
1 {set mask [join [lrange [split $host .] 0 end-1] .].*}
default {}
}
return $mask
}
putlog "recognise.tcl for arfer version $vRecogniseVersion loaded"
# eof |
_________________
thanks to that they help, that others learn  |
|
Back to top |
|
 |
willyw Owner
Joined: 15 Jan 2009 Posts: 990
|
Posted: Wed Jan 24, 2018 11:42 am Post subject: Re: tcl recognizes with temporary access for nicks |
|
|
I think that addhost is an old command, no longer used. It has been replaced.
You have a few options, as to how to proceed.
The 'right' way would be look up the newer command, see how it works, and edit the script - replacing the old addhost command with the new one.
Next, you could look in your bot's scripts/ dir for a script named
compat.tcl
Text search it for addhost, and find a proc named addhost. You could just copy that one proc from compat.tcl and paste it in your script, thus loading proc addhost when you rehash or start your bot.
Lastly, you could look in eggdrop.conf for a line like this:
#source scripts/compat.tcl
and it is probably commented out, just like the above line.
If you uncomment it, and rehash your bot, that too will load the addhost proc - along with everything else in compat.tcl too, though. Notice in the comment in eggdrop.conf the brief warning about doing that.
Visit:
http://docs.eggheads.org/mainDocs/tcl-commands.html
and text search it for:
setuser
command, and read about it.
I hope this helps. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
Back to top |
|
 |
Arnold_X-P Op

Joined: 30 Oct 2006 Posts: 178 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Wed Jan 24, 2018 5:08 pm Post subject: Re: tcl recognizes with temporary access for nicks |
|
|
line 105
Code: | addhost $hand $mask |
line 149
Code: | addhost $hand $host |
replace and it does not work
line 105
line 149
and I do not use or have activated the compat.tcl never used that tcl _________________
thanks to that they help, that others learn  |
|
Back to top |
|
 |
caesar Ass Kicker

Joined: 14 Oct 2001 Posts: 3550 Location: Mint Factory
|
Posted: Thu Jan 25, 2018 1:53 am Post subject: |
|
|
If you have looked inside scripts/compact.tcl as willyw said you would have seen the:
Code: |
proc addhost {hand host} {
setuser $hand HOSTS $host
}
|
So you have two options:
a) load that compat.tcl in your eggdrop.conf file
b) change the 'addhost $hand $host' lines with 'setuser $hand HOSTS $host' inside the script you use. _________________ You may say anything about me, but at least don't misspell my name. xD |
|
Back to top |
|
 |
Arnold_X-P Op

Joined: 30 Oct 2006 Posts: 178 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Thu Jan 25, 2018 2:53 pm Post subject: |
|
|
thanks willyw and caesar
I chose option number two and it worked very well..
-Kantuta- a temporary host *!*ix@*.wimaxtigo.bo has been added to your userfile record giving you +n (global owner status). it will be removed 180 minutes from now
Code: | # recognise.tcl for arfer DALnet channel #atlantis
# ------------------------------------------------------------------------------------------------------------------- #
# -------------------- syntax --------------------------------------------------------------------------------------- #
# syntax assuming default command 'recognise'
# /msg <botnick> recognise <password>
# ------------------------------------------------------------------------------------------------------------------- #
# -------------------- configuration -------------------------------------------------------------------------------- #
# set here the \msg command to use
set vRecogniseCommand "access"
# set here the password, only a - z, A - Z, 0 - 9 (6 characters minimum)
set vRecognisePassword "PaSSord27"
# set here how long in minutes the bot should recognise you 180 min. = 3 hours
set vRecogniseTime 180
# ------------------------------------------------------------------------------------------------------------------- #
# -------------------- code ----------------------------------------------------------------------------------------- #
set vRecogniseVersion 1.0
bind MSG - $vRecogniseCommand pRecogniseCommand
proc pRecogniseCommand {nick uhost hand text} {
global vRecognisePassword
if {[regexp -nocase -- {^[a-z0-9]{6,}$} $vRecognisePassword]} {
set arguments [regsub -all -- {\s{2,}} [stripcodes bcruag [string trim $text]] { }]
if {[llength [split $arguments]] == 1} {
if {[string equal $arguments $vRecognisePassword]} {
if {[onchan $nick]} {
pRecognisePromote $nick $uhost
} else {pRecogniseOutput 001 $nick $hand 0}
} else {pRecogniseOutput 002 $nick $hand $arguments}
} else {pRecogniseOutput 003 $nick $hand 0}
} else {pRecogniseOutput 004 $nick $hand 0}
return 0
}
proc pRecogniseOutput {number nick hand xtra1} {
global vRecogniseCommand vRecogniseTime
switch -- $number {
001 {set output "-error- you must be on a bot channel to use this command"}
002 {set output "-error- password $xtra1 not recognised"}
003 {set output "-error- correct usage /msg <botnick> $vRecogniseCommand <password>"}
004 {set output "-error- incorrectly configured password in script"}
005 {set output "a new userfile record has been temporarily created giving you +n (global owner status). it will be deleted $vRecogniseTime minutes from now"}
006 {set output "the flag +n (global owner status) has been temporarily granted in your userfile record. it will be rescinded $vRecogniseTime minutes from now"}
007 {set output "you are already recognised by the handle $hand as having +n (global owner status)"}
008 {set output "a temporary host $xtra1 has been added to your userfile record giving you +n (global owner status). it will be removed $vRecogniseTime minutes from now"}
default {}
}
putserv "NOTICE $nick :$output"
return 0
}
proc pRecognisePromote {nick uhost} {
global vRecogniseTime
scan $uhost {%[^@]@%s} user host
set user [string trimleft $user ~]
set mask *!*$user@[pRecogniseMaskhost $host]
switch -- [validuser $nick] {
0 {
# nick not in userfile and host not recognised
# create user record with +n
if {[string equal [nick2hand $nick] \*]} {
set hand $nick
adduser $hand
chattr $hand +n
save
pRecogniseOutput 005 $nick $hand 0
timer $vRecogniseTime [list pRecogniseDemote $nick $hand 001]
# nick not in userfile but host recognised
} else {
set hand [nick2hand $nick]
# hand does not have +n flag
# add +n to userfile record
if {![matchattr [nick2hand $nick] n]} {
set flags [chattr $hand]
set hosts [getuser $hand HOSTS]
chattr $hand +n
save
pRecogniseOutput 006 $nick $hand 0
timer $vRecogniseTime [list pRecogniseDemote $nick $hand 002 $flags $hosts]
# hand already has +n
# do nothing
} else {pRecogniseOutput 007 $nick $hand 0}
}
}
1 {
set hand $nick
set flags [chattr $hand]
set hosts [getuser $hand HOSTS]
# nick in userfile record but host not recognised
# add host and +n if not already there
if {[string equal [nick2hand $nick] \*]} {
setuser $hand HOSTS $mask
save
if {![matchattr $hand n]} {
chattr $hand +n
save
}
pRecogniseOutput 008 $nick $hand $mask
timer $vRecogniseTime [list pRecogniseDemote $nick $hand 002 $flags $hosts]
} else {
# nick in userfile and host recognised
# add +n if not already there
if {![matchattr $hand n]} {
chattr $hand +n
save
timer $vRecogniseTime [list pRecogniseDemote $nick $hand 002 $flags $hosts]
# +n already there
# do nothing
} else {pRecogniseOutput 007 $nick $hand 0}
}
}
default {}
}
return 0
}
proc pRecogniseDemote {nick hand type {flags ""} {hosts ""}} {
switch -- $type {
001 {
# delete the newly created userfile record
deluser $hand
save
}
002 {
# remove all user flags and reinstate only the ones that existed previously
chattr $hand -nmtaoylgvfpqrdkxjcbwzeuh
chattr $hand +$flags
# remove all hosts and reinstate only the ones that existed previously
setuser $hand HOSTS
foreach host $hosts {
setuser $hand HOSTS $host
}
save
}
default {}
}
return 0
}
proc pRecogniseMaskhost {host} {
switch -- [regexp -- {^([0-9]{1,3}.){3}[0-9]{1,3}$} $host] {
0 {
switch -- [regexp -all -- {\.} $host] {
0 - 1 {set mask $host}
2 - 3 {set mask *.[join [lrange [split $host .] 1 end] .]}
default {set mask *.[join [lrange [split $host .] 2 end] .]}
}
}
1 {set mask [join [lrange [split $host .] 0 end-1] .].*}
default {}
}
return $mask
}
putlog "recognise.tcl for arfer version $vRecogniseVersion loaded"
# eof |
changes;
Code: |
line 105
addhost $hand $mask it changed to setuser $hand HOSTS $mask
line 149
addhost $hand $host it changed to setuser $hand HOSTS $host |
_________________
thanks to that they help, that others learn 
Last edited by Arnold_X-P on Thu Dec 20, 2018 10:00 pm; edited 1 time in total |
|
Back to top |
|
 |
Arnold_X-P Op

Joined: 30 Oct 2006 Posts: 178 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Thu Dec 20, 2018 9:49 pm Post subject: |
|
|
the tcl now does not work correctly
To identify myself and have access, I have to give the same command twice, just so it gives me full access
example in IRCD
Code: | /msg kantuta access PaSSord27
[21:36] -Kantuta- a new userfile record has been temporarily created giving you +n (global owner status). it will be deleted 180 minutes from now
/msg kantuta access PaSSord27
[21:37] -Kantuta- a temporary host *!*x@x.x.x.* has been added to your userfile record giving you +n (global owner status). it will be removed 180 minutes from now |
Now for it to work you have to give the same command twice
before it was only once and you already had access
check and everything is fine and when the 180 minutes pass the bot removes access
the detail is only that to have access you have to identify twice _________________
thanks to that they help, that others learn  |
|
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
|
|