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 

Bot banlist cleaner/administrator
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
BrewMaster
Voice


Joined: 07 Jul 2007
Posts: 34

PostPosted: Thu Jul 26, 2007 12:10 pm    Post subject: Bot banlist cleaner/administrator Reply with quote

I am looking for a bot ban list manager. I have not found anything to meet all the criteria I am looking for. There is one main thing I would like it to do that none I have found seem to do.

1. remove bans on the bot ban list that are older then ## days and never used. (I would not want to remove a ban created such as: Created 57 days ago, last used 11:15 OR Created 57 days ago, last used 2 days ago)

The scripts I have found do other useful stuff such as:
- scrub ban list for invalid/bad bans.
-scrub list for dupe bans ( *@192.168.11.* vs *@ 192.168.* ...remove the lower level ban)

It would be nice to have an all in one ban list manager tcl that includes all the "usefull" bot ban list management functions and what I am looking for. I am sure there are many other options that could be useful and I would love to see that included into one script.

If someone knows of a script that already does that please provide a link. I have yet to find it!

Brew
Back to top
View user's profile Send private message
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Sun Jul 29, 2007 5:00 am    Post subject: Reply with quote

Take a look at this thread:
http://forum.egghelp.org/viewtopic.php?t=13743&highlight=banlist
_________________
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
BrewMaster
Voice


Joined: 07 Jul 2007
Posts: 34

PostPosted: Sun Jul 29, 2007 10:40 am    Post subject: Reply with quote

sorry I should be more specific. I meant the bots saved bans. Not the channel ban list of active bans.

I was referring to managing the bans that are saved in the bots .user file.

does this make more sense now?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Jul 29, 2007 4:51 pm    Post subject: Reply with quote

Although not a complete script, I do have bits'n'pieces that will clean your banlist of old, unused bans..
Code:
set default-purgeage 180

#purgebanlist ?-age days? ?&/#channel?
#Checks through the specified banlist and removes any and all older
#bans that have not been in use in the specified number of days.
#Returns: A list of ban-structures, format similar to "banlist".

proc purgebanlist args {
 #Initialize local variables
 if {[info exists ::default-purgeage]} {
  set purgeage ${::default-purgeage}
 }
 set removed [list]

 #Read and interpret parameters
 #Only takes -age and optional channelname sofar... guess more might be added further on
 for {set i 0} {$i < [llength $args]} {incr i} {
  switch -glob -- [lindex $args $i] {
   "-age" {
    if {[string is integer [lindex $args [incr i]]]} {
     set purgeage [lindex $args $i]
    } {
     error "Age is not an integer: [lindex $args $i]"
    }
   }
   "#*" -
   "&*" {
    set channel [lindex $args $i]
    if {![validchan $channel]} {
     error "Invalid channel: $channel"
    }
   }
   default {error "Unknown option: [lindex $args $i]"}
  }
 }

 #Lets make sure we have a sane value to check age against
 #If not, just error out since we really don't know how to fix
 #it anyway
 if {[info exists purgeage] && [string is integer $purgeage]} {
  set threshold [expr [clock seconds] - $purgeage * 86400]
 } {
  error "No valid age-setting was found."
 }



 #Get the list of bans...
 if {[info exists channel]} {
  set bans [banlist $channel]
 } {
  set bans [banlist]
 }

 #...and start processing them. Save the removed bans for now.
 foreach ban $bans {
  if {[lindex $ban 3] < $threshold && [lindex $ban 4] < $threshold} {
   if {[info exists channel]} {
    killchanban $channel [lindex $ban 0]
   } {
    killban [lindex $ban 0]
   }
   lappend removed $ban
  }
 }
 #Return the list of removed bans, so the scripter can present this
 #in some fancy way with pretty colors *yuck*
 return $removed
}

Edit: fix for troublesome variablenames containing -
Edit: fixed missing close-bracket
Edit: missing space in "is integer"


This could be used with something like this, in order to provide some dcc-chat interface:
Code:
bind dcc - purgebans dcc:purgebans
proc dcc:purgebans {hand idx text} {
 foreach chan [channels] {
  foreach ban [purgebanlist $chan] {
   putidx $idx "Removed \"[lindex $ban 0]\" from $chan"
  }
 }
 foreach ban [purgebanlist] {
  putidx $idx "Removed \"[lindex $ban 0]\" from global banlist"
 }
}

Of course, this could be extended to allow you to specify how old a ban must be in order to be removed, which banlist to cleanse, some fancy bells'n'whistles, etc.
_________________
NML_375, idling at #eggdrop@IrcNET


Last edited by nml375 on Tue Jul 31, 2007 9:34 am; edited 4 times in total
Back to top
View user's profile Send private message
BrewMaster
Voice


Joined: 07 Jul 2007
Posts: 34

PostPosted: Mon Jul 30, 2007 7:08 am    Post subject: Reply with quote

two quick questions...
1. I place the binds at the beginning of the script? or is it irrelevant where they are placed.

2. The first line .... set default-purgeage ### is where I set the age of the unused bans I want to remove? I assume a value of 90 would remove all bans set over 90 days ago from the bots ban listing.

Finally, because I don't understand/read code well, If I have a ban in the bots ban list for example:
Quote:
[05:55] <MyBot> [2331] *!*@192.168.1.1 (perm)
[05:55] <MyBot> Larry: Flooders
[05:55] <MyBot> Created 37 days ago, last used 2 days ago

And I have the line set default-purgeage 35 set in the script. what will be the outcome?

A. The ban will be flushed because it was created 37 days ago (purge age set to 35)
OR
B. The ban will not be flushed because even though it was created 37 days ago it has been used within the last 35 days. (last used 2 days ago)

I hope I am not confusing you. Thank you in advance for all the help!!

brew
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Jul 30, 2007 7:55 am    Post subject: Reply with quote

1: Where you place the bindings really does'nt matter, as long as the proc exists once the binding is triggered. Last piece of code was just a quick user interface for the first script (which could be used by other scripts aswell).

2: Short answer: yes.
Long answer: Kinda, it is the default age to be used, should the scripter not provide one when calling the purgebanlist function. As I was a lazy coder when writing the user interface, I just went for the default.

3: B. The script will check both "added at" and "last used", and make sure both are older than the specified age before removing the ban. It will, however, currently not check wether the ban has an expire-time set, so it will remove bans that might've been scheduled for later removal.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
BrewMaster
Voice


Joined: 07 Jul 2007
Posts: 34

PostPosted: Mon Jul 30, 2007 1:10 pm    Post subject: Reply with quote

Thank you very much for the help.

I am off to go test this script!
Back to top
View user's profile Send private message
BrewMaster
Voice


Joined: 07 Jul 2007
Posts: 34

PostPosted: Mon Jul 30, 2007 2:43 pm    Post subject: Reply with quote

Tcl error [dcc:purgebans]: can't read "::default": no such variable

(using dcc chat interface code)

I used .purgebans in dcc chat
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Jul 30, 2007 2:49 pm    Post subject: Reply with quote

Minor bummer by me Embarassed
Updated the post above to properly read the variable containing -
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Mon Jul 30, 2007 8:58 pm    Post subject: Reply with quote

Well I think he wanted the script to be automated, so instead of bind dcc here, you have to use bind time BrewMaster or just use a proc with a continuous timer calling the ban remove proc.
_________________
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
BrewMaster
Voice


Joined: 07 Jul 2007
Posts: 34

PostPosted: Tue Jul 31, 2007 12:07 am    Post subject: Reply with quote

that was all Greek to me awyeah.
I was thinking that this script would run when triggered by a dcc command, then post what it removed. I guess I am off on my assumptions.

brew
Back to top
View user's profile Send private message
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Tue Jul 31, 2007 4:16 am    Post subject: Reply with quote

Perhaps this might lure your interest:
http://forum.egghelp.org/viewtopic.php?t=13839
_________________
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
BrewMaster
Voice


Joined: 07 Jul 2007
Posts: 34

PostPosted: Tue Jul 31, 2007 6:33 am    Post subject: Reply with quote

nml375

the new error:

Tcl error [dcc:purgebans]: missing close-bracket
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Jul 31, 2007 9:25 am    Post subject: Reply with quote

Fixed.
Must've been abit too tired when writing that code. I hav'nt seen any further obvious flaws as of now. As soon as I get access to my devel-eggies, I'll have a more throughout bughunt, but it should work fine now.
Post above updated again.
Edit: Finally got in touch with those eggies, revealed one additional typo, apart from that, runs like a charm for me.

@Awyeah: Your script still does not alter the internal banlist, which is the topic of this thread.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
BrewMaster
Voice


Joined: 07 Jul 2007
Posts: 34

PostPosted: Tue Jul 31, 2007 10:16 am    Post subject: Reply with quote

nml375

Worked Great!! Just what I was looking for. Thank you.

Brew
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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