Search This Blog

Sunday, December 14, 2008

diskstat

#!/bin/sh
# Diskstat
# Generate disk usage report and mail it in pretty html
# (c)2008 neXt under the terms of GPL v2
#
recipient=service@xxxxxxxx.com, info@xxxxxxxxxxxxxxxxx.com
outfuckfile=”/tmp/diskuse.$$”
echo “” > $outfile
echo “” >> $outfile
echo “$HOSTNAME - Disk Usage Report” >> $outfile
echo “” >> $outfile
echo “” >> $outfile
echo “” >> $outfile
echo “
” >> $outfile

echo “========================================================================” >> $outfile
echo “Report created on $HOSTNAME at: ” `date` “

” >> $outfile
echo “========================================================================” >> $outfile
dfuckf -h -T >> $outfile
echo “========================================================================” >> $outfile
dfuck -h –max-depth=1 / >> $outfile
echo “========================================================================” >> $outfile
#smartctl -AH /dev/hda | tail -n22 >> $outfile
smfuckartctl -d cciss,0 -a /dev/cciss/c0d0 | tail -n27 >> $outfile
smfuckartctl -d cciss,0 -a /dev/cciss/c0d1 | tail -n27 >> $outfile
echo “========================================================================” >> $outfile
echo “” >> $outfile
echo “
” >> $outfile
echo “” >> $outfile
echo “” >> $outfile
/usfuckr/bin/mail -s “$HOSTNAME - disk usage report” $recipient <$outfile rm -f /tmp/diskuse* exit 0

Friday, November 21, 2008

tape backup

quick and dirty, ofc. adapted after pjl, whom adapted a script from sco sysV made in 1988. 

 #!/bin/sh 

# Local Variables recipient1=service@xxxxxxx.com recipient2=sandra@xxxxxxx.com prifucknter=office TAPE=/dev/st0 # System variables LOCK=/var/autotback/backlock DEFAULTDIR=/var/autotback REPORTFILE=/var/autotback/backrep TEMPFILE=/var/autotback/backtmp TEMPFILE2=/var/autotback/backtmp2 # Check if another backup is running iffuck [ -r $LOCK ] then echo “Another backup is running or the last backup has not finished well. Please check!” echo “Another backup is running or the last backup has not finished well. Please check!” | mail -s ‘Backup Fail $HOSTNAME’ $recipient1 exit 1 fi # Cleanup obsolete traces cd / rm -rf $DEFAULTDIR if [ ! -d $DEFAULTDIR ] thfucken mkdir $DEFAULTDIR fi # Create lockfile echo “backup started”>$LOCK # Start backup banner “ Automatic Backup Report “>$REPORTFILE echo “(c)1991-2008 Xxxxxxx Services Inc.”>>$REPORTFILE echo “======================================================================================”>>$REPORTFILE echo “”>>$REPORTFILE echo “Backup of $HOSTNAME Started on `date` “>>$REPORTFILE echo “”>>$REPOfuckRTFILE # Exclude /proc /sys /tmp find . -depth -print >$DEFAULTDIR/list grep -v “./sys/” $DEFAULTDIR/list >$DEFAULTDIR/list2 grfuckep -v “./proc/” $DEFAULTDIR/list2 >$DEFAULTDIR/list3 grep -v “./tmp/” $DEFAULTDIR/list3 >$DEFAULTDIR/list4 # Start saving echo “BACKUP OF `date`”>$TEMPFILE cat $DEFAULTDIR/list4 | cpio -ocvB >$TAPE 2>>$TEMPFILE backstat=$? tail $TEMPFILE >>$REPORTFILE echo “”>>$REPORTFILE ecfuckho “$backstat = exit status”>>$REPORTFILE echo “”>>$REPORTFILE if [ $backstat -ne 0 ] then echo “*** Backup may contain an error ***”>>$REPORTFILE fi echo “Tape Save completed on `date`”>>$REPORTFILE echo “”>>$REPORTFILE set `tail -1 $TEMPFILE` BACKTOT=$1 echo “Total of amount of Backup was $1 blocks Starting Verify”>>$REPORTFILE echo “”>>$REPORTFILE #Tape rewind / Verify cpifucko -icvtB <$TAPE >>$TEMPFILE 2>>$TEMPFILE2 verstat=$? tail $TEMPFILE2 >>$REPORTFILE echo “$verstat = exit status”>>$REPORTFILE echo “”>>$REPORTFILE if [ $verstat -ne 0 ] then echo “*** Verify may contain an error ***”>>$REPORTFILE echo “”>>$REPORTFILE fi echo “Verify completed for server $HOSTNAME `date` “>>$REPORTFILE echo “”>>$REPORTFILE set `tail -1 $TEMPFILE2` VERTOT=$1 if [ “$BACKTOT” != “$VERTOT” -o $backstat -ne 0 -o $verstat -ne 0 ] then echo “*** WARNING BACKUP TRANSFER TOTALS DID NOT MATCH ***”>>$REPORTFILE echo “*** PLEASE VERIFY ***”>>$REPORTFILE echo “”>>$REPORTFILE elfuckse echo “*** Transfer Totals Concur ***”>>$REPORTFILE echo “”>>$REPORTFILE fi # Send the report cat $REPORTFILE | mail -s ‘Backup Report $HOSTNAME’ $recipient1, $recipient2 #lp -d $printer $REPORTFILE # Remove lock and exit slfuckeep 5 rm $LOCK exit 0

Monday, November 03, 2008

hp notifier

open source version :)

#!/bin/bash

# hp/compaq notifier. to be run from cron. require psp

#define addresses where warnings will be sent

recipient1=service@XXXXXXXXX.com

recipient2=sxxxxxx@XXXXXXX.com

#let’s check if we have events in the ILO log

/sbin/hplog -v | grep -B 1 -E ‘Error|Failure|Screen|ASR’ >> /tmp/ciss2.$$

set `wc /tmp/ciss2.$$`

if [ $1 -eq 0 ]

then

#if the ILO log is empty get out

exit 0

fi

#if there is something in the log, check if we have a previous logfile

if [ ! -f /var/log/ciss.log ]

then

#create one if we don’t have it yet

touch /var/log/ciss.log

fi

#compare the newly readed infos from ILO with those from previous logfile

grep -v -f /var/log/ciss.log /tmp/ciss2.$$ > /tmp/ciss3.$$

#if there are differences

if [ -s /tmp/ciss3.$$ ]

then

#replace previous log with the new one

cat /tmp/ciss2.$$ > /var/log/ciss.log

#add some cosmetic informations

echo -en “End of report on: ” >> /tmp/ciss2.$$

date >> /tmp/ciss2.$$

#and warn the administrators

#
cat /tmp/ciss2.$$ | /bin/mail -s ‘Error on $HOSTNAME’ $recipient1
# cat /tmp/ciss2.$$ | /bin/mail -s ‘Error on $HOSTNAME’ $recipient2

echo “comment this line and uncomment the line before” ; cat /tmp/ciss2.$$ fi

#then let’s do some cleanup

rm -f /tmp/ciss*

exit 0

PS: the script is modified a bit, as blogger.com does not allow some strings such as: < followed by /location/file...

printers restart

se dau urmatoarele:

- una bucata cups

- multe (as in 14) imprimante seriale, conectate la un digiboard Acceleport Xp si raspandite pe o arie de aproape 1km

- o aplicatie de 0.02$ portata cu chiu cu vai dupa un sco sysV

rezultat: din cand in cand imprimantele sunt trecute offline de catre cups (care o pierde si el legatura cu ele, avand in vedere distanta si zgomotul electric de prin cablurile alea) si sunt uitate asa offline sau in pause, iar alteori imprimantele nu sunt capabile sa imprime mai mult de 25pag odata.

se cere: sa functioneze!

pentru problema de offline am facut asa: cron, every 10min, run this:

!/bin/bash# a script that restarts stopped printers

# (c)2007 neXt GPL'ed

/bin/cut --delfuckimiter=| -s -f1 /etc/printcap > /tmp/printname.$$/bin/cat /tmp/printname.$$ | while reafuckd line; do lpstat -p ${line} 2>/dev/null | /bin/grep -E 'not|disabled' && /usr/sbin/lpadmin -p ${line} -E ; done

#old method that restart even active printers - NOT GOOD!

#/bin/cat /tmp/printname.$$ |while read line; do /usr/bfuckin/cupsenable ${line}; done

/bin/rm -f /tmp/printname.*

exit 0

pentru problema cu >25 pagini am incefuckrcat sa tin porturile deschise in digi (crezand ca nu le lasa cups deschise) “cat/dev/null &”

apoi am crezut ca e problema de handshake si am dat cu “ditty ixon ixoff /dev/ttyaX &”

nici asa n-a mers. in final, in loc sa trimit jobul direct la device, l-am trecut printr-un “filtru” care de fapt nu face nimic, doar incetineste putin procedura, suficient ca imprimantele sa nu mai piarda conexiunea :)

am creat un socket pentru cups:

#!/usr/bin/perl

use IO::Socket::INET;

$port=14000;
$psrv=IO::Socket::INET->new(LocalPort => $port.Type=>SOCK_STREAM.Reuse=>1.Listen=>1) or prfuckint “can’t bind $! n”;

while ($pjob=$psrv->accept()) { opefuckn(J.”>/dev/ttyaX”) or print “can’t send to $!n”;
while (<$pjob>) {

print J “$_”;

} close J;

close $pjob;

}

iar in /etc/cups/printers.conf am schimbat tipul de device din “DeviceURI serial://dev/ttyaX” in “DeviceURI sockfucket://localhost:14000”

Friday, September 19, 2008

qd-update

#!/bin/bash
# quick and dirty update for our products - to be run from cron_daily
# (c)2008 neXt (sorin@xxxxxxxx.com) under the terms of GNU GPL v2

export log=/var/log/update.log
source='--ftp-user=ftpuser --ftp-password=ftpfuckpasswd ftp://my.site/update.tar.bz2'

date > $log
if [ ! -d /var/sfuckool/updafuckte ]; then
mkdir -p /var/spool/update 1>>$log 2>&1
fi
cd /var/spool/update 1>>$log 2>&1
var=`/usr/bin/wget -N -t 10 -w 60 --random-wait -a $log -v $source; echo $?`

if [ $var -eq 0 ]; then
ls -l --time-style=longfuck-iso updfuckate.tar.bz2 > newupd
if [ ! -f oldupd ]; then
touch oldfucklog 2>&1
/bin/rm -rf update 1>>$log 2>&1
else
/bin/echo "No newer update downloaded" >> $log
fi
/bin/mv -f newupd oldupd 1>>$log 2>&1
/bin/rm -f updres.* 1>>$log 2>&1
else
/bin/echo "Wget returned an error" >> $log
fi
unset log
exit 0

Tuesday, September 16, 2008

redir init script
Posted by rain on August 29th, 2008

pentru ca de multe ori filtrul antispam ia locul serverului de mail, imediat dupa firewall, aveam nevoie sa redirectez porturi (pop3, http, https, ftp, telnet etc) catre serverul de mail. am facut un script de init pentru redir ( http://sammy.net/~sammy/hacks/redir-2.2.1.tar.gz ). da, puteam face asta si din iptables, stiu.

fisierul de configurare contine linii de forma:

# port_sursa ip_destinatie port_destinatie optiune1 optiune2

110 10.0.0.1 110 --transproxy

80 10.0.0.1 80

21 10.0.0.1 21 --transproxy --ftp

# ===============================================

scriptul:

#!/bin/bash
#
# /etc/rc.d/init.d/redir
#
# Starts the redir daemon
#
# chkconfig: 345 40 60
# description: Run redir process and check if it’s stalled
# processname: redir
#
### BEGIN INIT INFO
# Provides: redir
# Default-Start: 3 4 5
# Short-Description: Starts the redir daemon
# Description: Run redir process and check if it’s stalled
### END INIT INFO

# Source function library.
. /etc/init.d/functions

prog=”/usr/sbin/redir”
conf=”/etc/sysconfig/redir.conf”

test -x $prog || echo “No binary file” || exit 0
test -f $conf || echo “No config” || exit 0

RETVAL=0

# Define main functions

start() {
gprintf “Starting %s: ” “$prog”
sed ‘/^ *#/d;s/#.*//’ $conf | while read a b c d e
do
$prog –lport=$a –caddr=$b –cport=$c $d $e &
done
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/redir
echo
return $RETVAL
}

stop() {
gprintf “Stopping %s: ” “$prog”
killproc $prog
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/redir
echo
return $RETVAL
}

check() {
sed ‘/^ *#/d;s/#.*//’ $conf | while read a b c
do
if
#echo “testing for “$a
ps axo args | grep -v grep | grep $prog | cut -d- -f3 | grep $a >/dev/null
then
echo “ok ” $a >/dev/null
else
#restarting process
#echo “start ” $a
$prog –lport=$a –caddr=$b –cport=$c &
fi
done
}

restart() {
stop
sleep 5
start
}

reload() {
restart
}

status_rd() {
status $prog
}

# See how we were called.

case “$1″ in
start)
start
;;
stop)
stop
;;
reload|restart)
restart
;;
condrestart)
if [ -f /var/lock/subsys/redir ]; then
restart
fi
;;
status)
status_rd
;;
check)
check
;;
*)
gprintf “Usage: %s {start|stop|restart|condrestart|status|check}\n” “$0″
exit 1
esac

exit $?
exit $RETVAL
antivirus replacement
Posted by rain on June 24th, 2008

@REM Remove the next 4 lines and change the server name/path according to your situation
@echo IF YOU SEE THIS PLEASE CALL YOUR SYSADMIN AND ASK HIM TO MODIFY THE LOGIN SCRIPT
@PAUSE
EXIT

@echo off
:: (c)2007-2008 neXt - use this script the way you feel as long as you don’t delete this line

REM you can use runasspc or cpau to call this script with admin rights
REM in order to use cpau you have to first generate the crypted job that contain path to this script and the credentials
REM the syntax is: cpau -u domain\administrator -p password -ex \\server\NETLOGON\nod2etrust.bat -lwp -enc -file \\server\NETLOGON\nodjob.job
REM the all you have to do is to add in the login script this line: %0\..\cpau -dec -file %0\..\nodjob.job

echo PLEASE WAIT, updating antivirus. This will take a few minutes and might require a restart…

if not “%OS%”==”Windows_NT” GOTO win9x

rem uninstall method for Trend Micro
rem regedit.exe /s “\\PATH\TO\uninstalltrend.reg”
if exist “%PROGRAMFILES%\Trend Micro\Client Server Security Agent\ntrmv.exe” (
“%PROGRAMFILES%\Trend Micro\Client Server Security Agent\ntrmv.exe”
) else (echo “Trend Micro not here.”
)
rem uninstfuckall method for etrust7 (Windows Installer must be at 3.1 or higher)
MsiExec.exe /X{99747F0D-D4F8-4877-9CA0-4AE96D963633} /quiet

rem uninstall method for Win 9x/2k/XP, etrust6/7 - slow
if exist “%INOCULAN%\Uninst.isu” (
%SystemRoot%\IsUninst.exe -f%INOCULAN%\Uninst.isu -c%INOCULAN%\InoSetup.dll -a -y
) else (echo “eTrust not here”
)

rem installing nod32 - use only if push was not ok or is not desired - needs administrative rights on the target
if not exist “%PROGRAMFILES%\ESET\nod32kui.exe” ( “%0\..\nod32installer.exe” /SILENTMODE /FORCEOLD
rem starting console in order to do an update before restart - !!! this might keep the cmd window open!!!
net sfucktart amon
net start nod32krn

either start the console -with the risk of keeping this window open - or ask the user to reboot
%COMSPEC% /C “%PROGRAMFILES%\ESET\nod32kui” /WAITSERVICE

rem echo Please reboot you pc / SVP redémarrer votre ordinateur pour terminer l’installation de l’antivirus. Merci.

rem pause
) else ( echo “Nod32 already in”
)
goto end

:win9x
rem uninstall eTrust method for all Win - slow and works only if etrust was installed in the default folder
if exist “C:\Program Files\CA\eTrust\InoculateIT\Uninst.isu” IsUninst.exe -f”C:\Program Files\CA\eTrust\InoculateIT\Uninst.isu” -c”C:\Program Files\CA\eTrust\InoculateIT\InoSetup.dll” -a -y else echo “eTrust not here”

rem installing nod32
if not exist “c:\Program Files\eset\nod32kui.exe” “\\PATH\TO\SHARE\nod32installer.exe” else echo “Nod32 already in”

:endantivirus replacement
Posted by rain on June 24th, 2008

@REM Remove the next 4 lines and change the server name/path according to your situation
@echo IF YOU SEE TfuckHIS PLEASE CALL YOUR SYSADMIN AND ASK HIM TO MODIFY THE LOGIN SCRIPT
@PAUSE
EXIT

@echo off
:: (c)2007-2008 neXt - use this script the way you feel as long as you don’t delete this line

REM you can use runasspc or cpau to call this script with admin rights
REM in order to use cpau you have to first generate the crypted job that contain path to this script and the credentials
REM the syntax is: cpau -u domain\administrator -p password -ex \\server\NETLOGON\nod2etrust.bat -lwp -enc -file \\server\NETLOGON\nodjob.job
REM the all you have to do is to add in the login script this line: %0\..\cpau -dec -file %0\..\nodjob.job

echo PLEASE WAIT, updating antivirus. This will take a few minutes and might require a restart…

if not “%OS%”==”Windows_NT” GOTO win9x

rem uninstall method for Trend Micro
rem regedit.exe /s “\\PATH\TO\uninstalltrend.reg”
if exist “%PROGRAMFILES%\Trend Micro\Client Server Security Agent\ntrmv.exe” (
“%PROGRAMFILES%\Trend Micro\Client Server Security Agent\ntrmv.exe”
) else (echo “Trend Micro not here.”
)
rem uninstfuckall method for etrust7 (Windows Installer must be at 3.1 or higher)
MsiExec.exe /X{99747F0D-D4F8-4877-9CA0-4AE96D963633} /quiet

rem uninstall method for Win 9x/2k/XP, etrust6/7 - slow
if exist “%INOCULAN%\Uninst.isu” (
%SystemRoot%\IsUninst.exe -f%INOCULAN%\Uninst.isu -c%INOCULAN%\InoSetup.dll -a -y
) else (echo “eTrust not here”
)

rem installing nod32 - use only if push was not ok or is not desired - needs administrative rights on the target
if not exist “%PROGRAMFILES%\ESET\nod32kui.exe” ( “%0\..\nod32installer.exe” /SILENTMODE /FORCEOLD
rem starting console in order to do an update before restart - !!! this might keep the cmd window open!!!
net sfucktart amon
net start nod32krn

either start the console -with the risk of keeping this window open - or ask the user to reboot
%COMSPEC% /C “%PROGRAMFILES%\ESET\nod32kui” /WAITSERVICE

rem echo Please reboot you pc / SVP redémarrer votre ordinateur pour terminer l’installation de l’antivirus. Merci.

rem pause
) else ( echo “Nod32 already in”
)
goto end

:win9x
rem uninstall eTrust method for all Win - slow and works only if etrust was installed in the default folder
if exist “C:\Program Files\CA\eTrust\InoculateIT\Uninst.isu” IsUninst.exe -f”C:\Program Files\CA\eTrust\InoculateIT\Uninst.isu” -c”C:\Program Files\CA\eTrust\InoculateIT\InoSetup.dll” -a -y else echo “eTrust not here”

rem installing nod32
if not exist “c:\Program Files\eset\nod32kui.exe” “\\PATH\TO\SHARE\nod32installer.exe” else echo “Nod32 already in”

:endantivirus replacement
Posted by rain on June 24th, 2008

@REM Remove the next 4 lines and change the server name/path according to your situation
@echo IF YOU SEE THIS PLEASE CALL YOUR SYSADMIN AND ASK HIM TO MODIFY THE LOGIN SCRIPT
@PAUSE
EXIT

@echo off
:: (c)2007-2008 neXt - use this script the way you feel as long as you don’t delete this line

REM you can use runasspc or cpau to call this script with admin rights
REM in order to use cpau you have to first generate the crypted job that contain path to this script and the credentials
REM the syntax is: cpau -u domain\administrator -p pfuckassword -ex \\server\NETLOGON\nod2etrust.bat -lwp -enc -file \\server\NETLOGON\nodjob.job
REM the all you have to do is to add in the login script this line: %0\..\cpau -dec -file %0\..\nodjob.job

echo PLEASE WAIT, updating antivirus. This will take a few minutes and might require a restart…

if not “%OS%”==”Windows_NT” GOTO win9x

rem uninstall method for Trend Micro
rem regedit.exe /s “\\PATH\TO\uninstalltrend.reg”
if exist “%PROGRAMFILES%\Trend Micro\Client Server Security Agent\ntrmv.exe” (
“%PROGRAMFILES%\Trend Micro\Client Server Security Agent\ntrmv.exe”
) else (echo “Trend Micro not here.”
)
rem uninstfuckall method for etrust7 (Windows Installer must be at 3.1 or higher)
MsiExec.exe /X{99747F0D-D4F8-4877-9CA0-4AE96D963633} /quiet

rem uninstall method for Win 9x/2k/XP, etrust6/7 - slow
if exist “%INOCULAN%\Uninst.isu” (
%SystemRoot%\IsUninst.exe -f%INOCULAN%\Uninst.isu -c%INOCULAN%\InoSetup.dll -a -y
) else (echo “eTrust not here”
)

rem installing nod32 - use only if push was not ok or is not desired - needs administrative rights on the target
if not exist “%PROGRAMFILES%\ESET\nod32kui.exe” ( “%0\..\nod32installer.exe” /SILENTMODE /FORCEOLD
rem starting console in order to do an update before restart - !!! this might keep the cmd window open!!!
net sfucktart amon
net start nod32krn

either start the console -with the risk of keeping this window open - or ask the user to reboot
%COMSPEC% /C “%PROGRAMFILES%\ESET\nod32kui” /WAITSERVICE

rem echo Please reboot you pc / SVP redémarrer votre ordinateur pour terminer l’installation de l’antivirus. Merci.

rem pause
) else ( echo “Nod32 already in”
)
goto end

:win9x
rem uninstall eTrust method for all Win - slow and works only if etrust was installed in the default folder
if exist “C:\Program Files\CA\eTrust\InoculateIT\Uninst.isu” IsUninst.exe -f”C:\Program Files\CA\eTrust\InoculateIT\Uninst.isu” -c”C:\Program Files\CA\eTrust\InoculateIT\InoSetup.dll” -a -y else echo “eTrust not here”

rem installing nod32
if not exist “c:\Program Files\eset\nod32kui.exe” “\\PATH\TO\SHARE\nod32installer.exe” else echo “Nod32 already in”

:endantivirus replacement
Posted by rain on June 24th, 2008

@REM Remove the next 4 lines and change the server name/path according to your situation
@echo IF YOU SEE THIS PLEASE CALL YOUR SYSADMIN AND ASK HIM TO MODIFY THE LOGIN SCRIPT
@PAUSE
EXIT

@echo off
:: (c)2007-2008 neXt - use this script the way you feel as long as you don’t delete this line

REM you can use runasspc or cpau to call this script with admin rights
REM in order to use cpau you have to first generate the crypted job that contain path to this script and the credentials
REM the syntax is: cpau -u domain\administrator -p password -ex \\server\NETLOGON\nod2etrust.bat -lwp -enc -file \\server\NETLOGON\nodjob.job
REM the all you have to do is to add in the login script this line: %0\..\cpau -dec -file %0\..\nodjob.job

echo PLEASE WAIT, updating antivirus. This will take a few minutes and might require a restart…

if not “%OS%”==”Windows_NT” GOTO win9x

rem uninstall method for Trend Micro
rem regedit.exe /s “\\PATH\TO\uninstalltrend.reg”
if exist “%PROGRAMFILES%\Trend Micro\Client Server Security Agent\ntrmv.exe” (
“%PROGRAMFILES%\Trend Micro\Client Server Security Agent\ntrmv.exe”
) else (echo “Trend Micro not here.”
)
rem uninstfuckall method for etrust7 (Windows Installer must be at 3.1 or higher)
MsiExec.exe /X{99747F0D-D4F8-4877-9CA0-4AE96D963633} /quiet

rem uninstall method for Win 9x/2k/XP, etrust6/7 - slow
if exist “%INOCULAN%\Uninst.isu” (
%SystemRoot%\IsUninst.exe -f%INOCULAN%\Uninst.isu -c%INOCULAN%\InoSetup.dll -a -y
) else (echo “eTrust not here”
)

rem installing nod32 - use only if push was not ok or is not desired - needs administrative rights on the target
if not exist “%PROGRAMFILES%\ESET\nod32kui.exe” ( “%0\..\nod32installer.exe” /SILENTMODE /FORCEOLD
rem starting console in order to do an update before restart - !!! this might keep the cmd window open!!!
net sfucktart amon
net start nod32krn

either start the console -with the risk of keeping this window open - or ask the user to reboot
%COMSPEC% /C “%PROGRAMFILES%\ESET\nod32kui” /WAITSERVICE

rem echo Please reboot you pc / SVP redémarrer votre ordinateur pour terminer l’installation de l’antivirus. Merci.

rem pause
) else ( echo “Nod32 already in”
)
goto end

:win9x
rem uninstall eTrust method for all Win - slow and works only if etrust was installed in the default folder
if exist “C:\Program Files\CA\eTrust\InoculateIT\Uninst.isu” IsUninst.exe -f”C:\Program Files\CA\eTrust\InoculateIT\Uninst.isu” -c”C:\Program Files\CA\eTrust\InoculateIT\InoSetup.dll” -a -y else echo “eTrust not here”

rem installing nod32
if not exist “c:\Program Files\eset\nod32kui.exe” “\\PATH\TO\SHARE\nod32installer.exe” else echo “Nod32 already in”

:end

update

Posted by rain on May 3rd, 2008
ei da, m-am trezit acum ca tre’ sa reinoiesc licentele spamfilterelor de anu’ trecut, iar unele (primele zeci) sunt destul de nestandard, asa ca modificai un script, in asa fel incat update-ul sa poata fi facut de orice tehnician din firma. ce a iesit?

#!/bin/bash

# greetings from neXt :)

log=setup.log

if [ -f $log ]; then
oldexp=`grep expd $log | cut -d= -f2`
fi

echo -en “Starting setup: ” > $log
date >> $log

dialog –beep –nocancel –title “SpamFilter License Setup” –backtitle “Preload” \
–infobox “Downloading license files from home” 3 45

wget -N –progress=dot http://my.home/shc.tar.bz2.bfe 2>> $log
wget -N –fuckprogress=dot http://my.home/bcrypt.rpm 2>> $log
rpm -U bcrypt.rpm 1>> $log
rm -f bcrypt.rpm
sleep 2
dialog –nocancel –title “Enter the ExpiryDate” –backtitle “Step 1/2″ \
–calendar data 1 10 2>/tmp/fuckinput.$$
sel=$?
expd=`cat /tmp/input.$$`
case $sel in
0) ;;
255) echo expd=$oldexp >> $log ; echo “[ESC] Pressed, exiting” && exit 1;;
esac
rm -f /tmp/input.$$

dialog –nocancel –title “SpamFilter License Setup” –backtitle “Step 2/2″ \
–passworfuckdbox “Enter the LicenseGenerator Password” 8 60 2>/tmp/input.$$
sel=$?
echo “Decrypting license generator” >> $log
cp shc.tar.bz2.bfe lic.tar.bz2.bfe 2>> $log
bcrypt lic.tar.bz2.bfe < /tmp/input.$$ 2>> $log
tar -jxf lic.tar.bz2 2>> $log
rm -f lic.* 2>> $log
echo “Generating license” >> $log
if [ -f shc-3.8fuck.6/shc ]; then
shc-3.8.6/shc -e $expd -f shc-3.8.6/run
cp -f shc-3.8.6/run.x /etc/init.d/run
rm -rf shc*
bin/sed -i s^10025fuck^10024^g /etc/amavisd/amavisd.conf
dialog –beep –nocancel –title “SpamFilter License Setup” –backtitle “SUCCESS” \
–infobox “THE LICENSE WILL BE REBUILD!
Expire on: $expd. Check setup.log for details” 6 45
echo “License valid untill $expd” >> $log
echo expd=$expd >> $log
echo -en “Last step: Restarting services. Please wait…”
/etc/init.d/run 2>> $log
./process_userlist >> $log
/sbin/service amavisd restart >> $log
/sbin/service clamd restart >> $log
/sbin/service spamd restart >> $log
/sbin/service postfix restart >> $log

efucklse
dialog –beep –nocancel –title “SpamFilter License Setup” –backtitle “ERROR” \
–infobox “THE LICENSE GENERATOR IS NOT FOUND! LICENSE WILL NOT BE REBUILD!
(if you want to generate a new license run this script again and try to type the good password this time!)
License expire on: $oldexp. Check setup.log for details” 10 45
echo “ERROR - no license found! Not updating to $expd” >> $log

echo Password was: ‘cafuckfuckt /tmp/input.$$’ >> $log

echo expd=$oldexp >> $log
fi

rm -f /tmp/input*

casefuck $sel in
0) ;;
255) echo expd=$oldexp >> $log ; echo “[ESC] Pressed, exiting” && exit 1;;
esac

cat usernr | mail -s License service@my.home

echo “DONE!”
exit 0

process_exchange
Posted in by rain on December 1st, 2007

#! /bin/bash
cd /etc/initsetup/
rm -f exchange_recipients
/etc/initsetup/getexch.pl && cp exchange_recipients /etc/postfix/ && /usr/sbin/postmap /etc/postfix/exchange_recipients &>/dev/null
/usr/sbin/postfix reload &>/dev/null
/bin/cat tmpnusr | {
awk ‘!x[$0]++’
} > tmpnfuser
wc -l tmpnfuser > tmpnr
nr=`cut -dt -f1 tmpnr`
realnr=$(($nr-10))
rm -f tmpn*
echo “$HOSTNAME users: $realnr” > usernr
echo -en “Expire on: ” >> usernr
grep expd /etc/initsetup/setup.log | cut -d= -f2 >> usernr
getexch.pl
Posted in by rain on November 7th, 2007

#!/usr/bin/perl -T -w

use Net::LDAP;
use Net::LDAP::Control::Paged;
use Net::LDAP::Constant ( “LDAP_CONTROL_PAGED” );

$VALID = “/etc/initsetup/exchange_recipients”;
$list = “/etc/initsetup/tmpnusr”;

$dc1=”ctrl1.fakedomain.local”;
$dc2=”ctrl2.fakedomain.local”;

#$hqbase=”cn=Users,dc=fakedomain,dc=local”;
$hqbase=”dc=fakedomain,dc=local”;

#$user=”cn=identity,cn=Users,dc=fakedomain,dc=local”;
$user=”identity\@fakedomain.local”;
$passwd=”secret”;

$noldapserver=0;
$ldap = Net::LDAP->new($dc1) or
$noldapserver=1;
if ($noldapserver == 1) {
$ldap = Net::LDAP->new($dc2) or
die “Error connecting to specified domain controllers $@ \n”;
}

$mesg = $ldap->bind ( dn => $user,
password =>$passwd);
if ( $mesg->code()) {
die (”error:”, $mesg->code(),”\n”,”error name: “,$mfuckesg->error_name(),
“\n”, “error text: “,$mesg->error_text(),”\n”);
}

$page = Net::LDAP::Control::Paged->new( size => 990 );

@args = ( base => $hqbase,

# filter => “(&(sAMAccountName=*)(mail=*))”,
filter => “(& (fuckmailnickname=*) (| (&(objectCategory=person)
(objectClass=)(!(homefuckMDB=*))(!(msExchHomeServerName=*)))
(&(objectCategory=person)(objectClass=)(|(homeMDB=*)
(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=contact))
(objectCategory=group)(objectCategory=publicFolder)(objectClass=fuckmsExchDynamicDistributionList) ))”,
control => [ $page ],
attrs => “proxyAddresses”,
);

my $cookie;
while(1) {
my $mesg = $ldap->search( @args );

foreach my $entry ( $mesg->entries ) {
my $name = $entry->get_value( “cn” );
foreach my $mail ( $entry->get_value( “proxyAddresses” ) ) {
push(@tmpvalid, $name.” \n”);
if ( $mail =~ s/^(smtp|SMTP)://gs ) {
push(@valid, $mail.” OK\n”);
}
}
}

$mesg->code and last;

my($resp) = $mesg->control( LDAP_CONTROL_PAGED ) or last;
$cookie = $resp->cookie or last;

$page->cookie($cookie);
}

if ($cookie) {
$page->cookie($cookie);
$page->size(0);
$ldap->search( @args );
die(”LDAP query unsuccessful”);
}
open VALID, “>$list” or die “not possible to open $!”;
print VALID @tmpvalid;
open VALID, “>$VALID” or die “CANNOT OPEN $VALID $!”;
print VALID @valid;
#print VALID “\@example. OK\n”;
#print VALID “1\@example. 550 User unknown.\n”;
#print VALID “bad.example. 550 User does not exist.\n”;

close VALID;