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 

antidrone.tcl against bots like agra55, valendra23, vicky75

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Sun Sep 11, 2005 4:24 am    Post subject: antidrone.tcl against bots like agra55, valendra23, vicky75 Reply with quote

This script is just desinged to kick those spambots with nicknames like agra55, valendra23, vicky75.... More info about this script can be found in the description.

It`s just a beta/test version but should work fine aswell. Please tell me your opinion/suggestions/...

Code:

# -+--+--+--+--+--+
# copyright:
# -+--+--+--+--+--+
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
# -+--+--+--+--+--+
# end copyright:
# -+--+--+--+--+--+

###################################################################################################################################
#                  antidrone.tcl
###################################################################################################################################

# antidrone.tcl by sKy\
# Version 1.1
#
# This script is desinged to kickban those bots with $nickname and 2 digits at the end of the nickname.
# Those bots are really anoying. Them try to send you dcc files, weblinks to infected websites or advertisements.
# The script will be active in all channels the bot is op. It won`t just kick all users which match nicknameDigitDigit.
# Them need to be added to the dronenicklist. (This is because there are a couple of users with regular nicknames in that style.)
#
# Commands (important: nick = the nickname of the drone _without_ digits):
# on dcc chat:
# .+drone nick || .-drone nick || .+list
# or in channel:
# +drone nick || -drone nick || +list
#
# To add someone to the extempt list add him userflag mnofv or I
# .+user handle
# .+host handle hostmask
# .chattr handle +I
#
# Installation:
# - make a file in your eggdrop main dir (eggdrop/dronenicklist.txt)
# - write in that file some nicknames with dronenicks; or let it empty and add them later via pubik or dcc command
# - make a file in your scripts dir (eggdrop/scripts/antidrone.tcl)
# - put this code inside
# - open your eggdrop.conf and add 'source scripts/antidrone.tcl'
# - rehash your bot; script should work

###################################################################################################################################
#                  config   
###################################################################################################################################

# here you can set the kickmsg
set antidrone(reason) "Dronenick."

# set here which flag is needed to add new drones, remove them or to show the actual list of trojannicknames
set antidrone(neededflag) "mno|mno"

###################################################################################################################################
###################################################################################################################################
###################################################################################################################################
# Do not edit anything below this line.
###################################################################################################################################
###################################################################################################################################
###################################################################################################################################

###################################################################################################################################
#                  drone join
###################################################################################################################################

bind join - * antidrone_join

proc antidrone_join { nickname hostname handle channel } {
   if { ! [info exists ::antidrone(trojan_nicklist)] } { antidrone_read }
   if { ! [onchan $nickname $channel] } { return 1 }
   if { ! [botisop $channel] } { return 2 }
   if { [isbotnick $nickname] } { return 3 }
   set nickname [string tolower $nickname]
   if { [matchattr handle mnofvI|mnofvI $channel] } { return 4 }
   if { [string match -nocase "*.quakenet.org" $hostname] } { return 5 }
   if { [string match -nocase "*.undernet.org" $hostname] } { return 5 }
   if { [string match -nocase "*.user.gamesurge" $hostname] } { return 5 }
   set fullhost "$nickname!$hostname"
   if { ! [validchan $channel] } { return 5 }
   if { [info command nofloodbot] != "" } {
      if { [nofloodbot $fullhost] != 0 } { return 6 }
   }
   if { [info command validauth] != "" } {
      if { [validauth $nickname] } { return 7 }
   }
   set check [regsub -all {[0-9]} $nickname "" shortnick]
   if { $check <= 1 || $check >= 3 } {
      # the nickname consits only 1 digit or more then 3 (so it can`t be that type for drone)
      return 8
   }
   set string_length [string length $nickname]
   set prelast [expr {$string_length - 2}]
   set prelast [lindex [split $nickname ""] $prelast]
   set last [expr {$string_length - 1}]
   set last [lindex [split $nickname ""] $last]
   set valid 0
   if { [isnumber $last] && [isnumber $prelast] } {
      set valid 1
   }
   if { $valid != 1 } {
      # if the last 2 letters of the nickname aren`t digtits then it can`t be that type of drone)
      return 9
   }
   if { ! [isdronenick $nickname] } { return 13 }
   if { [info command punish] == "punish" } {
      punish $nickname [get:ban:mask antidrone!$hostname] $handle $channel "antidronescript" 0 $::antidrone(reason) "kickban"
      return 10
   } else {
          set hostname [string map {~ ""} $hostname]
      pushmode $channel +b "*!*$hostname"
      flushmode $channel
      putkick $channel $nickname $::antidrone(reason)
      return 11
   }
   putlog "antidrone_join: $nickname | $fullhost | $channel | /whois $nickname | suggest: .+drone $shortnick"
   return 12
}

###################################################################################################################################
#                  isdronenick $nickname
###################################################################################################################################

proc isdronenick { nickname } {
   if { ! [info exists ::antidrone(trojan_nicklist)] } { antidrone_read }
   set nickname [string tolower $nickname]
   foreach trojannick $::antidrone(trojan_nicklist) {
      set pattern [string2pattern $trojannick]
      set pattern "$pattern??"
      if { [string match $pattern $nickname] } {
         return 1
      }
   }
   return 0
}

###################################################################################################################################
#                  add nickname
###################################################################################################################################

bind dcc $antidrone(neededflag) +drone antidrone_add_dcc

proc antidrone_add_dcc { handle idx text } {
   set nickname [hand2nick $handle]
   set hostname [getchanhost $nickname]
   set channel "dcc"
   antidrone_add_pub $nickname $hostname $handle $channel $text
}

bind pub $antidrone(neededflag) +drone antidrone_add_pub

proc antidrone_add_pub { nickname hostname handle channel text } {
   antidrone_read
   if { [llength [split $text]] > 1 || [llength [split $text]] == 0 } {
      antidrone_out $channel $nickname "Wrong syntax. Should be $::lastbind +drone <nick_of_drone_without_digits>"
      return
   }
   set nick [join [lrange [split $text] 0 0]]
   set nick [string tolower $nick]
   set allready_added 0
   foreach nick_added $::antidrone(trojan_nicklist) {
      if { [string equal -nocase $nick $nick_added] } {
         set allready_added 1
         break
      }
   }
   if { $allready_added == 1 } {
      antidrone_out $channel $nickname "$nick was allready added."
      antidrone_refresh
      return
   }
   if { [regsub -all {[0-9]} $nick "" shortnick] > 0 } {
      antidrone_out $channel $nickname "$nick has not been added to the dronenicklist. The nick should not consits digits."
      return
   }
   lappend ::antidrone(trojan_nicklist) $nick
   # call proc to save the new list
   antidrone_save
   antidrone_out $channel $nickname "OK, done! $nick has been added to the dronenicklist."
   antidrone_refresh
}

###################################################################################################################################
#                  antidrone_refresh
###################################################################################################################################

proc antidrone_refresh { } {
   foreach channel [channels] {
      if { ! [validchan $channel] } { continue }
      if { ! [botisop $channel] } { continue }
      foreach nickname [chanlist $channel] {
         set hostname [getchanhost $nickname]
         set handle [nick2hand $nickname]
         antidrone_join $nickname $hostname $handle $channel
      }
   }
}

###################################################################################################################################
#                  antidrone_out   
###################################################################################################################################

proc antidrone_out { channel nickname text } {
   if { $channel == "dcc" } {
      putlog "$nickname : $text"
   } else {
      puthelp "PRIVMSG $channel :$text"
   }
}

###################################################################################################################################
#                  antidrone_del   
###################################################################################################################################

bind dcc $antidrone(neededflag) -drone antidrone_del_dcc

proc antidrone_del_dcc { handle idx text } {
   set nickname [hand2nick $handle]
   set hostname [getchanhost $nickname]
   set channel "dcc"
   antidrone_del_pub $nickname $hostname $handle $channel $text
}

bind pub $antidrone(neededflag) -drone antidrone_del_pub

proc antidrone_del_pub { nickname hostname handle channel text } {
   antidrone_read
   if { [llength [split $text]] > 1 || [llength [split $text]] == 0 } {
      antidrone_out $channel $nickname "Wrong syntax. Should be $::lastbind -drone <nick_of_drone_without_digits>"
      return
   }
   set nick [join [lrange [split $text] 0 0]]
   set nick [string tolower $nick]
   set ::antidrone(trojan_nicklist) [lremove $::antidrone(trojan_nicklist) $nick]
   antidrone_out $channel $nickname "OK, done! $nick has been deleted from the dronenicklist."
   # call proc to save the new list
   antidrone_save
}

###################################################################################################################################
#                  antidrone_list
###################################################################################################################################

bind dcc $antidrone(neededflag) +list antidrone_list_dcc

proc antidrone_list_dcc { handle idx text } {
   set nickname [hand2nick $handle]
   set hostname [getchanhost $nickname]
   set channel "dcc"
   antidrone_list_pub $nickname $hostname $handle $channel $text
}

bind pub $antidrone(neededflag) +list antidrone_list_pub

proc antidrone_list_pub { nickname hostname handle channel text } {
   antidrone_read
   set out [join $::antidrone(trojan_nicklist)]
   antidrone_out $channel $nickname "Dronenicklist: $out"
}

###################################################################################################################################
#                  antidrone_save
###################################################################################################################################

proc antidrone_save { } {
   # if no file exists create a new one
   if { ! [file exists dronenicklist.txt] } {
      set file [open dronenicklist.txt a]
      close $file
   }
   # delete old save file
   file delete dronenicklist_save.txt
   # rename the old nicklist file to a new one (to prevent lost of all data incase of a botcrash...)
   file rename dronenicklist.txt dronenicklist_save.txt
   # create the original file new
   set file [open dronenicklist.txt a]
   set ::antidrone(trojan_nicklist) [string tolower $::antidrone(trojan_nicklist)]
   set ::antidrone(trojan_nicklist) [lsort -unique $::antidrone(trojan_nicklist)]
   set ::antidrone(trojan_nicklist) [lsort $::antidrone(trojan_nicklist)]
   foreach nick $::antidrone(trojan_nicklist) {
      puts $file $nick
   }
   close $file
   antidrone_read
}

###################################################################################################################################
#                  antidrone_read
###################################################################################################################################

proc antidrone_read { } {
   set ::antidrone(trojan_nicklist) [list]
   # if no file exists create a new one
   if { ! [file exists dronenicklist.txt] } {
      set file [open dronenicklist.txt a]
      close $file
   }
   set file [open dronenicklist.txt r]
   set data [read $file]
   foreach nick $data {
      lappend ::antidrone(trojan_nicklist) $nick
   }
   set ::antidrone(trojan_nicklist) [string tolower $::antidrone(trojan_nicklist)]
   set ::antidrone(trojan_nicklist) [lsort -unique $::antidrone(trojan_nicklist)]
   set ::antidrone(trojan_nicklist) [lsort $::antidrone(trojan_nicklist)]
   return $::antidrone(trojan_nicklist)
}
   
###################################################################################################################################
#                  procs from mytools.tcl
###################################################################################################################################
# string2pattern; lremove

proc lremove { list what } {
   while { [set pos [lsearch -exact $list $what]] != -1 } {
      set list [lreplace $list $pos $pos]
   }
   return $list
}

proc string2pattern { text } {
   regsub -all -- {(\\|\[|\]|\{|\}|\.|\+|\?|\(|\)|\||\*)} $text {\\\1} text
   return $text
}

###################################################################################################################################
#                  putlog/copyright
###################################################################################################################################

putlog "*** antidrone.tcl by sKy\\ loaded. ***"
# This script is under GNU General Public License! For more infos see the script header!


If you want some preadded dronenicknames you can add this list to the dronenicklist.txt (please read the script description).
Quote:
alysia
anita
april
aquila
ara
bakatje
bettina
bisxm
blenda
briana
bridget
camille
cara
carla
chelsea
clarissa
danielle
daria
donna
dora
doris
ebony
eliza
emily
eve
evelyn
faith
gilda
haley
helga
holly
ida
idona
isabel
jay
jewel
joanna
julie
juliet
kacey
kassia
lara
laura
linda
lisa
lolita
lynn
maia
metin
mimi
minky
myra
natalie
nicole
nora
nova
queen
rae
rita
rosa
ruby
scorpion
silver
ula
uma
valora
vanessa
vicky
violet
vivian
walla
wendy
willa
xandra
xxx
zilya


Last edited by sKy on Sat Sep 24, 2005 4:09 am; edited 2 times in total
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Sep 11, 2005 4:32 am    Post subject: Reply with quote

what if that monkey dronemaster's girlfriends nicks are not on your list? Wink
Back to top
View user's profile Send private message Visit poster's website
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Sun Sep 11, 2005 4:36 am    Post subject: Reply with quote

Won`t get banned but,
If them are not on that list the bot will suggest you via putlog to add this nickname. You`ll just need to copy + paste that command if you think it`s a possible dronenick....

To add them you can simply use a dcc or publik command.

I think it`s a really bad idea to ban all nicknames which match nicknameDigit,digit cause this will affect to many real users.
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Sep 11, 2005 4:51 am    Post subject: Reply with quote

well you can't sit on bot's partyline all the time, adding drone nicks...

my point was, unless you can somehow automate drone nick recognition - which is immensely difficult per se - such script won't be much of a use (I have nothing but respect for your effort though), since most modern drones generate random nicks that are pretty quasi-natural

I don't know about qnet, but on the other major networks I haven't seen drones that match the patterns you are using for years (not that I'm too active or sit on many channels but nevertheless)
Back to top
View user's profile Send private message Visit poster's website
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Sun Sep 11, 2005 6:18 am    Post subject: Reply with quote

indeed. this script just kicks those type of infected clients. i see them more and more and them are easy to beat, with that reason i have done that script. most nicknames of this type of spambots should be already added.

it`s just 1 of '20' scripts which you can use if you want to get all bots outside...
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Sep 11, 2005 12:27 pm    Post subject: Reply with quote

my guess is, there isn't a script that has any effect on at least 70% of the drone bots out there, because of the aforementioned reason
Back to top
View user's profile Send private message Visit poster's website
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Sun Sep 11, 2005 12:49 pm    Post subject: Reply with quote

You`re right, each time Wink

But well, the idea of the antiproxy.tcl by Metroid does a good job. Won`t effect up to 70% but it`s helpful imho.
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Sun Sep 11, 2005 9:39 pm    Post subject: Reply with quote

sKy wrote:
indeed. this script just kicks those type of infected clients.

Infcted? Infected with what? Female users DO like to use female nicks!

PS: Does the TCL world need yet another useless bloat coded script that's basically useless?
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Mon Sep 12, 2005 12:23 pm    Post subject: Reply with quote

Well, i`ve never seen any real girl on irc which use a nickname like walla29. Seams that those kind of spambots are not present on your network/channels.

This are no real users for sure. Them send private messages and try to send you files via dcc. If you klick on any hotlink or execute the file then you`re likely infected too with that virus/backround programm.

PS: Could you be please a little bit more exactly and more friendly? Thank you Smile.
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon Sep 12, 2005 8:59 pm    Post subject: Reply with quote

sKy wrote:
Well, i`ve never seen any real girl on irc which use a nickname like walla29. Seams that those kind of spambots are not present on your network/channels.

DALnet Razz

And there ARE female users that do use female nicks with the odd number or two in them for whatever reason.

As for banning nicks that contain numerals, a simple regexp would do it without having to add endless lines of nicks.
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Tue Sep 13, 2005 12:52 am    Post subject: Reply with quote

Well, i`ve thinked about that but this will affect to many users, like:
sad'back'at'21 Surprised)

And at least... This isn`t a modern type of spambot. Most nicknames are already added and the developers of this bots don`t stress that much actual.

EDIT: small kick bug in script fixed.
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 Support & Releases 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