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.

No version

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

No version

Post by gamble27 »

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:)
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Post by arfer »

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: Select all

# 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
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Thanks for replying

Post by gamble27 »

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 :)
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Thanks

Post by gamble27 »

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 :) exempting nicks or host both any will do :)
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Post by arfer »

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
Post Reply