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.

Invite script + invite-abbuse problems

Old posts that have not been replied to for several years.
Locked
a
anophelus
Voice
Posts: 5
Joined: Tue Feb 01, 2005 10:38 am

Invite script + invite-abbuse problems

Post by anophelus »

Hi,
I am using undernet and I set +r on my channel (only registered users are allowed). Anyway, to allow also unregistered users I set and eggdrop to invite those users who ask for an invitation on channel.

This kind of solution was necessary because of the huge number of flooding bots and infected IRC clients who join my channel.

But then the problem arised with those who get banned on channel and are asking for invitation, abbusing the system. Lines like nexts are filling the whole screen:

[16:38] * X sets mode: +b *!*Luci@*.*
[16:39] * Joins: Luci1 (~Luci@210.255.109.204)
[16:39] * Luci1 was kicked by X ((stars2003) Bye !!!)
[16:39] * Joins: Luci1 (~Luci@210.255.109.204)
[16:39] * Luci1 was kicked by X ((stars2003) Bye !!!)

What I need is a solution to this problem. The eggdrop should accept invitations only from those who are not in the channel's ban list.

I tried also to put on ignore the masks of those banned (.+ignore *!*Luci@*), but because of some weird reason the ignore system is not functioning. (aiud is the egg)

[16:35] <aiud> [ 1] *!*luci@* (perm)
[16:35] <aiud> c0ditza: requested

And the invitation script is next (a very basic one, as I don't have scripting knowledge) - invite.tcl:
bind msgm - *invit* inviteme
proc inviteme {nick uhost hand chan } {
putserv "invite $nick #aiud"
}

putlog "Loaded invite.tcl successfully."
I hope you'll find an answer to my problem.

Best regards!
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind msgm - *invit* inviteme 
proc inviteme {nick uhost hand chan } {
foreach ban [chanbans #aiud] {
 if {![string match -nocase "[lindex [split $ban] 0]" "$nick!$uhost"]} { 
  putserv "INVITE $nick #aiud" 
  }
 }
}
this should make it invite the nick only if he's not banned on #aiud.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

I have a script that looks for matching bans, but I am not sure if it currently really working, im too lazy to test it the 100th time ^-^.

something like

Code: Select all

if { ![matchban "$nick!$uhost" $chan] } {
...
}
should do the trick... at least in my interpretation of
TCL-COMMANDS wrote: matchban <nick!user@host> [channel]
Returns: 1 if the specified nick!user@host matches a ban in the global
ban list; 0 otherwise. If a channel is specified, that channel's ban
list is checked as well.
Module: channels
at least as long the bans are properbly set via newchanban and not via putserv, in the last case you will have a do [string match ...] in a foreach loop from [chanbans $chan]

PS: Sir_Fz. yourmean, you were faster ^-^
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

I think he wants channel bans only:

Code: Select all

isban <ban> [channel]

    Returns: 1 if the specified ban is in the global ban list; 0 otherwise. If a channel is specified, that channel's ban list is checked as well.


ispermban <ban> [channel]

    Returns: 1 if the specified ban is in the global ban list AND is marked as permanent; 0 otherwise. If a channel is specified, that channel's ban list is checked as well.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

if you use [isban ...], you will have to specify the exact ban, plus they are compared against the bots own list again (as matchban). so if you use as I suggested the matchban command, you will only have to put the hostmark and nick together without thinking which kind of banmask was used. You may use maskhost of course, but if you lets say banned just *!*ident@* or *!*@*.br or *!*@34.* you would get into troubles again (because they wouldnt be the same as maskhost does) :). So I suggest using matchban and/or Sir_Fz' version.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
a
anophelus
Voice
Posts: 5
Joined: Tue Feb 01, 2005 10:38 am

Post by anophelus »

Thank you for fast replies!

I used the Sir_Fz's code, but the script doesn't work. It still invites the ones banned. Though (as I already mentioned) is weird that not even .+ignore doesn't really ignore requests for invite from the ones in ignore list.

As awyeah already observed, I would like the egg to compare the current banlist of the channel (not the bans given through the egg). The bans are given in channel by different ops or through X (cservice's bot), so it would be useless to compare only with the ban masks in egg's internal lists.

I will try to be more suggestive giving an example:

1. In channel's banlist is one ban on the mask *!*@someone.users.undernet.org
2. Somebody!~ident@someone.users.undernet.org request invite by /msg aiud invite

Now if the script is simple as mentioned in first post:
3. Somebody gets invited and he can join
4. X (cservice) wil kick him out being banned on channel
5. Somebody's will rejoin
6. Somebody gets kicked again

And steps 5-6 goes on and on filling the screen with kick-rejoins from only one user.

But, if the script would work as I want:
3. The egg will compare Somebody's mask (nick / ident / host) with those current set in channel.
4. As Somebody's mask match the *!*@someone.users.undernet.org he will not get invitation.

It should be the same for other types of masks:
- Nick!*@*
- *!ident@*
- *!*@host.*
- *!*@*.domain
- or any other combination...

Hope that this is more clear.

Best regards!
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

Edit
i think i found the logical error!

try this

Code: Select all

bind msgm - *invit* inviteme
proc inviteme {nick uhost hand chan } {
	set goodguy 1
	foreach ban [chanbans #aiud] {
		if {[string match -nocase "[lindex [split $ban] 0]" "$nick!$uhost"]} {
			set goodguy 0
		}
	}
	if { $goodguy } {
		putserv "INVITE $nick #aiud"
		return 1
	}
}
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
a
anophelus
Voice
Posts: 5
Joined: Tue Feb 01, 2005 10:38 am

Post by anophelus »

Lots of thanks De KuS! Always among the first to answer :-)

<aiud> [14:11] invite.tcl by Sir_Fz & De Kus loaded successfully.

Now when the address is banned I get no answer from egg. When no ban -> quick invitation! So is working! :D

Best regards!
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

De Kus wrote:Edit
i think i found the logical error!

try this

Code: Select all

bind msgm - *invit* inviteme
proc inviteme {nick uhost hand chan } {
	set goodguy 1
	foreach ban [chanbans #aiud] {
		if {[string match -nocase "[lindex [split $ban] 0]" "$nick!$uhost"]} {
			set goodguy 0
		}
	}
	if { $goodguy } {
		putserv "INVITE $nick #aiud"
		return 1
	}
}
Interresting, but I still don't understand why my code didn't work ? :?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Is this the correct list index number even?

Try replacing:
[lindex [split $ban] 0]

with:
[lindex $ban 0]
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

anophelus wrote:Lots of thanks De KuS! Always among the first to answer :-)
np, was just avaible ^^
Sir_Fz wrote:Interresting, but I still don't understand why my code didn't work ? :?
very easy to explain. just try to manually debug your code.
lets say [chanbans] returns
*!1@host X 10
*!2@host X 11
soo, foreach will be called 2 times, because we have 2 list lines.
first time it will contain *!1@host, since our bad guy is dog!1@host, so if is false and we proced the next stept... oh right second time no match for the host, meaning we will send the invition :D.

i dont know if split is really needed in this case, but better be safe. 0 is the right index. check TCL-COMMAND for the return of chanbans.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I use a similar code:

Code: Select all

foreach chanban [chanbans $chan] {
 if {![string match -nocase "[lindex [split $chanban] 0]" $ban]} {
putquick "MODE $chan +b $ban"
 }
}
and it works just fine.

Besides, I find setting some variable to 1 or sending the invite directly the same. Since it's finding the match and not setting the variable to 0, same thing if it doesn't find the match and sends the invitation.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

i dont want to discuss with you about loops. I really don't want to critizice your enthusiasm to code for other people ^-^.
if you check the raw log of your bot, you should see it isnt working at all, because sending bans, that are already there, will not be seen unless you check raw log :). I may be wrong, but I dont think so, so plz consider I might really be right ;).
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Locked