mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
var question #177513 26/05/07 08:21 AM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Am using this to check version on join...Is it possible to store bad script names in text file instaed of var?

%CTCP MurderScript stealth.Inviter echoX inviter ozinviter echoxinviter VirusScript

Code:
ON !@*:JOIN:#: {
if (%CTCPREPLY == off) || !%CTCPREPLY || ($nick isop $chan) { return }
if !$($+(%,version.check,.,$fulladdress),2) {
.ctcp $nick VERSION 
set -e $+(%,version.check,.,$fulladdress) 1
}
}
on *:CTCPREPLY:VERSION*: {
var %i = 0
while (%i < $numtok(%ctcp,32)) {
inc %i
var %ctcpreply = $gettok(%ctcp,%i,32)
if ($istok($strip($1-),%ctcpreply,32) == $true) {
VAR %c = 0
while (%c < $comchan($nick,0)) { 
inc %c
if ($me isop $comchan($nick,%c)) {
ban -ku3600 $comchan($nick,%c) $nick 2 14Inviter Script Detected 
}
}
}
}
}

Re: var question [Re: Garou] #177515 26/05/07 09:30 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Sure, you'll just have to do your comparison to read from the text file, rather than checking the token, which, for something like this would actually be better, since you'd also be able to allow for version names that include spaces.

Re: var question [Re: RusselB] #177517 26/05/07 09:43 AM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Can this also be codes so that I dont see or get the version reply in a pm window and just kick ban when it finds a bad script??

Re: var question [Re: Garou] #177523 26/05/07 03:16 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Create a file in the mIRC installation directory called CTCP.txt
Have each line in the file contain one version reply that you want the ban for. Ops can turn the CTCP check on/off via a message to the bot using !ctcp on (or !ctcp off) in either the channel or pm. If the command is sent via pm, then the ctcp checking is turned on/off for all channels in which the person has ops.

Code:
on $*:text:!ctcp[onoff]:*:{
  if $nick isop $chan {
    set $+(%,ctcp,.,$chan) $iif($2 == on,$true,$false)
  }
  elseif !$chan {
    var %a = 1, %b = $comchan($nick,0)
    while %a <= %b {
      if $nick isop $comchan($nick,%a) {
        set $+(%,ctcp,.,$comchan($nick,%a)) $iif($2 == on,$true,$false)
      }
      inc %a
    }
  }
}
on @*:join:#:{
  if $($+(%,ctcp,.,$chan),2) && !$($+(%,version.check,.,$fulladdress),2) {
    .ctcp $nick VERSION 
    set -e $+(%,version.check,.,$fulladdress) $chan
  }
}
on ^*:ctcpreply:version*:{
  if $read(ctcp.txt,nwt,$2-) {
    .ban -ku3600 $($+(%,version.check,.,$fulladdress),2) $nick
  }
}


Re: var question [Re: RusselB] #177532 26/05/07 08:18 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
How can I check if its working? Will i see %ctcp On in var? Because its not kicking or its not working.

Last edited by Garou; 26/05/07 08:46 PM.
Re: var question [Re: Garou] #177536 26/05/07 11:51 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
on $*:text:!ctcp[onoff]:*:{
  if $nick isop $chan {
    set $+(%,ctcp,.,$chan) $iif($2 == on,$true,$false)
    .notice $nick CTCP Version check for $chan is now $iif($($+(%,ctcp,.,$chan),2),On,Off)
  }
  elseif !$chan {
    var %a = 1, %b = $comchan($nick,0)
    while %a <= %b {
      if $nick isop $comchan($nick,%a) {
        set $+(%,ctcp,.,$comchan($nick,%a)) $iif($2 == on,$true,$false)
        .notice $nick CTCP Version check for $comchan($nick,%a) is now $iif($($+(%,ctcp,.,$comchan($nick,%a)),2),On,Off)
      }
      inc %a
    }
  }
}
on @*:join:#:{
  if $($+(%,ctcp,.,$chan),2) && !$($+(%,version.check,.,$fulladdress),2) {
    .ctcp $nick VERSION 
    set -e $+(%,version.check,.,$fulladdress) $chan
  }
}
on ^*:ctcpreply:version*:{
  if $read(ctcp.txt,nwt,$2-) {
    .ban -ku3600 $($+(%,version.check,.,$fulladdress),2) $nick
  }
}


Added a message to show to the person that turns the checking on/off the status of the CTCP checking for the relative channel.

Please note the the version check must match whst's in the text file exactly (case insensitive).

Eg: RusselB's Alias Tracker won't match RusselB's Alias Tracker v2.0

Re: var question [Re: RusselB] #177538 27/05/07 12:14 AM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Its not working bro :P

Re: var question [Re: Garou] #177688 29/05/07 04:54 PM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
At a glance I'd suggest changing this line
  • on $*:text:!ctcp[onoff]:*:{
to this
Code:
on $*:text:/^!ctcp (on|off)/Si:*:{


Edit: Plus the version reply...
Code:
on ^*:ctcpreply:version*:{
  if $($+(%,version.check,.,$fulladdress),2) {
    if $read(ctcp.txt,nwt,$2-) { ban -ku3600 $($+(%,version.check,.,$fulladdress),2) $nick 2 Bad script! }
    unset $+(%,version.check,.,$fulladdress),
    halt
  }
}

Last edited by deegee; 29/05/07 05:00 PM.
Re: var question [Re: deegee] #177734 30/05/07 01:07 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Ok the on anf off is working but its not kicking.

Last edited by Garou; 30/05/07 01:10 PM.
Re: var question [Re: Garou] #177736 30/05/07 02:17 PM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Remove the ^ from this line: on [color:red]^*:ctcpreply:version*:{[/color]
It should be: on *:ctcpreply:version*:{

Re: var question [Re: deegee] #177746 30/05/07 04:25 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Thx its working fine now. Is it possible not to version someone that just login a few minutes ago like antispam bots that cycle channels?

Last edited by Garou; 30/05/07 04:59 PM.
Re: var question [Re: Garou] #178136 05/06/07 06:35 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Can this be change to check any matching word on the line not just the exact word from the CTCP.txt ?
My ctcp.txt reads like this:
oz3
stealth.Inviter
echoX
inviter
ozinviter

Code:
 
on $*:text:/^!ctcp (on|off)/Si:*:{ 
  if $nick isop $chan {
    set $+(%,ctcp,.,$chan) $iif($2 == on,$true,$false)
    .notice $nick CTCP Version check for $chan is now $iif($($+(%,ctcp,.,$chan),2),On,Off)
  }
  elseif !$chan {
    var %a = 1, %b = $comchan($nick,0)
    while %a <= %b {
      if $nick isop $comchan($nick,%a) {
        set $+(%,ctcp,.,$comchan($nick,%a)) $iif($2 == on,$true,$false)
        notice $nick CTCP Version check for $comchan($nick,%a) is now $iif($($+(%,ctcp,.,$comchan($nick,%a)),2),On,Off)
      }
      inc %a
    }
  }
}
on @*:join:#:{
  if $($+(%,ctcp,.,$chan),2) && !$($+(%,version.check,.,$fulladdress),2) {
    .ctcp $nick VERSION 
    set -e $+(%,version.check,.,$fulladdress) $chan
  }
}
on *:ctcpreply:version*:{ 
  if $($+(%,version.check,.,$fulladdress),2) {
    if $read(ctcp.txt,nwt,$2-) { ban -k $($+(%,version.check,.,$fulladdress),2) $nick 2 14Bad Script Detected }
    unset $+(%,version.check,.,$fulladdress),
    halt
  }
}

Last edited by Garou; 05/06/07 06:45 PM.
Re: var question [Re: Garou] #178232 07/06/07 05:41 AM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
If you mean if one of the lines in ctcp.txt is a wildmatch to the version reply, try this
Code:
on *:ctcpreply:version*:{
  if $($+(%,version.check,.,$fulladdress),2) {
    if !$hget(vercheck) { hmake vercheck 10 | hload -n vercheck CTCP.txt }
    if $hfind(vercheck,$strip($2-),1,R).data { ban -k $($+(%,version.check,.,$fulladdress),2) $nick 2 14Bad Script Detected }
    unset $+(%,version.check,.,$fulladdress),
    halt
  }
}


It will, for instance, match "echoX" to
  • echoXscript
  • echoX
  • echoX
    etc


Re: var question [Re: deegee] #178244 07/06/07 01:15 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Ok Thx.

Re: var question [Re: deegee] #178260 07/06/07 03:11 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Not working, exemple: i want to ban #Music-Central or any single word from this version reply:

Central MP3 Script v6.137d beta (get it in #Music-Central on DALnet or from www.jalyn.com/mco/index.html)

Last edited by Garou; 07/06/07 03:18 PM.
Re: var question [Re: Garou] #178261 07/06/07 04:19 PM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
What I didn't give you was a way to update the table from the textfile, sorry.

Replace
Quote:
if !$hget(vercheck) { hmake vercheck 10 | hload -n vercheck CTCP.txt }

with
Code:
    if !$hget(vercheck) { hmake vercheck 10 }
    if $lines(CTCP.txt) { hdel -w vercheck * | hload -n vercheck CTCP.txt }


Also be aware, that this method is case-sensitive.
("#music-central" won't match "#Music-Central")

Re: var question [Re: deegee] #178272 07/06/07 07:29 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Not working, no ban on join.

Quote:


on $*:text:/^!ctcp (on|off)/Si:*:{
if $nick isop $chan {
set $+(%,ctcp,.,$chan) $iif($2 == on,$true,$false)
}
elseif !$chan {
var %a = 1, %b = $comchan($nick,0)
while %a <= %b {
if $nick isop $comchan($nick,%a) {
set $+(%,ctcp,.,$comchan($nick,%a)) $iif($2 == on,$true,$false)

}
inc %a
}
}
}
on @*:join:#:{
if $($+(%,ctcp,.,$chan),2) && !$($+(%,version.check,.,$address),2) {
.ctcp $nick VERSION
set -e $+(%,version.check,.,$address) $chan
}
}
}

on *:ctcpreply:version*:{
if $($+(%,version.check,.,$fulladdress),2) {
if !$hget(vercheck) { hmake vercheck 10 }
if $lines(CTCP.txt) { hdel -w vercheck * | hload -n vercheck CTCP.txt }
if $hfind(vercheck,$strip($2-),1,R).data { ban -k $($+(%,version.check,.,$fulladdress),2) $nick 2 14Bad Script Detected }
unset $+(%,version.check,.,$fulladdress),
halt
}
}



Re: var question [Re: Garou] #178275 07/06/07 08:16 PM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Look at the variables being set, and checked. Somewhere along the line you changed some to $address instead of $fulladdress, but left others. wink

In the join event it is
!$($+(%,version.check,.,[color:red]$address),2)[/color]
$+(%,version.check,.,[color:red]$address)[/color]

while in the ctcpreply event it is
$($+(%,version.check,.,[color:red]$fulladdress),2)[/color]
$+(%,version.check,.,[color:red]$fulladdress)[/color]

They should all be the same.


PLUS: There is an extra closing brace in the join event, so the ctcp event won't even be triggered.

Re: var question [Re: deegee] #178277 07/06/07 08:47 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
This is wat I have now, where is the error?
Quote:


on $*:text:/^!ctcp (on|off)/Si:*:{
if $nick isop $chan {
set $+(%,ctcp,.,$chan) $iif($2 == on,$true,$false)
}
elseif !$chan {
var %a = 1, %b = $comchan($nick,0)
while %a <= %b {
if $nick isop $comchan($nick,%a) {
set $+(%,ctcp,.,$comchan($nick,%a)) $iif($2 == on,$true,$false)

}
inc %a
}
}
}
on @*:join:#:{
if $($+(%,ctcp,.,$chan),2) && !$($+(%,version.check,.,$fulladdress),2) {
.ctcp $nick VERSION
set -e $+(%,version.check,.,$fulladdress),2) $chan
}
}
}

on *:ctcpreply:version*:{
if !$($+(%,version.check,.,$fulladdress),2) {
if !$hget(vercheck) { hmake vercheck 10 }
if $lines(CTCP.txt) { hdel -w vercheck * | hload -n vercheck CTCP.txt }
if $hfind(vercheck,$strip($2-),1,R).data { ban -k $($+(%,version.check,.,$fulladdress),2) $nick 2 14Bad Script Detected }
unset $+(%,version.check,.,$fulladdress),
halt
}
}


Re: var question [Re: Garou] #178278 07/06/07 08:54 PM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Originally Posted By: deegee
PLUS: There is an extra closing brace in the join event, so the ctcp event won't even be triggered.

^ There is the error.

Check that your opening/closing braces are matched. You can use the {} button in the script editor to check them.
Code:
on @*:join:#:{
  if $($+(%,ctcp,.,$chan),2) && !$($+(%,version.check,.,$fulladdress),2) {
    .ctcp $nick VERSION
    set -e $+(%,version.check,.,$fulladdress),2) $chan
  }
}
} <----  This one should not be here!

Page 1 of 2 1 2