Advertisement
Guest User

Untitled

a guest
Sep 4th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.32 KB | None | 0 0
  1. ###############################
  2. # DESCRIPTION #
  3. ###############################
  4. #
  5. #For DCC spam bot will check for following files :- .zip .exe .vbs .rar .ini .htm .html .txt .com .bat .org .net
  6. #
  7.  
  8. ###############################
  9. # HOW TO ENABLE CHANNEL CYCLE #
  10. ###############################
  11. ## To enable bot to cycle channel after specific time DCC to the bot and give the command below
  12. # COMMAND : .chanset #your_chan +advertisecycle (TO ENABLE)
  13. # COMMAND : .chanset #your_chan -advertisecycle (TO DISABLE)
  14. ## The channel cycling wont work untill you will not enable it
  15.  
  16. ######################################################
  17. # HOW TO ENABLE BOT TO MSG AT CHANNEL TO DETECT SPAM #
  18. ######################################################
  19. ## To enable bot to msg channel after specific time DCC to the bot and give the command below
  20. # COMMAND : .chanset #your_chan +msgchan (TO ENABLE)
  21. # COMMAND : .chanset #your_chan -msgchan (TO DISABLE)
  22. ## The channel messaging wont work untill you will not enable it
  23.  
  24.  
  25. #########################
  26. # CONFIGURATION SECTION #
  27. #########################
  28.  
  29. ## Set the channels here on which you want this script to work
  30. # Seperate channels by Space like "#channel1 #channel2 #channel3"
  31. # If you want this script to work on all the channels where ur bot is parked leave it as ""
  32.  
  33. set advertisechans "#playnation"
  34.  
  35. ##Set Advertising words here on which you want your bot to kick user
  36. #You can manually add advertising words in the way mentioned below ( *WILD CARDS SUPPORTED* )
  37. # set advertisingword {
  38. # "*word1*"
  39. # "*word2*"
  40. # }
  41.  
  42. set advertisingword {
  43. # "*bitch*"
  44. # "*cunt*"
  45. # "*whore*"
  46. }
  47.  
  48. #Set how many times you want the bot to warn the user advertising before baning him out of channel
  49. ## To Disable set it to 0
  50. #Set it to 0 if you want to ban the user without giving warning.
  51. set uwarn 0
  52.  
  53. #set the Warning MSG you want bot to deliver
  54. #It will not work if the above setting is set to zero
  55.  
  56. set warnmsg "Do not Advertise."
  57.  
  58. #Set time Below after which you want your bot to cycle the channel (in Minutes)
  59. #After this time bot will cycle the channel and will detect advertisements if found will kick out
  60. set advcycletime "15"
  61.  
  62. #Set the time after which you want to msg the channel for which you enabled +msgchan
  63. #After this time bot will msg that channel to detect spam
  64. set spammsg "25"
  65.  
  66. #Set the Msg you want bot to post to the channel [Would work only if enabled through partylines]
  67. set mspam ""
  68.  
  69. #Set the message below you want to give while bot parting channel
  70. set partspam "wait.. wat?!"
  71.  
  72. # Set the banmask type to use in banning the User who Advertises.
  73. # Currently BAN Type is set to 1 (*!*@some.domain.com),
  74. # BAN Types are given below;
  75. # 1 - *!*@some.domain.com
  76. # 2 - *!*@*.domain.com
  77. # 3 - *!*ident@some.domain.com
  78. # 4 - *!*ident@*.domain.com
  79. # 5 - *!*ident*@some.domain.com
  80. # 6 - *nick*!*@*.domain.com
  81. # 7 - *nick*!*@some.domain.com
  82. # 8 - nick!ident@some.domain.com
  83. # 9 - nick!ident@*.host.com
  84. set advbantype "1"
  85.  
  86. #Set the Users Mode you want to Exempt
  87. #The Bot will not kick the user who had the modes you will define below
  88. #You can leave it as it is , if you dont know about it
  89. #Recommended : of
  90. set advusers "of"
  91.  
  92. ###################
  93. # SET KICK REASON #
  94. ###################
  95.  
  96. ## Set Kick Reason for spam on channel or Advertise on channel
  97. # The user will be kicked using this reason when someone advertise / Spam on the main of channel
  98. set advertisekick "[Banned] Do not Advertise."
  99.  
  100. ## Set the kick Reason for DCC spam
  101. # After cycling or if bot detects someone sending file to it the bot will kick the user using this reason
  102. set dccspamkick "[Banned] DCC spam detected."
  103.  
  104. ## Set kick reason for Private Spam
  105. # The user will be kicked using this reason when someone advertise / spam in the private of bot
  106. set pvtspamkick "[Banned] Onjoin bot detected."
  107.  
  108. # ALL THE BINDS #
  109.  
  110. setudef flag advertisecycle
  111. setudef flag msgchan
  112. bind msgm - * privatespam:RanaUsman
  113. bind ctcp - DCC RanaUsman:dcc
  114. bind pubm - * advertising:RanaUsman
  115. bind EVNT - init-server pStartTimer
  116. bind EVNT - init-server pmsgchan
  117.  
  118. # ALL THE PROCEDURES #
  119. #This proc is to detect channel advertisements
  120. proc advertising:RanaUsman {nick uhost hand chan text} {
  121. global advertisingword advertisechans advertisekick banmask advusers adver warnmsg uwarn
  122. #This checks for enabled channels for advertisescript
  123. if {(([lsearch -exact [string tolower $advertisechans] [string tolower $chan]] != -1) || ($advertisechans == ""))} {
  124. set text [advertise:filter $text]
  125. set banmask "[advs:banmask $uhost $nick]"
  126. #this detects if there is some advertising word found :-)
  127. foreach advertising [string tolower $advertisingword] {
  128. if {[string match -nocase $advertising $text] || [string match -nocase "* $advertising *" $text] || [string match -nocase "$advertising *" $text] || [string match -nocase "* $advertising" $text]} {
  129. if {[matchattr $hand $advusers] || [isbotnick $nick]} { return 0 } else {
  130. # doing counter
  131. if { ![info exists adver($uhost)] } {
  132. set adver($uhost) "0"
  133. } else {
  134. incr adver($uhost)
  135. }
  136. if { $adver($uhost) < $uwarn } {
  137. putserv "privmsg $chan :\002$nick\002 : $warnmsg"
  138. return
  139. }
  140. putquick "MODE $chan +bb $banmask"
  141. putquick "KICK $chan $nick :$advertisekick"
  142. }
  143. }
  144. }
  145. }
  146. }
  147. # this proc will detect for pvt spam
  148. proc privatespam:RanaUsman {nick uhost hand text} {
  149. global spampvt advertisingword advertisechans pvtspamkick banmask advusers
  150. set text [advertise:filter $text]
  151. set banmask "[advs:banmask $uhost $nick]"
  152. foreach advertising [string tolower $advertisingword] {
  153. if {[string match -nocase $advertising $text] || [string match -nocase "* $advertising *" $text] || [string match -nocase "$advertising *" $text] || [string match -nocase "* $advertising" $text]} {
  154. #below is the action bot will take against spammer and detects it if he is in channel
  155. foreach onchans [channels] {
  156. if {[onchan $nick $onchans]} {
  157. if {[matchattr $hand $advusers] || [isbotnick $nick]} { return 0 } else {
  158. utimer 2 [list putquick "MODE $onchans +bb $banmask"]
  159. utimer 3 [list putquick "KICK $onchans $nick :$pvtspamkick"]
  160. }
  161. }
  162. }
  163. }
  164. }
  165. }
  166. # This proc will check for DCC spam
  167.  
  168. proc RanaUsman:dcc {nick uhost handle dest key arg} {
  169. global dccspamkick rusman onechans banmask advertisechans advusers dccspamword
  170. set banmask "[advs:banmask $uhost $nick]"
  171. set rusman [string tolower [lindex $arg 1]]
  172. if {[string match "*.exe" $rusman] || [string match "*.bat" $rusman] || [string match "*.vbs" $rusman] || [string match "*.html" $rusman] || [string match "*.htm" $rusman] || [string match "*.com" $rusman] || [string match "*.net" $rusman] || [string match "*.org" $rusman] || [string match "*.ini" $rusman] || [string match "*.zip" $rusman] || [string match "*.rar" $rusman]} {
  173. foreach onchans [channels] {
  174. if {[onchan $nick $onchans]} {
  175. if {[matchattr $handle $advusers] || [isbotnick $nick]} { return 0 } else {
  176. utimer 2 [list putquick "MODE $onchans +bb $banmask"]
  177. utimer 3 [list putquick "KICK $onchans $nick :$dccspamkick"]
  178. }
  179. }
  180. }
  181. }
  182. }
  183.  
  184. #Here is the proc which will let bot towards cycling channel - Thanks to arfer #tcl @dalnet for correcting it
  185.  
  186. proc pStartTimer {type} {
  187. pScheduleTimer
  188. }
  189.  
  190. proc pScheduleTimer {} {
  191. global advcycletime
  192. foreach item [timers] {
  193. if {[string equal "RanaUsman:cycle" [lindex $item 1]]} {
  194. killtimer [lindex $item 2]
  195. }
  196. }
  197. timer $advcycletime RanaUsman:cycle
  198. }
  199.  
  200. proc RanaUsman:cycle {} {
  201. global advcycletime
  202. global partspam
  203. foreach chan [channels] {
  204. if {[channel get $chan advertisecycle]} {
  205. putserv "PART $chan :$partspam"
  206. }
  207. }
  208. pScheduleTimer
  209. }
  210.  
  211. #It will msg channel after every 15 mins to detect spam
  212.  
  213. proc pmsgchan {type} {
  214. pmsgtimer
  215. }
  216.  
  217. proc pmsgtimer {} {
  218. global spammsg
  219. foreach item [timers] {
  220. if {[string equal "RanaUsman:checkspam" [lindex $item 1]]} {
  221. killtimer [lindex $item 2]
  222. }
  223. }
  224. timer $spammsg RanaUsman:checkspam
  225. }
  226.  
  227. proc RanaUsman:checkspam {} {
  228. global advcycletime
  229. global partspam mspam
  230. foreach chan [channels] {
  231. if {[channel get $chan msgchan]} {
  232. putserv "PRIVMSG $chan :$mspam"
  233. }
  234. }
  235. pmsgtimer
  236. }
  237.  
  238.  
  239. #Thanks to someone for this control code removing filter i dont remember his name :-)
  240. proc advertise:filter {str} {
  241. regsub -all -- {\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\037|\002|\026|\006|\007} $str "" str
  242. return $str
  243. }
  244. # Different types of BAN for bot to do :-)
  245.  
  246. proc advs:banmask {uhost nick} {
  247. global advbantype
  248. switch -- $advbantype {
  249. 1 { set banmask "*!*@[lindex [split $uhost @] 1]" }
  250. 2 { set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
  251. 3 { set banmask "*!*$uhost" }
  252. 4 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
  253. 5 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
  254. 6 { set banmask "*$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
  255. 7 { set banmask "*$nick*!*@[lindex [split $uhost "@"] 1]" }
  256. 8 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split $uhost @] 1]" }
  257. 9 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
  258. default { set banmask "*!*@[lindex [split $uhost @] 1]" }
  259. return $banmask
  260. }
  261. }
  262.  
  263. putlog "\002PLAYNATION - SPAMSCAN V1.1.0"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement