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.

Auth.tcl request

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
S
StormG
Voice
Posts: 9
Joined: Sat Jan 05, 2013 4:32 pm

Auth.tcl request

Post by StormG »

Hello egghelp community.
Is there a way of a script as i'll describe here to be created?
I already searched the forum, and tcl archive for something like this but none matches my criteria. So, here are the basics for what i request the script:

- a command for pass -> (CHAN) !pass <password> <secretword> | (PRIVMSG) pass <password> <secretword>
At this command of pass <password> <secretword> the user who sets it on the eggdrop will have to not be able to add the <password> and <secretword> with bold or underlines chars. All punctuations chars should be accepted, numbers and letters off course.
- a command for authentification -> (CHAN) !auth <password> | (PRIVMSG) auth <password>
- a command for permanent authentification -> (CHAN) !permauth | (PRIVMSG) permauth , this command should work only after the above 2 commands were done (pass and auth). This command is for users choice to be done if the user wants to be recognized by the eggdrop without having to send everytime that joins the channel the command "auth".
- a command for deauthentification -> (CHAN) !deauth | (PRIVMSG) deauth
At this point, if the authentificated user is in least 2 common channels with the eggdrop to who is authentificated, and he gets kick/ban or he parts 1 channel from those common with the eggdrop, eggdrop should not request again to authentificate to it if the user rejoins the channel where he left or received kick or ban.
More, the deauth command should be enabled automatically if the user quits the network.
In case the user gets banned and he has no common channels with eggdrop, the eggdrop should deauthificate him automatically.
In case the user gets kicked or part the channel, and he has no common channels with the eggdrop, the eggdrop should inform the user if he wants to still be authentificated to eggdrop, the user must rejoin in one channel where the eggdrop is.
These settings for deauth should work if only the "permauth command" has not been set for user.
- a command for recover password -> (CHAN) !recover <handle> <secretword> | (PRIVMSG) recover <handle> <secretword> ; this should work only if the user matches the handle in eggdrops userlist
-> (CHAN) !recover <handle> | (PRIVMSG) recover <handle> ; this should work for owners (nm|- level access to eggdrop)
And one last thing, a possibility with a line or more to be able to add in other scripts that uses commands in channel to work only with this script, so for example if the user types in a channel: !op , if he didn't set these settings from this script he will not be able to use that command even he has access to request that mode. Hopefully i made myself clear with these examples.

I found a script of David Proper (Dr. Nibble [DrN]) that is almost what i want but still incomplete. Here it is:

Code: Select all

#         Script : Auth v1.03 by David Proper (Dr. Nibble [DrN])
#                  Copyright 2002 Radical Computer Systems
#
#       Original
#       Platform : Linux 2.0.33
#                  Eggdrop v1.2.0+bel1
#       Current
#      Platforms : Linux 2.2.16    TCL v8.3
#                  Eggdrop v1.6.2
#                  Eggdrop v1.6.6
#            And : SunOS 5.8       TCL v8.3
#                  Eggdrop v1.5.4
#
#    Description : Auth allows you to quickly and easily add authentication
#                  to channel commands. 
#
# To require a command to need authorization, place this before the actual
# procedure, but after any level/access checking:
# if {(![authed $hand])} {return 0}
#
#       Features : 
#                 o Easy method to require password authentication 
#                 o Expires authentication when they part all bot chans
#                 o Expires authentications when they sign-off
#                 o Expires authentication when idle over 60 mins unless DCCed
#                 o Expires all authentications when connects to a server.
#                 o Requires user to be on at least one bot channel to auth.
#
#        History : 05/20/2001 - First Release
#                  12/30/2001 - v1.01
#                              o Will check to make sure user is on a
#                                channel the bot is on before allowing
#                                them to authenticate.
#                  01/02/2002 - v1.02
#                              o Fixed empty string error.
#                  12/09/2002 - v1.03
#                              o Fixed [die] nick vulerablity
#
#
#   Future Plans : Hell if I know.
#
#      Donations : https://www.paypal.com/xclick/business=rainbows%40stx.rr.com
# (If you don't have PayPal and want to donate, EMail me for an address.
#  Will take money or hardware/computer donations)
#  Significant (or even non-significant donations) can be published on a
#  web site if you so choose.
#
# Author Contact :     Email - DProper@chaotix.net
#                   Homepage - http://www.chaotix.net/~dproper
#                        IRC - Primary Nick: DrN
#                     UseNet - alt.irc.bots.eggdrop
# Support Channels: #RCS @UnderNet.Org
#                   #RCS @DALnet
#                   #RCS @EFnet
#                   #RCS @GalaxyNet
#                   #RCS @Choatix Addiction
#            Other channels - Check contact page for current list
#
#                Current contact information can be located at:
#                 http://rcs.chaotix.net/contact.html
#
# New TCL releases are sent to the following sites as soon as they're released:
#
# FTP Site                   | Directory                     
# ---------------------------+-------------------------------
# ftp.chaotix.net            | /pub/RCS
# ftp.eggheads.org           | Various
# ftp.realmweb.org           | /drn
#
#   Radical Computer Systems - http://rcs.chaotix.net/
# To subscribe to the RCS mailing list:
#  http://www.chaotix.net/mailman/listinfo/rcs-list
#  
#
#  Feel free to Email me any suggestions/bug reports/etc.
# 
# You are free to use this TCL/script as long as:
#  1) You don't remove or change author credit
#  2) You don't release it in modified form. (Only the original)
# 
# If you have a "too cool" modification, send it to me and it'll be
# included in the official release. (With your credit)
#
# Commands Added:
#  Where     F CMD       F CMD         F CMD        F CMD
#  -------   - --------- - ----------- - ---------- - --------- - -------
#  Public:   - N/A
#     MSG:   - verify    - pubauth     - deauth
#     DCC:   - N/A
#
# Public Matching: N/A
#

#\
# |##### NOTE: Anything on the Chaotix.Net domain is currently offline
#/

set authver "v1.02.00"

# Set this to the user defined flag to use to indicate authorized.
set authflag "Z"

bind msg - verify msg_auth
bind msg - pubauth msg_auth
proc msg_auth {nick uhost hand rest} {
  global botnick authflag
 
  if {$rest == ""} {
    putserv "NOTICE $nick :Usage: /msg $botnick verify password"
    putserv "NOTICE $nick :  Authenticate for public commands."
    return 0
  }
 if {([matchattr $hand $authflag] == 1)} {
    putserv "NOTICE $nick :You are allready athenticated."
    return 0
                                 }

if {(![auth_chans $nick $hand])} {return 0}

 if {[passwdok $hand $rest] == 1} {
    putlog "$nick is now authenticated"
    putserv "NOTICE $nick :You are now athenticated."
    chattr $hand "+${authflag}"
                                  } else { putserv "NOTICE $nick :Access Denied." } 
                                     }


bind msg - deauth msg_deauth
proc msg_deauth {nick uhost hand rest} {
 global authflag
 chattr $hand "-${authflag}"
 putlog "$nick request deauth. Deauthenticated."
 putserv "NOTICE $nick :You're no longer authenticated."
}

proc authed {hand} {
 global botnick authflag
 set nick [hand2nick $hand]
 if {([matchattr $hand $authflag] == 1)} {return 1
                                 } else {
                                         putserv "NOTICE $nick :Please athenticate before using this command."
                                         putserv "NOTICE $nick :To authenticate: /msg $botnick verify yourpassword"
                                         putlog "$nick tried to use an authenticated command."
                                         return 0
                                        }
}

bind part $authflag * auth_part
proc auth_part {nick uhost hand chan {msg ""}} {
subst -nobackslashes -nocommands -novariables nick
subst -nobackslashes -nocommands -novariables msg

regsub -all {\[} $nick "\\\[" nick
regsub -all {\]} $nick "\\\]" nick

regsub -all {\[} $nick "\\\[" msg
regsub -all {\]} $nick "\\\]" msg

 utimer 5 "auth_check $nick $hand"
}

bind sign $authflag * auth_signoff
proc auth_signoff {nick uhost hand channel reason} {
 global authflag
 chattr $hand "-${authflag}"
 putlog "$nick signed off. Deauthenticated."

}

proc auth_check {nick hand} {
subst -nobackslashes -nocommands -novariables nick

 global authflag
 if {([matchattr $hand $authflag] == 0)} {return}
 set chans [channels]
 set chan_tot [llength $chans]
 set chan_num 0
 for {set loop 0} {$loop < $chan_tot} {incr loop} {
  if {[onchan $nick [lindex $chans $loop]]==1} {incr chan_num +1}
                                                  }

 if {($chan_num == 0)} {
    chattr $hand "-${authflag}"
    putlog "$nick parted all channels. Deauthenticated."
    putserv "NOTICE $nick :You're no longer on one of my channels. You have been deathenticated."
    return 0
                       }
}

proc auth_chans {nick hand} {
 global authflag
 set chans [channels]
 set chan_tot [llength $chans]
 set chan_num 0
 for {set loop 0} {$loop < $chan_tot} {incr loop} {
  if {[onchan $nick [lindex $chans $loop]]==1} {incr chan_num +1}
                                                  }

 if {($chan_num == 0)} {
    putlog "$nick Isn't on any of my channels. Athentication Rejected"
    putserv "NOTICE $nick :You're not on any of my channels. Athentication is rejected."
    return 0
                       }
return 1
}

proc auth_idle {} {
global _auth authflag

set idletime 1
 set chans [channels]
 set chan_tot [llength $chans]
 set chan_num 0
 for {set loop 0} {$loop < $chan_tot} {incr loop} {
   set nicks [chanlist [lindex $chans $loop] $authflag]
   set nickidle 1
   set nick_tot [llength $nicks]
    for {set loop2 0} {$loop2 < $nick_tot} {incr loop2} {
      set idletime [getchanidle [lindex $nicks $loop2] [lindex $chans $loop]]
      if {$idletime >= $nickidle} {set nickidle $idletime}
      if {($idletime > 60)} {
                           set nick [lindex $nicks $loop2]
                           set hand [nick2hand [lindex $nicks $loop2]]
     if {[hand2idx $hand] == -1} {
                           putlog "$nick Idle over 60 minutes. Deauthenticated."
                           chattr $hand "-${authflag}"
                           putserv "NOTICE $nick :Idle over 60 minutes. Deauthenticated."
                                 }
                          } 
                                                                }
                                                  }

 set _auth [timer 60 auth_idle]
}

set init-server { run_server_init }

proc run_server_init {} {
 global botnick
 putserv "MODE $botnick +i-ws"
 reset_auth
}

proc reset_auth {} {
 global authflag
 set users [userlist $authflag]
 set user_tot [llength $users]
 set user_num 0
 for {set loop 0} {$loop < $user_tot} {incr loop} {
   set hand [lindex $users $loop]
   if {[hand2idx $hand] == -1} {
      putlog "Reseting authorizations. $hand Deauthenticated."
      chattr $hand "-${authflag}"
                               }
                                                  }  

}


if {![info exists _auth]} {
                           putlog "Starting auth timmer"
                           set _auth [timer 60 auth_idle]
                            }


return "Auth.tcl $authver by Dr. Nibble (DrN) -: Loaded :-"
PS: Any help would be appreciated.. Thank you.
S
StormG
Voice
Posts: 9
Joined: Sat Jan 05, 2013 4:32 pm

Post by StormG »

No chance of having such a script done or edited this one by someone? Than anyone could point me to some direction where i can find some usefull infomations about editing this script in the way i mentioned above? Thanks.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

You could install a&a script

http://wget.ascript.name it has alot of features and the one you want
S
StormG
Voice
Posts: 9
Joined: Sat Jan 05, 2013 4:32 pm

Post by StormG »

Yes, thank you Madalin for the reply with that. I was hoping that it could be made some improvements on DrN's code to be quite as a&a script does. To be honest, i use a&a script, and there i saw those settings with 'permident' and/or 'auth' , but i wanted to use other scripts beside this a&a who do not have such security processes. Anyway thank you again and keep smiling :)
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

Well if a&a doesnt provide a feature you can always implement that feature in a&a or load the script and have that feature. If you have such problems i can help you implement some scripts in the a&a so that it wont be like a 3rd part script. But i can say that a&a is quite complete..
d
dirty
Halfop
Posts: 40
Joined: Fri Feb 08, 2013 2:33 pm
Location: Romania
Contact:

Post by dirty »

StormG even if someone would take the time and create this tcl don`t get your hopes up. You still need to know a little bit of tcl scripting to implement the "permauth" into your other scripts because the script dosn`t resume to giving a command to the eggdrop and magically you have permauth to all scripts. Everything is tied up together, and even do i don`t agree with a&a script i do agree that the only choice is to chose a main script like a&a that has this feature and work arround it creating and adding new tcl scripts that suit your needs.
come to the dark side.. I have cookies!
WwW.BotZone.TK
Post Reply