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.

Access tcl idea?

Old posts that have not been replied to for several years.
j
jedis

Post by jedis »

I have an idea for a TCL...

To monitor user access, I want to prevent users from dcc'ing any bot but the hubbot (or a bot set in the script itself). I'd like to be able to define a flag via the script, that would be allowed to dcc chat any bot.. (ie, global +o).

If a user tries to attempt to dcc any bot but the hub, and does not have the appropriate access level, they get a notice telling them 'Access Denied, please use the hub bot.'

Unfortunately, the +p flag won't work, due to the bots sharing userfiles. If I remove the flag, they can't dcc any bot.

ppslim, stdragon.. could either of you design a script like this please? I'm not sure how complicated or involved it would be, please let me know.

Very much appreciated!

-Jedis
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Code: Select all

#Add the bots you wish to allow users access too
set accessbots {
bot1
bot2
}
#set the flag you wish to use for access no matter what
set accessflag P
bind ctcp - DCC test:access
proc test:access {nick uh hand dest key arg} {
  global accessbots accessflag
  if {![isbotnick $dest]} { return 1 }
  if {[matchattr $hand $accessflag]} { return 0 }
  set found 0
  foreach _A $accessbots { if {[isbotnick $_A]} { set found 1 } }
  if {!($found)} {
    privmsg "NOTICE $nick :Access denied, use a hub bot"
    return 1
  }
}
Untested, so, what the hell.
j
jedis

Post by jedis »

TCL error [test:access]: invalid command name "privmsg"

Allows the user on the partyline as is
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Maybe I should make it 15 times while reading code over.

Code: Select all

Add the bots you wish to allow users access too
set accessbots {
bot1
bot2
}
#set the flag you wish to use for access no matter what
set accessflag P
bind ctcp - DCC test:access
proc test:access {nick uh hand dest key arg} {
  global accessbots accessflag
  if {![isbotnick $dest]} { return 1 }
  if {[matchattr $hand $accessflag]} { return 0 }
  set found 0
  foreach _A $accessbots { if {[isbotnick $_A]} { set found 1 } }
  if {!($found)} {
    puthelp "NOTICE $nick :Access denied, use a hub bot"
    return 1
  }
  return 0
}
j
jedis

Post by jedis »

Works perfect, thanks :smile:

Code: Select all

## multiple hubs, uncomment to use
#set accessbots {
#Bot1
#Bot2
#}
set accessbots Bot1
#set the flag you wish to use for access no matter what
set accessflag m
bind ctcp - DCC test:access
proc test:access {nick uh hand dest key arg} {
  global accessbots accessflag
  if {![isbotnick $dest]} { return 1 }
  if {[matchattr $hand $accessflag]} { return 0 }
  set found 0
  foreach _A $accessbots { if {[isbotnick $_A]} { set found 1 } }
  if {!($found)} {
    puthelp "NOTICE $nick :Access denied, use $accessbots please. Thanks!"
    dccbroadcast "[Time!notice] $hand attempted to access the partyline via me! Denied."
    return 1
  }
  return 0
}
How can this be modified so if Bot1 is offline, access will be allowed to everyone via Bot2, regardless of flag settings? IE, when main hub is down, to allow use of althub?

Make sense?

Thanks for the fast replies, and script!


j
jedis

Post by jedis »

Here's my attempt...

Code: Select all

## multiple hubs, uncomment to use
#set accessbots {
#Bot1
#Bot2
#}

#anyway to check the userfile for +h and then assign it $hub (egg1.6.6)
set hub "Bot1"
#anyway to check the userfile for +a and then assign it $althub
set althub "Bot2"
#set the flag you wish to use for access no matter what
set accessflag m
bind ctcp - DCC test:access
proc test:access {nick uh hand dest key arg} {
  global hub althub accessflag
  if {![isbotnick $dest]} { return 1 }
  if {[matchattr $hand $accessflag]} { return 0 }
#stops script, and should allow access? works on any bot tho if $hub is not linked... should only work on $althub
  if {![islinked $hub==0]} { return 0 }
#continues script, $hub is linked
   if {![islinked $hub==1]} { return 1 }
  set found 0
#not sure on this line...
  foreach _A $hub $althub { if {[isbotnick $_A]} { set found 1 } }
  if {!($found)} {
    puthelp "NOTICE $nick :Access denied, use $hub please. Thanks!"
    dccbroadcast "[Time!notice] $hand attempted to access the partyline via me! Denied."
    return 1
  }
  return 0
}
Getting error:

TCL error [test:access]: wrong # args: should be "foreach varList list ?varList list ...? command"

Any ideas? See my comments in code...

<font size=-1>[ This Message was edited by: jedis on 2001-10-29 22:02 ]</font>
j
jedis

Post by jedis »

Noticed a bug with the original code from ppslim...

If a user isn't recognized on the bot, it still shows the notice.. anyway to supress that, with the changes above?

Thanks!

<font size=-1>[ This Message was edited by: jedis on 2001-10-29 23:40 ]</font>
j
jedis

Post by jedis »

Found another little bug...

If a user does not have the +p flag, therefore denying them totally access to the partyline, they still get the notice asking them to use Caradog :sad:
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

If you are going to complain at that, complain at yourself. There was nothing in your original post about the user having to be in the userfile, nor did they have to have the +p flag. You should be more acurate in your discription, as forgettings to mention things will make this forum fill up very wuick, and make the coders give up very easy, as they feel being led around a mery dance, codeing for your pleasure.

Code: Select all

#Set your hubs here
set accesshubs {
Hub1
}
#set you alt hubs here
set accessalt {
AltHub1
AltHub2
}
#set the flag required for access no matter what
set accessflag P
#NOTE THE CAPS ABOVE
bind ctcp - DCC test:access
proc test:access {nick uh hand dest arg} {
  global accesshubs accessalt accessflag
  if {![isbotnick $dest]} { return 1 }
  if {[string tolower [lindex [split $arg]] 0] != "chat"} { retrun 1 }
  if {(![validuser $hand]) || (![matchattr $hand p])} { return 0 }
  if {[matchattr $hand $accessflag]} { return 1 }
  set ho 0
  set hf 0
  foreach _A $accesshub {
    if {[isbotnick $_A]} { set hf 1 }
    if {[islinked $_A]} { set ho 1 }
  }
  if {$hf} { return 1 }
  if {$ho} {
    puthelp "NOTICE $nick :Access denied - try a hub bot"
    return 0
  }
  foreach _A $accessalt {
    if {[isbotnick $_A]} { set hf 1 }
  }
  if {$hf} { return 1 }
  puthelp "NOTICE $nick :Access denied - Try a alt hub"
  return 0
}
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

Note, that script won't prevent direct telnet access (eg /ctcp bot CHAT). a much better implementation is to bind to chon and killdcc if user has invalid flags.
j
jedis

Post by jedis »

ppslim: I had originally only thought I would need the script as I requested it, but once I saw it in action, I realized the few problems with it. :sad: I did not mean to lead you in circles. For that I apologize. I will try out the new version now. Thank you for your hard work.

Peterson: How would I go about doing that?

<font size=-1>[ This Message was edited by: jedis on 2001-10-30 19:05 ]</font>
j
jedis

Post by jedis »

TCL error [test:access]: called "test:access" with too many arguments

This error occurs when someone attempts to dcc chat the bot.

Peterson, do you mean

Code: Select all

bind chon - * test:access
I am not sure how to fit the killdcc in there without fudging the thing up beyond repair.. :wink:

Thanks!

<font size=-1>[ This Message was edited by: jedis on 2001-10-30 19:17 ]</font>
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

You would also need to make sure this DCC is a CHAT not a "SEND". Also, as for the +p thing jedis found... Just do an if {[matchattr $hand p]} { .. etc.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Jedis: I am working on a download version, to cover all areas of this.

For now, change the line
proc test:access {nick uh hand dest arg} {
to
proc test:access {nick uh hand dest key arg} {
wcc: Check the code again
if {[string tolower [lindex [split $arg]] 0] != "chat"} { retrun 1 }
A check is allready made for this, and as such, anything other than a CHAT request, is passed to eggdrop for parsing.

<font size=-1>[ This Message was edited by: ppslim on 2001-10-31 07:33 ]</font>
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

Sorry ppslim, diddn't notice that :smile:
Locked