PDA

View Full Version : [Filled] Standalone BNC script (based off dZSbot)


godlike
06-29-2004, 12:17 PM
I have taken some code from dZSbot and tried to make a BNC test script for all my sites which test all sites from a single location and puts back the result in a notice to a user... but the script worked for a few days and some day i just started the bot and i always get when i do !bnc on chan this error on partyline:

TCL error [proc_bnc]: invalid command name "replacevar"
The code is probably a mess :)
And in c:/ioFTPD/bot/scripts/ i have the ncftpls.exe

The code is:


set bncchecking "1"
set cmdpre "!"

# SETUP THIS ONLY IF YOU HAVE BNC for your SERVER
set bnc(LIST) "192.168.0.0:7755 193.45.56.23:6655"
set bnc(NAME) "site1 site2"
set bnc(SECTIONS) "PC-GAMES|Divx-Xvid|MP3 MP3|DivX-XviD"
set bnc(USER) "bncuser"
set bnc(PASS) "bncpass"
set bnc(TIMEOUT) 10

set announce(BNC) "%color7%sitename%color * ( %bold%host%bold ) * ( %status ) * %bold%color7%sections%color%bold"

set binary(NCFTPLS) "c:/ioFTPD/bot/scripts/ncftpls.exe"

set disable(NCFTPLS) 0

# set the blowfish encrytion key (empty = no encryption)
set blfs(KEY) ""

# set the blowfish header tag
set blfs(HEADER) "mcps"

set procs {
${cmdpre}bnc:proc_bnc
}

bind pub -|- [set cmdpre]bnc proc_bnc

proc sndchan {puttype nick args} {
global splitter blfs
foreach line [split [lindex $args 0] $splitter(CHAR)] {
if { $blfs(KEY) != "" } {
set eline [encrypt $blfs(KEY) $line]
$puttype "NOTICE $nick :$blfs(HEADER) $eline"
} else {$puttype "NOTICE $nick :$line"}
}
}

proc proc_bnc { nick uhost hand chan arg } {
global bnc announce binary disable
if { $disable(NCFTPLS) == 0 } {
foreach eachbnc $bnc(LIST) eachname $bnc(NAME) eachsection $bnc(SECTIONS) {
if {$eachbnc == ""} {continue}
set output $announce(BNC)
set now1 [clock clicks -milliseconds]
set status [catch { exec -- $binary(NCFTPLS) -u $bnc(USER) -p $bnc(PASS) -t $bnc(TIMEOUT) -r 00 ftp://$eachbnc } result]
set now2 "Response time: %bold[expr ([clock clicks -milliseconds] - $now1)]%boldms"
if { ([regexp \[.\]*ncftpls\:\ cannot\ open\[.\]* $result] > 0) } { set bncchk "%bold%color4DOWN%color%bold" ; set bncspeed "" } else { set bncchk "%bold%color9UP%color%bold" ; set bncspeed $now2 }
set output [replacevar $output "%host" $eachbnc]
set output [replacevar $output "%status" $bncchk]
set output [replacevar $output "%speed" $bncspeed]
set output [replacevar $output "%sitename" $eachname]
set output [replacevar $output "%sections" $eachsection]
set output [basicreplace $output "BNC"]
sndchan "puthelp" $nick $output
}
}
}

proc basicreplace {strin section} {
#putlog "proc basicreplace"
global bncchecking
set output [replacevar $strin "%bncchecking" $bncchecking]
set output [replacevar $output "%bold" "\002"]
set output [replacevar $output "%color" "\003"]
set output [replacevar $output "%uline" "\037"]
return "$output"
}


All the names ip`s and such things in this post are made up.

tuff
06-29-2004, 01:17 PM
where is the replacevar proc? ;)

jeza
06-29-2004, 01:19 PM
there is a missing proces replacevar


proc replacevar {strin what withwhat} {

set output $strin
set replacement $withwhat
set cutpos 0
while { [string first $what $output] != -1 } {
set cutstart [expr [string first $what $output] - 1]
set cutstop [expr $cutstart + [string length $what] + 1]
set output [string range $output 0 $cutstart]$replacement[string range $output $cutstop end]
}
return $output
}

godlike
06-29-2004, 01:43 PM
HAHA damn im blind LOL

Thx ... hahahahaha :D

buffi
08-02-2004, 08:43 AM
Hi All,
I also used that script and managed to get it working but it announces only if the windrop is also running dszbot.tcl
without that it wont announce on the channel. I want it to be a selfscript.

this is the script :

set bncchecking "1"
set cmdpre "!"

# SETUP THIS ONLY IF YOU HAVE BNC for your SERVER
set bnc(LIST) "localhost:4147"
set bnc(NAME) "Home"
set bnc(SECTIONS) "GAMES/APPS"
set bnc(USER) "SiteBoT"
set bnc(PASS) "12345678"
set bnc(TIMEOUT) 10

set announce(BNC) "%bold%color0%sitename%color%bold - %bold%color12%sections:%color%bold%color0 %host is%color %status"

set binary(NCFTPLS) "C:/WINDOWS/system32/Setup/Driver/ioFTPD/windrop/scripts/ncftpls.exe"

set disable(NCFTPLS) 0

# set the blowfish encrytion key (empty = no encryption)
set blfs(KEY) ""

# set the blowfish header tag
set blfs(HEADER) "mcps"

set procs {
${cmdpre}bncroc_bnc
}

bind pub -|- [set cmdpre]bnc proc_bnc

proc sndchan {puttype chan args} {
global splitter blfs
foreach line [split [lindex $args 0] $splitter(CHAR)] {
if { $blfs(KEY) != "" } {
set eline [encrypt $blfs(KEY) $line]
$puttype "PRIVMSG $chan :$blfs(HEADER) $eline"
} else {$puttype "PRIVMSG $chan :$line"}
}
}

proc proc_bnc { nick uhost hand chan arg } {
global bnc announce binary disable
if { $disable(NCFTPLS) == 0 } {
foreach eachbnc $bnc(LIST) eachname $bnc(NAME) eachsection $bnc(SECTIONS) {
if {$eachbnc == ""} {continue}
set output $announce(BNC)
set now1 [clock clicks -milliseconds]
set status [catch { exec -- $binary(NCFTPLS) -u $bnc(USER) -p $bnc(PASS) -t $bnc(TIMEOUT) -r 00 ftp://$eachbnc } result]
set now2 "Response time: %bold[expr ([clock clicks -milliseconds] - $now1)]%boldms"
if { ([regexp \[.\]*ncftpls\:\ cannot\ open\[.\]* $result] > 0) } { set bncchk "%bold%color4DOWN%color%bold" ; set bncspeed "" } else { set bncchk "%bold%color9UP%color%bold" ; set bncspeed $now2 }
set output [replacevar $output "%host" $eachbnc]
set output [replacevar $output "%status" $bncchk]
set output [replacevar $output "%speed" $bncspeed]
set output [replacevar $output "%sitename" $eachname]
set output [replacevar $output "%sections" $eachsection]
set output [basicreplace $output "BNCS"]
sndchan "puthelp" $nick $output
}
}
}

proc basicreplace {strin section} {
#putlog "proc basicreplace"
global bncchecking
set output [replacevar $strin "%bncchecking" $bncchecking]
set output [replacevar $output "%bold" "\002"]
set output [replacevar $output "%color" "\003"]
set output [replacevar $output "%uline" "\037"]
return "$output"
}
proc replacevar {strin what withwhat} {

set output $strin
set replacement $withwhat
set cutpos 0
while { [string first $what $output] != -1 } {
set cutstart [expr [string first $what $output] - 1]
set cutstop [expr $cutstart + [string length $what] + 1]
set output [string range $output 0 $cutstart]$replacement[string range $output $cutstop end]
}
return $output
}


where do i need to set the channel that i want it to post on???

pls help thanks