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 

No version

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
gamble27
Halfop


Joined: 05 Aug 2008
Posts: 71

PostPosted: Tue Jan 05, 2010 9:15 am    Post subject: No version Reply with quote

hello all,i am looking for a tcl which will version users on join and kickban them after 15 sec if they didnt reply the version,i noticed most of the spammers has no version reply so this could be a help to stop spammers. SO basically on join version user and kick ban if the user dont reply version after 15 secs.. Thank You:)
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Tue Jan 05, 2010 10:17 am    Post subject: Reply with quote

This is a script I wrote I while ago for somebody wishing to do pretty much the same sort of thing. However, rather than a /ctcp version it uses a /ctcp finger. Relatively little modification would be required if you insist on /ctcp version, though I'm not quite sure whether it would matter.

I have to say that I do not like these types of script. It is a poor means of detecting spammers/drones. Many innocent IRC users block /ctcp replies and therefore fall foul of the script.

Code:

# finger.tcl
# arfer <DALnet #Atlantis>

### ----------------------------------------------------------------------- ###
### -------------------- operation ---------------------------------------- ###

# finger.tcl will ban users joining a bot channel that do not reply to a ..
# .. /ctcp FINGER within a preconfigured time

### ----------------------------------------------------------------------- ###
### -------------------- installation ------------------------------------- ###

# 1. configure finger.tcl in a suitable text editor
# 2. put the configured finger.tcl in the bot's scripts subdirectory
# 3. add a line to the end of the bot's .conf file 'source scripts/finger.tcl'
# 4. restart the bot
# 5. requires '.chanset #channelname +finger' in the partyline for each chan ..
# .. you want the script to function on

### ----------------------------------------------------------------------- ###
### -------------------- changelog ---------------------------------------- ###

# 1.0  beta release

### ----------------------------------------------------------------------- ###
### -------------------- configuration ------------------------------------ ###

# set here the time allowed in seconds for a /ctcp finger response
# after this time, if there is no response, the user will be banned
# ensure this is long enough to allow for moderate lag
set vFingerReplyTime 20

# set here the bot user flag(s) exempt from bans by this script
set vFingerExempt fo

# set here the banmask to use
# allowed values are as follows
#  1  nick!*user@host
#  2  nick!*@host
#  3  *!*user@host
#  4  *!*@host
#  5  nick!*user@hostmask
#  6  nick!*@hostmask
#  7  *!*user@hostmask
#  8  *!*@hostmask
#  9  nick!*user@*
# 10  nick!*@*
# 11  *!*user@*
set vFingerBanMask 6

# set here the time in minutes a ban should last
set vFingerBanTime 10

### ----------------------------------------------------------------------- ###
### -------------------- code (DO NOT EDIT) ------------------------------- ###

setudef flag finger

set vFingerVersion 1.0

bind CTCR - FINGER pFingerResponse
bind JOIN - * pFingerJoin

proc pFingerBan {nick uhost chan} {
    global vFingerBanMask vFingerBanTime
    if {[botisop $chan]} {
        if {[onchan $nick $chan]} {
            set banmask [pFingerBanMask $nick $uhost $vFingerBanMask]
            putquick "MODE $chan +b $banmask"
            putkick $chan $nick "no /CTCP FINGER reply"
            timer $vFingerBanTime [list putquick "MODE $chan -b $banmask"]
        }
    }
    return 0
}

proc pFingerBanMask {nick uhost type} {
    scan $uhost {%[^@]@%s} user host
    set user [string trimleft $user ~]
    switch -- [regexp -- {^([0-9]{1,3}\.){3}[0-9]{1,3}$} $host] {
        0 {
            switch -- [regexp -all -- {\.} $host] {
                0 - 1 {set hostmask $host}
                2 {set hostmask *.[join [lrange [split $host .] 1 end] .]}
                default {set hostmask *.[join [lrange [split $host .] 2 end] .]}
            }
        }
        1 {set hostmask [join [lrange [split $host .] 0 end-1] .].*}
        default {}
    }
    switch -- $type {
        1  {set mask ${nick}!*${user}@$host}
        2  {set mask ${nick}!*@$host}
        3  {set mask *!*${user}@$host}
        4  {set mask *!*@$host}
        5  {set mask ${nick}!*${user}@$hostmask}
        6  {set mask ${nick}!*@$hostmask}
        7  {set mask *!*${user}@$hostmask}
        8  {set mask *!*@$hostmask}
        9  {set mask ${nick}!*${user}@*}
        10 {set mask ${nick}!*@*}
        11 {set mask *!*${user}@*}
        default {}
    }
    return $mask
}

proc pFingerCancel {nick uhost} {
    global vFingerID
    if {[info exists vFingerID($nick)]} {
        unset vFingerID($nick)
        foreach chan [channels] {
            if {[channel get $chan finger]} {
                pFingerBan $nick $uhost $chan
            }
        }
    }
    return 0
}

proc pFingerJoin {nick uhost hand chan} {
    global vFingerReplyTime vFingerID vFingerExempt
    if {[channel get $chan finger]} {
        if {![isbotnick $nick]} {
            if {![matchattr $hand $vFingerExempt $chan]} {
                if {![info exists vfingerID($nick)]} {
                    set vFingerID($nick) 0
                    putquick "PRIVMSG $nick :\001FINGER\001"
                    utimer $vFingerReplyTime [list pFingerCancel $nick $uhost]
                }
            }
        }
    }
    return 0
}

proc pFingerResponse {nick uhost hand dest keyword text} {
    global vFingerID
    if {[info exists vFingerID($nick)]} {
        unset vFingerID($nick)
    }
    return 0
}

putlog "finger.tcl version $vFingerVersion by arfer loaded"

# eof

_________________
I must have had nothing to do
Back to top
View user's profile Send private message
gamble27
Halfop


Joined: 05 Aug 2008
Posts: 71

PostPosted: Wed Jan 06, 2010 5:18 am    Post subject: Thanks for replying Reply with quote

hey arfer thank u for ure time,but could we change to version instead of finger,because i realise by versioning we have higher accuracy rather than fingering,ure script is nicely written,i wud be grateful if u can change it to version instead.. i had a similar tcl b4 but for weird reason it dont work.below pasted is the tcl


bind ctcr - VERSION version:reply
bind join - * check:version

proc check:version {nick uhost hand chan} {
global cversion
set cversion([string tolower $nick]) 1
putserv "PRIVMSG $nick :\001VERSION\001"
utimer 15 [list no:version:reply $nick $uhost $chan]
}

proc version:reply {nick uhost hand dest kw arg} {
global cversion
if {[info exists cversion([string tolower $nick])]} {
unset cversion([string tolower $nick])
}
}

proc no:version:reply {nick uhost chan} {
global cversion
if {[info exists cversion([string tolower $nick])] && [onchan $nick $chan]} {
putserv "MODE $chan +b *!*@[lindex [split $uhost @] 1]"
putserv "KICK $chan $nick :No CTCP version reply"
unset cversion([string tolower $nick])
}
}

putlog "Version Kicker"

error msg : Tcl error [check:version]: invalid command name " global"


Thanks Smile
Back to top
View user's profile Send private message
gamble27
Halfop


Joined: 05 Aug 2008
Posts: 71

PostPosted: Wed Jan 06, 2010 6:38 am    Post subject: Thanks Reply with quote

i manage to work out the code i pasted its working but how do we exempt certain nicks from being kicked cause like u said arfer its not very accurate so i need to exempt certain nicks.. thanks for the help Smile exempting nicks or host both any will do Smile
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Wed Jan 06, 2010 6:43 am    Post subject: Reply with quote

I see nothing in the code you pasted that would result in such an error. It looks like some spurious character has been accidentaly included which is causing the command 'global' to be interpreted as 'Â global'.

I suggest you download the script again. If you edit anything then do so carefully in a dedicated text editor such as editpad lite and ftp to your shell.

My script exempts nicks with preconfigured bot user flag. I dont know why you consider /ctcp finger to be less accurate than /ctcp version. Since you have both scripts, it should be quite obvious what changes are needed to mine to make it respond to /ctcp version.
_________________
I must have had nothing to do
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
Page 1 of 1

 
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