Archive

Archive for June, 2007

nslookup.tcl

June 20th, 2007 Brian No comments
1
2
3
4
5
6
7
8
#### nslookup.tcl v1.0.1 #######################################################
################################################################################
## Written by:                                                                ##
##   KuNgFo0  (http://www.eggfaq.com/).              ##
##                                                                            ##
## Modified by:                                                               ##
##   Brian Schmidt aka. brianMan.                                             ##
################################################################################

#### Readme / Help #############################################################
################################################################################
## This is a slightly modified version of KuNgFoO’s nslookup.tcl v0.5 script. ##
## ##
## Script that can do nslookups. ##
## ##
## Usage: ##
## To have the .dns command available on a channel you need to set the ##
## channel flag +nslookups from the console/partyline . ##
## “.chanset #channel +nslookups´´ ##
## ##
## Channel Commands (available only if channel is +nslookups): ##
## .dns [ host|ip|nick[ host|ip|nick][ ...]] ##
## Example: ##
## “.dns www.eggfaq.com´´ ##
################################################################################

#### Changelog #################################################################
################################################################################
## v1.0.1 ##
## * Minor code cleanup ##
## ##
## v1.0.0 ##
## + Initial release. ##
## + Added the possibility to control which channels could use the commands ##
## with the channel flag “+/-nslookup´´ ##
################################################################################

# Set then next line as the command you want to initate the nslookup
set nslookup_command “.dns”

# Set the flagname used for enabling the channel command
set nslookup_channel_flag “nslookup”

# Set the next line as the flag required to use the command
set nslookup_flag “-”

# Set the next line as the exec command to run
# (Only if you’re running an older eggdrop or not using the nslookup module)
set nslookup_exec “nslookup -silent”

bind pub $nslookup_flag|$nslookup_flag $nslookup_command pub_nslookup

proc pub_nslookup {nick uhost hand chan arg} {
global nslookup_command nslookup_exec botnick nslookup_channel_flag
if {([channel get $chan $nslookup_channel_flag]) && (![matchattr $hand b]) && ($nick != $botnick)} {
if {$arg == “”} {
putserv “PRIVMSG $chan :Usage: $nslookup_command \[host/ip/nick #2\] …”
} else {
foreach addr [set addrs [split $arg {,;| }]] {
if {$addr == “”} {
continue ; # ignore
}
if {[set tmp [getchanhost $addr]] != “”} {
set addr [lindex [split $tmp @] end]
}
if {![regexp {^[a-zA-Z0-9\.\-]*$} $addr]} {
putserv “PRIVMSG $chan :Error: Hostname ‘$addr’ contains illegal characters” ; # vulnerability
} elseif {[string index $addr 0] == “-”} {
putserv “PRIVMSG $chan :Error: Hostnames cannot begin with a – character ($addr)” ; # vulnerability
} elseif {[info commands dnslookup] != “”} {
dnslookup $addr return_nslookup $chan $addr
} elseif {[catch {exec bash -c "$nslookup_exec '$addr'"} output]} {
putserv “PRIVMSG $chan :Could not resolve $addr”
} else {
foreach line [split $output \n] {
if {[lindex $line 0] == “Name:”} {
set host [lrange $line 1 end]
} elseif {([lindex $line 0] == “Address:”) || ([lindex $line 0] == “Addresses:”)} {
set ip [lrange $line 1 end]
}
}
if {([info exists host]) && ([info exists ip])} {
return_nslookup $ip $host 1 $chan $addr
} else {
return_nslookup “” “” 0 $chan $addr
}
}
}
}
}
}

proc return_nslookup {ip host status chan addr} {
if {$status} {
if {[string match *$ip* $addr]} {
putserv “PRIVMSG $chan :$ip -> $host”
} else {
putserv “PRIVMSG $chan :$host -> $ip”
}
} else {
putserv “PRIVMSG $chan :Could not resolve $addr”
}
}

setudef flag $nslookup_channel_flag
putlog “*** LOADED: nslookup.tcl”

Categories: Code, TCL Tags: , , ,

antispam.mrc – Block spammers

June 20th, 2007 Brian No comments
1
2
3
4
5
;;;; Anti Spam v1.0.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Written by:                                                                ;;
;;   Brian Schmidt aka. brianMan aka. b|man.                                  ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Readme / Help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load this script in mIRC, if you don’t know how to do this, then perhaps ;;
;; you shouldn’t be using this script. ;;
;; ;;
;; Very simple spamblocking script, blocks private message if they contain a ;;
;; word (usually urls) that are stored in it’s dbfile. ;;
;; ;;
;; Right click in a query window, or click the custom menu in the menubar to ;;
;; configure it/enable it. ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.0.0 ;;
;; + Initial release. ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Make sure the variable, with the file containing the list of blocked strings
;; are set at script start.
on *:START:{
set %_antispam_dbfile spamdb.txt
echo -tc info *** Anti-Spam by Brian Schmidt loaded..
}

alias antispam {
if ($1 == add || $1 == a) {
if (!$read(%_antispam_dbfile,w,$$2)) {
write %_antispam_dbfile $encode($$2)
echo -tac info *** Adding $$2 to %_antispam_dbfile
}
else {
echo -tac info *** $$2 allready in %_antispam_dbfile
}
}
elseif ($1 == remove || $1 == rem || $1 == r || $1 == delete || $1 == del || $1 == d) {
if ($read(%_antispam_dbfile,w,$encode($$2))) {
write -dw $encode($$2) %_antispam_dbfile
echo -tac info *** Removed $$2 from %_antispam_dbfile
}
else {
echo -tac info *** $$2 not in %_antispam_dbfile
}
}
elseif ($1 == check || $1 == c) {
if (%_antispam_status != $null && %_antispam_status != 0 && %_antispam_status != off) {
var %i 1
while (%i <= $numtok($2-,32)) {
if ($read(%_antispam_dbfile,w,$encode($gettok($2-,%i,32)))) {
if ($line($nick,0) == 0) {
window -c $window($nick)
}
halt
}
inc %i
}
}
}
elseif ($1 == status) {
if ($2 == 1 || $2 == on) {
set %_antispam_status 1
echo -tac info *** Anti-Spam enabled.
}
elseif ($2 == 0 || $2 == off) {
set %_antispam_status 0
echo -tac info *** Anti-Spam disabled.
}
}
elseif ($1 == list || $1 == l) {
window -dClk0 @Anti-Spam
var %c = $lines(%_antispam_dbfile)
if (%c > 0) {
var %i = 1
while (%i <= %c) {
aline -p @Anti-Spam $decode($read(%_antispam_dbfile,t,%i))
inc %i
}
}
}
}

;; The popup menus.
menu query,menubar {
-
Anti-Spam
.$iif(%_antispam_status == 0 || %_antispam_status == $null,Enable):antispam status on
.$iif(%_antispam_status == 1,Disable):antispam status off
.Configure:antispam list
-
}
menu @Anti-Spam {
dclick:if ($input(Delete $line(@Anti-Spam,$1),y,Confirm delete)) { antispam rem $line(@Anti-Spam,$1) | dline @Anti-Spam $1 }
Add..:var %antispam_tmp_add $input(Add spamline,e) | antispam add %antispam_tmp_add | aline @Anti-Spam %antispam_tmp_add
}

;; Catch all (private) text and check it for spam.
on ^&*:TEXT:*:?:{
antispam check $1-
}
on ^&*:ACTION:*:?:{
antispam check $1-
}

Categories: Code, mIRC Tags: , ,

age.mrc – Calculate Your Age

June 20th, 2007 Brian No comments
1
2
3
4
5
;;;; My Age v1.1.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Written by:                                                                ;;
;;   Brian Schmidt aka. brianMan.                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Readme / Help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load this script in mIRC, if you don’t know how to do this, then perhaps ;;
;; you shouldn’t be using this script. ;;
;; ;;
;; Simple script to tell how old you are in seconds, or minutes etc. ;;
;; ;;
;; Commands available: ;;
;; /myage ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.1.0 ;;
;; + Added possibility to only say your age in one format (hour/sec etc.). ;;
;; * Changed the actual trigger alias from /age to /myage. The age alias is ;;
;; only used as an identifier that returns the value to the calling script. ;;
;; + Will now ask for your birthdate when run, if it isn’t set. Then store it ;;
;; in a variable for later use.
;; ;;
;; v1.0.0 ;;
;; + Initial release. ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias age {
var %unix = $ctime($$1-)
var %now = $ctime
var %seconds = $calc( %now – %unix )
var %minutes = $calc( %seconds / 60 )
var %hours = $calc( %minutes / 60 )
var %days = $calc( %hours / 24 )
var %weeks = $calc( %days / 7 )
var %years = $calc( %days / 365.22222222222 )
var %months = $calc( %years * 12 )

if ($prop == seconds) return %seconds
elseif ($prop == minutes) return %minutes
elseif ($prop == hours) return %hours
elseif ($prop == days) return %days
elseif ($prop == weeks) return %weeks
elseif ($prop == months) return %months
elseif ($prop == years) return %years
else return %years
}

alias myage {
if (%myage.birthday == $null || $1 == set) {
set %myage.birthday $$input(What is your birth date? $+ $crlf $+ Example: $+ $crlf 13.12.1976 23:59:59,e,Birth date?)
}
if ($1 == sec) msg $active I am $age(%myage.birthday).seconds seconds old.
elseif ($1 == min || $1 == minute || $1 == minutes) msg $active I am $age(%myage.birthday).minutes minutes old.
elseif ($1 == hrs || $1 == hour || $1 == hours) msg $active I am $age(%myage.birthday).hours hours old.
elseif ($1 == day || $1 == days) msg $active I am $age(%myage.birthday).days days old.
elseif ($1 == wek || $1 == week || $1 == weeks) msg $active I am $age(%myage.birthday).weeks weeks old.
elseif ($1 == mth || $1 == month || $1 == months) msg $active I am $age(%myage.birthday).months months old.
elseif ($1 == yrs || $1 == year || $1 == years) msg $active I am $age(%myage.birthday).years years old.
else msg $active My age in: Seconds: $age(%myage.birthday).seconds $+ . Minutes: $age(%myage.birthday).minutes $+ . Hours: $age(%myage.birthday).hours $+ . Days: $age(%myage.birthday).days $+ . Weeks: $age(%myage.birthday).weeks $+ . Months: $age(%myage.birthday).months $+ . Years: $age(%myage.birthday).years $+ .
}

Categories: Code, mIRC Tags: , ,

csize.mrc – Convert Size

June 20th, 2007 Brian No comments
1
2
3
4
5
;;;; Convert Size v1.1.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Written by:                                                                ;;
;;   Brian Schmidt aka. brianMan.                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Readme / Help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load this script in mIRC, if you don’t know how to do this, then perhaps ;;
;; you shouldn’t be using this script. ;;
;; ;;
;; This script is used to convert size in bytes to a nice to KB/MB/GB etc. ;;
;; ;;
;; There are 2 ways to use this scripts: ;;
;; 1. Message to active window with /csize: ;;
;; “/csize /csize 54653875238″ ;;
;; Will output: ;;
;; “50.9 GB” ;;
;; 2. Can also be used for in-line reverse with $rev in scripts etc. ;;
;; “//echo -a Converting 54653875238 bytes to $csize(54653875238).ext ;;
;; gives $csize(54653875238) $csize(54653875238).ext” ;;
;; Will output: ;;
;; “Converting 54653875238 bytes to GB gives 50.900388 GB” ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.1.1 ;;
;; * Fixed $csize().ext always returning YiB ;;
;; ;;
;; v1.1.0 ;;
;; + Added posiblitiy to convert to a specific type with identifiers. ;;
;; $csize(50000000) returns 47.683716 (MiB) ;;
;; $csize(50000000).gib returns 0.046566 (GiB) ;;
;; This can’t be done with the “b” property, wich is also irrelevant, since ;;
;; the Bytes is allready what you have. ;;
;; ;;
;; v1.0.0 ;;
;; + Initial release. ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias csize {
if ($len($$1) <= 3) {
var %csize $$1
var %csize.ext B
}
if ($len($$1) > 3 || ($prop != $null && $prop == kib)) {
var %csize $calc( $$1 / 1024 )
var %csize.ext KiB
if ($prop == kib) return %csize
}
if ($len($$1) > 6 || ($prop != $null && $prop == mib)) {
var %csize $calc( %csize / 1024 )
var %csize.ext MiB
if ($prop == mib) return %csize
}
if ($len($$1) > 9 || ($prop != $null && $prop == gib)) {
var %csize $calc( %csize / 1024 )
var %csize.ext GiB
if ($prop == gib) return %csize
}
if ($len($$1) > 12 || ($prop != $null && $prop == tib)) {
var %csize $calc( %csize / 1024 )
var %csize.ext TiB
if ($prop == tib) return %csize
}
if ($len($$1) > 15 || ($prop != $null && $prop == pib)) {
var %csize $calc( %csize / 1024 )
var %csize.ext PiB
if ($prop == pib) return %csize
}
if ($len($$1) > 18 || ($prop != $null && $prop == eib)) {
var %csize $calc( %csize / 1024 )
var %csize.ext EiB
if ($prop == eib) return %csize
}
if ($len($$1) > 21 || ($prop != $null && $prop == zib)) {
var %csize $calc( %csize / 1024 )
var %csize.ext ZiB
if ($prop == zib) return %csize
}
if ($len($$1) > 24 || ($prop != $null && $prop == yib)) {
var %csize $calc( %csize / 1024 )
var %csize.ext YiB
if ($prop == yib) return %csize
}
if ($isid == $true) {
if ($prop == ext) {
return %csize.ext
}
return %csize
}
else {
msg $active $round(%csize,2) %csize.ext
}
}

Categories: Code, mIRC Tags: , ,

everyone.mrc – Greet everyone in a channel

June 20th, 2007 Brian No comments
1
2
3
4
5
;;;; Everyone v1.0.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Written by:                                                                ;;
;;   Brian Schmidt aka. brianMan.                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Readme / Help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Load this script in mIRC, if you don't know how to do this, then perhaps ;; ;; you shouldn't be using this script. ;; ;; ;; ;; Return all nicks (except your own) for use in fun/annoying scripts. ;; ;; ;; ;; Identifiers available: ;; ;; $everyone ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; v1.0.0 ;; ;; + Initial release. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias everyone { var %i = 1 var %c = 0 var %total = $nick($chan,0) while (%i <= %total) { if (%i < %total) var %seperator = , $chr(32) else var %seperator = $chr(32) and $chr(32) if ($nick($chan,%i) != $me) { if (%c == 0) var %out = $nick($chan,%i) else var %out = %out $+ %seperator $+ $nick($chan,%i) inc %c } inc %i } return %out }
Categories: Code, mIRC Tags: , ,