blacklisted channels detection

By [|Red-X|] on Aug 10, 2004

this snippet is to detect blaklisted channels to a user who are trying to join your protected channels. if it;s detected than users will be kick + ban from your channel. Pls be notice that such a script can only be effective if blacklisted channels do not set to +s, and if you have identical raw events like in group #visible already in your existing remote scripts, in order to avoid conflicting i suggest to remove the existing identical raw codes

;Black-listed channels detection addon coded by [|Red-X|] at: m_aditya@kaskus.com
on !*:join:%protchannels: {
  if (%detectchannel == 1)  { _whois $cid $chan $nick }
}
alias -l _whois {
  .timervis off 
  if ($group(#visible) == on) _setvisible 
  %_cid = $1 | %_chan = $2 
  set %chan [ $+ [ $+(%_cid,%_chan) ] ] $2 
  whois $3
}
#visible on
raw 301:*: recho :: $2 is Away > $3- | halt
raw 311:*:{ 
  recho ::Start /Whois $2
  recho ::Nick-Name > $2 
  recho ::Real-Name > $6- 
  recho ::Address: $3 $+ @ $+ $4  
  var %aNc = $AClones($2) 
  if (!%aNc) recho ::Clones: 4(none4) 
  else recho ::Clones: %aNc Total: 4( $+ $numtok(%aNc,59) $+ 4)  
  halt
}
raw 312:*: recho ::Server  > $3  | halt
raw 310:*: recho ::Helper  > Yes | halt
raw 313:*: recho ::IRCop   > Yes | halt
raw 309:*: recho ::Services Admin > Yes | halt
raw 307:*: recho ::Registered > Yes | halt
raw 308:*: recho ::Server Admin > Yes | halt
raw 317:*: recho ::Idle > $3 second(s) | halt
raw 319:*: recho ::Channels > $3- | halt
#visible end
#rawchannels off
raw 319:*:{ 
  haltdef
  if ($checkchan($3-) == $true) {
    if ($me isop %chan [ $+ [ $+(%_cid,%_chan) ] ]) { kick %chan [ $+ [ $+(%_cid,%_chan) ] ] $2 $+(%badchan,<-,%reason) | scid %_cid mode %chan [ $+ [ $+(%_cid,%_chan) ] ] +b %badadd  }
    _asslog | .aline -p @Bad-Channels 12 $timestamp 12[ $+ $2 $+ 12] [ $+ %badadd $+ 12] %chan [ $+ [ $+(%_cid,%_chan) ] ] is also on %badchan 4[badchannel4] | unset %badchan %badadd %chan [ $+ [ $+(%_cid,%_chan) ] ]
    goto end
  }
  elseif (%c_whois [ $+ [ $+($cid,$2) ] ]) { unset %c_whois* | recho ::Blacklisted-channels unable to resolve on $2 }
  :end
  .timervis -i 1 3 _setvisible 
}
raw 301:*: { halt }
raw 312:*: { halt }
raw 311:*: { %badadd = $3 $+ @ $+ $4 | halt }
raw 313:*: { halt }
raw 317:*: { halt }
raw 318:*: { halt }
raw 307:*: { halt }
#rawchannels end
alias recho echo $color(info) -a $1-
alias AClones {
  if ($ial($address($1,2),0) == 1) return
  var %nc = 1, %aClones = $1
  while (%nc < $ial($address($1,2),0)) { 
    %aClones = $addtok(%aClones,$ial($address($1,2),%nc).nick,59)
    inc %nc 
  }
  return %aClones
}
alias _setvisible { $iif($group(#visible) == on,.disable,.enable) #visible | $iif($group(#visible) == off,.enable,.disable) #rawchannels }
alias -l thisspam {
  if ($hfind($1,$2, 1, n)) { %badchan = $v1 | %reason = $hget($1,$v1) | return 1 }
  return 0
}
alias -l checkchan {
  var %n = $numtok($1-,32)
  while (%n) {
    if ($thisspam(badchannels,$gettok($1-,%n,32))) { return $true }
    dec %n
  }
  return $false
}
alias _asslog  {
  if ($window(@Bad-Channels)) { return }
  window -elk0 @Bad-Channels Tahoma 11
  aline -p @Bad-Channels ---------------------------------------------------------------------------
  aline -p @Bad-Channels :: Black-Listed Channels Detection log in here... 
  aline -p @Bad-Channels ---------------------------------------------------------------------------
  .timerasslog 1 2 window -b @Bad-Channels
}
alias -l viewchans {
  _asslog
  aline -p @Bad-Channels Black-Listed Channels:
  var %n = $hget(badchannels,0).item, %i = 1
  while (%i <= %n) {
    aline -p @Bad-Channels [ $+ %i $+ ] $hget(badchannels,%i).item : $hget(badchannels,%i).data
    inc %i
  }
  aline -p @Bad-Channels -----end------
}
alias bcsave hsave -o badchannels badchannels\badchannels.htb 
on *:start: if (!$hget(badchannels)) .hmake badchannels 10 |  if ($exists(badchannels\badchannels.htb)) { .hload badchannels badchannels\badchannels.htb }
on *:load:{  if ($version >= 6.16) { if (!$isdir(badchannels)) { mkdir badchannels } } |  else { echo -s * This addon can only be loaded into mIRC 6.16 or greater. Please upgrade | .unload -rs $script  } }
on *:exit::hfree -w *
menu menubar,channel {
  $iif($active ischan,#,Channel to protect)
  .$iif($istok(%protchannels,#,44),[Del],[Add]) # : $iif($istok(%protchannels,#,44),set %protchannels $remtok(%protchannels,#,1,44),set %protchannels $addtok(%protchannels,#,44)) | recho ::Protected Channels (channels which are not accepting users who also joined blacklisted channels) :  $+ $replace(%protchannels,$chr(44),$chr(32))
  -
  &Black-Listed Channels
  .Detect Channels ( $+ $iif(%detectchannel,On,Off) $+ )
  ..&Turn $iif(%detectchannel,Off,On):%detectchannel = $iif(%detectchannel == 1,0,1) 
  .- 
  .&Channel list
  ..$iif(!$hget(badchannels,0).item, $style(2)) View: viewchans
  ..&Add : var %chan = $$input(Type #channel name that you want to add. for i.e: #sex , e, Add Blacklisted-Channel?), %what = $input(Type Description of the channel and it's also to be your kick message for.i.e: Get out from this sex channel be4 joining our room, e, Channel description/kick-messages) | hadd -ms badchannels %chan %what | bcsave
  ..&Del. : var %chan = $$input(Type #channel name that you want to delete for i.e: #sex, e, Delete Blacklisted-Channel?) | hdel -s badchannels %chan | bcsave
  ..- 
  ..$iif(!$hget(badchannels,0).item, $style(2)) &Clear All: hdel -sw badchannels * | bcsave
}
menu nicklist {
  Whois: .enable #visible | whois $$*
  Check $snick($active,1) : %c_whois [ $+ [ $+($activecid,$$1) ] ] = 1 | _whois $activecid $active $$1
}
menu @Bad-Channels {
  dclick window -c @Bad-Channels 
  Copy: clipboard $sline($active,1)
  Clear screen: dline -s 4 $+ -
  -
  $iif($left($gettok($sline($active,1),2,32),1) == $chr(35), del. $gettok($sline($active,1),2,32)):var %ln = $sline($active,1).ln | hdel -s badchannels $gettok($sline($active,1),2,32) | dline -s %ln $+ - $+ %ln 
  -
  Close: .window -c $active
}
;eos
;notes : if you have identical raw events like in group #visible already in your existing remote scripts, in order to avoid conflicting i suggest to remove the existing raw codes, and if you use older version than mIRC 6.16 pls replace $v1 with $ifmatch on alias thisspam
;a script like this one will only be effective if blacklisted channel doesn't set to +s that whois raw reply on a user can show all channels currently joined.

Comments

Sign in to comment.
fahadmehar   -  Apr 17, 2017
  • Added item '#sex' to hash table 'badchannels'
  • /hsave: unable to open file 'C:\Users\MULTI\AppData\Roaming\mIRC\badchannels\badchannels.htb' (line 94, remote.ini)
 Respond  
bravo1432   -  Sep 01, 2014

can any one do favour i need a dialoge in which i can scan my channel for bad channels at any time

 Respond  
Cheiron   -  May 09, 2009

dont echo the whois to the active window. echo it to the status window using the echo -s

 Respond  
thamer   -  May 09, 2009

how do i change it from !~dennie@187.132.44.73 to !*@187.132.44.73 bans IP only ?

 Respond  
Lanten   -  Aug 14, 2007

basically, i don\'t think i am in the position to say looking \'at\'.. since i am not very good in script analysis, but, looking \'for\'? LOL.

 Respond  
Anti   -  Aug 14, 2007

Looking at the most BEST scripts Laten :D?

 Respond  
Lanten   -  Aug 14, 2007

i have the same question with Corne..

 Respond  
thurdy   -  Oct 20, 2006

also, is there a way for the whois of each user to not really show up on my windows? coz i have several chans protected and all those windows usually get filled up with just the whois of all the users showing up on the windows.. i really need some help, im not really that good at analyzing the script.. thanks.

 Respond  
Corne   -  Nov 09, 2004

[|Red-X|] Can you answer me pls ? why your code for bad channels doesn`t ban persons who are in bad channels but they have OP or VOICE ? what should i modify in there to work ? and ..... can i set a bad channel like this : #channel* ..... all channels who starts with \"channeL\" to be bad channels ?

 Respond  
Corne   -  Nov 07, 2004

If a person who is operator in a bad channel and he joins in a protected channel why he is not taking ban ?

 Respond  
brake   -  Sep 03, 2004

very good writer...

 Respond  
[|Red-X|]   -  Aug 23, 2004

it\'s happened because you have no badchannels folder already exist in mirc directory.... so i add it to automatically created when the script loaded, repaste this snippet into your editor..

 Respond  
Maudit   -  Aug 23, 2004
  • /hsave: unable to open \'C:\RCI\badchannels\badchannels.htb\' (line 93, badchan.mrc) <- I get this error when Trying to add a new channel, and It doesn\'t detect the add chanenl ( and the chan isn\'t on +s )
 Respond  
[|Red-X|]   -  Aug 10, 2004

channel mode can only be change by some one who access in that channel..

 Respond  
xtr   -  Aug 10, 2004
 Respond  
xtr   -  Aug 10, 2004
 Respond  
tsunamione   -  Aug 10, 2004

can it be set to have +s mode off? for an open channel visable in the /list

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.