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.

advanced auto-voice script

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
spithash
Master
Posts: 249
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

advanced auto-voice script

Post by spithash »

This script is a combination of two scripts I found on the forum and it is working great, my problem is that the owners (script kiddies) of the botnets realized that they have to idle their bots to spam in a moderated channel and they configured their bots to do so.
Thing is, that their spambots/drones don't have a ctcp version reply.
So my question is this, how can I make it scan on join for ctcp version replies and IF we get one (or a certain reply for future use), then proceed to the timer and voice after the time set. Here's the script:

Code: Select all

#Set your maximum idletime here
set maxidle 60

bind time - * idlecheck
#Set your channel name Here
set voicechan "#channel"
bind join - "#channel *" av:join
bind part - "#channel *" av:part
bind mode - "#channel +v" av:mode
bind sign - "#channel *" av:part

proc av:join {nick host hand chan} {
   set host [string trimleft $host ~]
   global dontvoice
   if ![info exists dontvoice($chan)] { set dontvoice($chan) [list] }
   if {[botisop $chan]&&[lsearch -exact $dontvoice($chan) $host]=="-1"} {
      utimer 300 [list pushmode $chan +v $nick]
   }
}

proc av:part {nick host hand chan {msg ""}} {
   set host [string trimleft $host ~]
   global dontvoice
   if ![info exists dontvoice($chan)] { set dontvoice($chan) [list] }
   if {![isbotnick $nick]&&![isvoice $nick $chan]&&![isop $nick $chan]&&[lsearch -exact $dontvoice($chan) $host]=="-1"} {
      lappend dontvoice($chan) $host
      timer 300 [list set dontvoice($chan) [lreplace $dontvoice($chan) [set foo [lsearch -exact $dontvoice($chan) $host]] $foo]]
   }
}

proc av:mode {nick host hand chan mode {target ""}} {
   set thost [string trimleft [getchanhost $target $chan] ~]
   global dontvoice
   if ![info exists dontvoice($chan)] return
      if {[set foo [lsearch -exact $dontvoice($chan) $thost]]!="-1"} {
      set dontvoice($chan) [lreplace $dontvoice($chan) $foo $foo]
   }
}

proc idlecheck {min hour day month year} {
        global botnick voicechan maxidle
        foreach nick [chanlist $voicechan] {
                if {$nick == $botnick} {continue}
                if {[isop $nick $voicechan]} {continue}
                if {![isvoice $nick $voicechan]} {continue}
                if {[getchanidle $nick $voicechan] > $maxidle } {
                        putserv "MODE $voicechan -v-k $nick \00312Inactive.user(s)\00304"

                }
        }
}
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
CrazyCat
Revered One
Posts: 1334
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Well, it's quite simple to do. I explain, I'll try to make the code later in the day.

- You must have a list of people on the chan ("global" variable), empty on the beginning.
- When someone join the channel, do the CTCP query
- When you got the raw 351 (RPL_VERSION), parse the message to separate nick and version
- If version is ok, add nick to the global list
- idlecheck works with the global list, not with [chanlist]
- when an user part, remove it from the list
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

@spithash : What will you do next if they decide to add a regular IRC client reply to their bot's version reply? I would honestly consider talking with an IRC Operator about this issue if persists.

@CrazyCat According to IRC/2 Numeric List that raw is for the server the user is connected on, not from the user itself.

You actually need to bind the ctcp "VERSION"" like this:

Code: Select all

bind ctcp - VERSION version:reply 
Once the game is over, the king and the pawn go back in the same box.
User avatar
spithash
Master
Posts: 249
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

Thanks guys for your replies :)
caesar wrote:@spithash : What will you do next if they decide to add a regular IRC client reply to their bot's version reply? I would honestly consider talking with an IRC Operator about this issue if persists.
ceasar: I guess I thought about it really, if that doesn't work, maybe add like 10 questions in a small database (something like 4+2 = ? )and randomly notice the users on join, if the reply is correct, the user gets voiced by the bot, something like captcha, only for IRC... just a thought, it might be stupid. but for now, this ctcp thing would help me a lot :idea: :!:

Also, for the longest time (more than 3 years now) that I've been watching botnets/drones like these, they never had ctcp version reply - maybe they can't be bothered to add one? (I sure hope so :P )
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
CrazyCat
Revered One
Posts: 1334
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

@caesar : oops :oops:
User avatar
spithash
Master
Posts: 249
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

so my guess is that it's more complicated than I thought :?
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Complicated? Not necessarily. It's up to you how far you want to take things and how to manage such a list. I'm trying something and will get back as soon as it's done. :)

Btw spithash, you are missing a nick changing function. as is right now, if someone that's in the list changes it's nick it will remain in the loop but will never be voiced so you should take care of that too.
Once the game is over, the king and the pawn go back in the same box.
User avatar
spithash
Master
Posts: 249
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

Oh you got a huge point there, good call. Thank you for pointing that out man :)
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
spithash
Master
Posts: 249
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

Let's say I want to use/combine this script here with the rest of the script, http://forum.egghelp.org/viewtopic.php?p=91730

but instead of only ban a certain ctcp reply (which is cool for me for future use), set it to NOT to voice users with NO ctcp reply on join, and if a user replies to VERSION, proceed to the timer and then voice
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
spithash
Master
Posts: 249
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

Anyone? :roll:
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
spithash
Master
Posts: 249
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

unfortunately the attacks are still going on, I am still thinking that this ctcp version thing would be the best idea, anyone interested to help me around with this?
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I started working on something for you but put the work on hold due to holidays. In a few days will get back to work and finish it and reply here to test it out.

Meanwhile anyone else feel free to contribute. :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
spithash
Master
Posts: 249
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

I'm looking forward to your reply, thanks :)
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
spithash
Master
Posts: 249
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

I hate doing this but the botnet attack is still going on, really constant, so I had to bug you guys again.

Anyone else feeling like contributing to this CTCP VERSION thing?

It would help me a lot. Thank you :)
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
Post Reply