Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### PassLog.tcl 1.3.0 EiNWpxqn
- #SUGGESTED
- # PBinSrc.tcl fMrtKqyq
- # TCLLoader.tcl smApj15u
- #LICENSE
- # Copyright © 2013 Alberto Dietze "DoctorD90"
- #
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
- #
- # Full GPLv3 Text: http://www.gnu.org/licenses/gpl.txt
- #PATERNITY
- #Coder: DoctorD90
- #Network: irc.OnlineGamesNet.net
- #Chan: #eHito
- #Mail: [email protected]
- #Script's List: www.EggTcl.tk
- #
- #Thanks to guys on #egghelp on irc.freenode.net
- #Special thanks to
- #PURPOSE
- #Store data in an encrypted base64 way.
- #USAGE
- #Use commands that you set in SETTINGS section, in query.
- #Search: Pattern ?Pass?
- #Add: Pass Title Text
- #Del: Entry Line or Exact Title
- #SETTINGS
- #Set query command to add data.
- set passlog(add) ".Pass+"
- #Set query command to list/search data.
- set passlog(see) ".Pass"
- #Set query command to del data.
- set passlog(del) ".Pass-"
- ### DON'T EDIT ANYTHING BELOW ###
- bind pub n $passlog(see) pub_passlog
- proc pub_passlog {nick uhost hand chan text} {
- set text [split $text]
- set record [lindex $text 0]
- set pass [lindex $text 1]
- if {[file exists "text/PassLog.txt"]} {
- set fs [open "text/PassLog.txt"]
- set lines [split [read -nonewline $fs] "\n"]
- close $fs
- } else {
- set lines ""
- }
- set l [lsearch -nocase -all -index 0 $lines "*$record*"]
- if {[lindex $l 0] == "-1" || ![llength [split $l]]} {
- lappend data "\002*${record}*\002 Not Found In DB"
- } else {
- foreach n [split $l] {
- set title [lindex [split [lindex $lines $n]] 0]
- set info [join [lrange [split [lindex $lines $n]] 1 end]]
- lappend data "\002${n})$title\002: [decrypt $pass $info]"
- }
- }
- foreach line $data {
- putserv "NOTICE $nick :$line"
- }
- }
- bind pub n $passlog(add) pub_passlog+
- proc pub_passlog+ {nick uhost hand chan text} {
- set text [split $text]
- set pass [lindex $text 0]
- if {![string length $pass]} {
- putserv "NOTICE $nick :\002PassLog:\002 \037Pass\037, Title, Datas Required."
- return
- }
- set title [lindex $text 1]
- if {![string length $title]} {
- putserv "NOTICE $nick :\002PassLog:\002 Pass, \037Title\037, Datas Required."
- return
- }
- set info [join [lrange $text 2 end]]
- if {![string length $info]} {
- putserv "NOTICE $nick :\002PassLog\002 Pass, Title, \037Datas\037 Required."
- return
- }
- set info [encrypt $pass $info]
- if {[file exists "text/PassLog.txt"]} {
- set fs [open "text/PassLog.txt"]
- set lines [split [read -nonewline $fs] "\n"]
- close $fs
- set fs [open "text/PassLog.txt" a]
- } else {
- set lines ""
- set fs [open "text/PassLog.txt" w]
- }
- puts $fs "$title $info"
- close $fs
- set l [lsearch -nocase $lines "*$title*"]
- if {$l != "-1"} {
- putserv "NOTICE $nick :\002PassLog:\002 Warn: an other record with same name yet exists."
- }
- putserv "NOTICE $nick :Pass Stored."
- }
- bind pub n $passlog(del) msg_passlog-
- proc msg_passlog- {nick uhost hand chan text} {
- set text [split $text]
- if {![llength $text]} {
- putserv "NOTICE $nick :\002PassLog\002 Data's Name or Line's Number Required."
- return
- }
- set info [lindex $text 0]
- if {[file exists "text/PassLog.txt"]} {
- set fs [open "text/PassLog.txt"]
- set lines [split [read -nonewline $fs] "\n"]
- close $fs
- }
- if {![info exists lines] || ![string length [string trim [join $lines]]]} {
- putserv "NOTICE $nick :\002PassLog:\002 No Data Stored."
- return
- }
- if {![string is integer -strict $info]} {
- set l [lsearch -all -index 0 $lines $info]
- } else {
- if {$info >= "0"} {
- set l $info
- } else {
- set l "-1"
- }
- if {$info >= [llength $lines]} {
- set l end
- }
- }
- if {$l == "-1" || ![llength [split $l]]} {
- putserv "NOTICE $nick :\002PassLog:\002 \002$info\002 Not Found In DB"
- return
- }
- set a 0
- foreach d [split $l] {
- set n [expr {$d - $a}]
- set lines [lreplace $lines $n $n]
- incr a
- }
- if {![llength $lines]} {
- file delete -force "text/PassLog.txt"
- } else {
- set fs [open "text/PassLog.txt" w]
- puts $fs [join $lines "\n"]
- close $fs
- }
- if {[string is integer -strict $info]} {
- set info "Line \002$info\002"
- } else {
- set info "\002$info\002"
- }
- putserv "NOTICE $nick :$info Erased."
- }
- ###
- putlog "PassLog.tcl LOADED"
Advertisement