View Single Post
Old 12-06-2007, 05:04 AM  
razoor
Senior Member
 
Join Date: Oct 2006
Posts: 163
Default change SiteCMD script so it can unban/approve from irc

Could annyone help me with this script.
Add unnuke and approve to it??
I did try, but i only managed to break it.
It+s for odogs dzsbot

Quote:
################################################## #########
#
#
#
# Gives site command for use with pzs-ng bot.
# Depends on ftp.tcl and tls lib included in the package.
# Installation:
# 1. Copy tls1.5 dir to windropdir/lib/tcl8.4/
# 2. edit sitecmd.tcl to fit your site
# 3. Load ftp.tcl in eggdrop config
# 4. Load sitecmd.tcl in eggdrop config
#
# if your site doesn't use tls/ssl open ftp.tcl and change:
# set USETLS 1 to set USETLS 0
#
# Make sure that the user has the flags nessecery for the functions you want
#
#
# 2007-09-02 Added !nuke <releasename> multi reason
# it looks through ioftpd.log for pwd to release
# if found it nukes it.
# Don't have nxtools backup the log too often.
# !site nuke still works too but if you use that
# you need to include the pwd
#

#ip to the site, use local ip if it's possible.
set sc(ftp_ip) "my.secret.dns"

#Ftp username
set sc(ftp_user) "secret"

#password to ftp
set sc(ftp_pass) "secret"

#Ftp port
set sc(ftp_port) "3685"

#channel for response and trigger, it will only work in this chan.
set sc(ftp_chan) "#hej"


############################### END OF CONFIG #################################

bind pub -|- !a1site site_cmd
bind pub -|- !nuke nuke_cmd
bind pub -|- !unnuke unnuke_cmd

if {[catch {package require ftp} errorMsg]} {
putlog "\[ngBot\] SiTECMD :: $errorMsg"
return
}

proc site_cmd {nick uhost handle chan args} {global sc

#check if chan is the correct
if {$chan != $sc(ftp_chan)} {
return
}

#check arguments
if {[lindex $args 0] == ""} {
putquick "PRIVMSG $sc(ftp_chan) :USAGE: !site <command>"
putquick "PRIVMSG $sc(ftp_chan) :EX...: !site addip user *@127.0.0.1"
return
}


set conn [FTP::Open $sc(ftp_ip) $sc(ftp_port) $sc(ftp_user) $sc(ftp_pass)]

if {$conn == 0} {
putquick "PRIVMSG $sc(ftp_chan) : ERROR: Couldn't connect to ftp."
catch {FTP::Close $conn}
return
}

set ftpresponse [FTP::Quote "site $args"]

foreach line [split $ftpresponse \n] {
putquick "PRIVMSG $sc(ftp_chan) :FTP-CDM: $line"
}

catch {FTP::Close $conn}




}



proc nuke_cmd {nick uhost handle chan args} {global glftpdlog sc


#check if chan is the correct
if {$chan != $sc(ftp_chan)} {
return
}

set args [join $args]
set rel [lindex $args 0]
set factor [lindex $args 1]
set reason [lrange $args 2 end]

if {$rel == ""} {
putquick "PRIVMSG $nick :USAGE: !nuke <release> <factor> <reson>"
putquick "PRIVMSG $nick :EX...: !nuke temprelease-2007-iND 3 DUPE.BLA-BLA-BLA"
return

}

if {![string is integer -strict $factor]} {
putquick "PRIVMSG $nick :ERROR: !nuke <release> <factor> <reson>"
putquick "PRIVMSG $nick :EX...: Factor needs to be a number"
return
}

if {$reason == ""} {
set reason "No.Reason"
}

set tempfile [open $glftpdlog(NORMAL) r]
set file [split [read $tempfile] \n]
close $tempfile

set temp [lsearch -regexp -inline "$file" "NEWDIR: \".+?\" \".+?\" \".+?$rel\" \".+?\""]
if {$temp != ""} {
regsub -all {\\} $temp {/} temp
set nuke_pwd [lindex $temp 5]
set nuke_path [lindex $temp 6]
if {![file exists $nuke_path]} {
putquick "PRIVMSG $nick :NUKE: Found \002$rel\002 in log, but it does not exists"
return
}
} else {
putquick "PRIVMSG $nick :Sorry couldn't find $rel in ioftpd.log"
return
}


set conn [FTP::Open $sc(ftp_ip) $sc(ftp_port) $sc(ftp_user) $sc(ftp_pass)]

if {$conn == 0} {
putquick "PRIVMSG $nick : ERROR: Couldn't connect to ftp."
catch {FTP::Close $conn}
return
}

set ftpresponse [FTP::Quote "site nuke $nuke_pwd $factor $reason"]

foreach line [split $ftpresponse \n] {
putquick "PRIVMSG $nick :NUKE: $line"
}

catch {FTP::Close $conn}


}

putlog "\[ngBot\] SiTECMD :: Loaded sucessfully"
razoor is offline   Reply With Quote