* smartsuite

[ nokia sms gateway] ---- [ pc ]  <------> [ ircbot ]
                             |                  |
                    [ websms(reply) ]   [ automated mp3 download ]

cool... jetzt hast auch deine eigene link-seite ;) - JürgenRiemer

yep :)

Bash script zum umbenennen von 188 files:

ls --color=no | grep -v backup | while read filename; do 
     export filenamex=`echo $filename | sed 's/...............$//g'`; 
     export temp=`echo $filename | replace $filenamex ""`; 
     mv $filename $filenamex-`date +%d-%m-%Y-german`$temp; 
done

bash/perl

cd /var/www/html.video/customers/quadriga/2002-10-16_QUADRIGAALONE/symlinks2;
#ls --color=no | grep -v index.php | grep -v script | while read filename; do echo $filename | sed s/...............$//g; done | sort | uniq | perl -e 'while(<STDIN>){ $_=~s/\n//g; print"$_;"; }'
#ls --color=no | grep -v index.php | grep -v script | while read filename; do echo $filename | sed s/...............$//g; done | sort | uniq | perl -e 'while(<STDIN>){ $_=~s/\n//g; print"$_;"; $_=~s/-english//g; $_=~s/-german//g; $_=~s/...........$//g; $exec=`ls ../symlinks/$_* 2>&1>/dev/null; echo $?`; print "exec:".$exec; }' | while read filename; do echo $filename; done;
ls --color=no /var/www/html.video/customers/quadriga/2002-10-16_QUADRIGAALONE/symlinks | while read filename; do test -f ../$filename; if [ "$?" == "1" ]; then echo $filename; fi; done | while read filename; do filename=`echo $filename | sed 's/.\{15\}$//g'`; echo $filename; done | sort | uniq | while read filename; do ls ../symlinks2/$filename* 2>&1 > /dev/null  2>&1 > /dev/null; if [ "$?" == "1" ]; then echo "file doesn't exist - creating:"; echo $filename;  else echo "file exists"; fi; done;

ls --color=no /var/www/html.video/customers/quadriga/2002-10-16_QUADRIGAALONE/symlinks | while read filename; do test -f ../symlinks/$filename; if [ "$?" == "0" ];   then echo $filename; fi; done | while read filename; do filename=`echo $filename | sed 's/.\{15\}$//g'`; echo $filename; done | sort | uniq | while read filename; do ls ../symlinks2/$filename* 2>&1 > /dev/null  2>&1 > /dev/null; if [ "$?" == "1" ]; then ls ../symlinks/$filename* | while read filename; do cp -d ../symlinks/$filename ../uebergang;  done;  fi; done;

the art of bad coding.... l1

rm /var/www/html.video/newlogv2/index.html; ls /var/www/html.video/customers/ --color=no | grep -v microsoft_play-mp | grep -v putty.exe | while read filename; do echo "<a href=\"http://213.240.77.14/newlogv2/$filename/\">$filename</a><br>" >> /var/www/html.video/newlogv2/index.html; rm /var/www/html.video/newlogv2/$filename/index.html; htpasswd -nb "$filename" "data$filename" > /var/www/html.video/newlogv2/.htpasswd_$filename; echo "AuthUserFile /var/www/html/newlogv2/.htpasswd_$filename" > /var/www/html.video/newlogv2/$filename/.htaccess; echo "AuthType Basic" >> /var/www/html.video/newlogv2/$filename/.htaccess; echo "AuthName \"$filename Security Area - Videoabrufe\"" >> /var/www/html.video/newlogv2/$filename/.htaccess; echo "require valid-user" >> /var/www/html/newlogv2/$filename/.htaccess; ls /var/www/html.video/customers/$filename | grep -v index | grep -v .wmv | grep -v .mov | grep -v .asf | while read filename1; do echo "<a href=\"http://213.240.77.14/newlogv2/$filename/$filename1/\">$filename1</a><br>" >> /var/www/html.video/newlogv2/$filename/index.html; rm /var/www/html.video/newlogv2/$filename/$filename1/index.html; ls /var/www/html.video/customers/$filename/$filename1 | grep -v .wmv | grep -v .wma | grep -v .asf | grep -v .mov | grep -v index | grep -v links | while read filename3; do echo "<a href=\"http://213.240.77.14/newlogv2/$filename/$filename1/$filename3/\">$filename3</a><br>" >> /var/www/html.video/newlogv2/$filename/$filename1/index.html; echo $filename/$filename1/$filename3; mkdir -p /var/www/html.video/newlogv2/$filename/$filename1/$filename3; cp ~/template/analog-source.conf /var/www/html.video/newlogv2/$filename/$filename1/$filename3/analog.conf; echo "FILEINCLUDE /customers/$filename/$filename1/$filename3/*" >> /var/www/html.video/newlogv2/$filename/$filename1/$filename3/analog.conf; echo "OUTFILE /var/www/html.video/newlogv2/$filename/$filename1/$filename3/analog.dat" >> /var/www/html.video/newlogv2/$filename/$filename1/$filename3/analog.conf;  echo "CACHEOUTFILE /var/www/html.video/newlogv2/$filename/$filename1/$filename3/analog-1.cache" >> /var/www/html.video/newlogv2/$filename/$filename1/$filename3/analog.conf; echo "CACHEFILE /var/www/html.video/newlogv2/$filename/$filename1/$filename3/analog.cache" >> /var/www/html.video/newlogv2/$filename/$filename1/$filename3/analog.conf; cp ~/template/rmagic-source.ini /var/www/html.video/newlogv2/$filename/$filename1/$filename3/rmagic.ini; echo "Title = $filename - $filename3" >> /var/www/html.video/newlogv2/$filename/$filename1/$filename3/rmagic.ini; echo "<a href=\"reports/\">reporting</a>" > /var/www/html.video/newlogv2/$filename/$filename1/$filename3/index.html; done; done; done; /var/www/html.video/newlogv2/script-fixadig

find /var/www/html.video/newlogv2 | grep conf | while read filename; do echo $filename | replace "/"`basename $filename` "" | while read directory; do mv $directory/analog-1.cache $directory/analog.cache; analog -g$filename;  done; done; 

worst case....

PATH=$PATH:/usr/local/bin/rmagic-2.15/; export PATH; find /var/www/html.video/newlogv2/ | grep rmagic.ini | replace "/var/www/html.video/newlogv2" "" | while read filename; do cd /var/www/html.video/newlogv2`echo $filename | replace rmagic.ini "" | replace "." ""`; cat analog.dat  | grep MB | grep Rb | perl -e '$i=0; while (<STDIN>){$_=~s/z//g; $_=~s/Rb//g; $_=~s/100kB-  1MB//g; $_=~s/1MB- 10MB//g;$_=~s/(   )//g; $_=~s/^[ \t]*//g; @numbers=split(/[\t]/,"$_"); $hits[$i]=$numbers[0]; $calculate[$i]=$numbers[1]; $var[$i]=$_; $i++;} $erg=$calculate[0]+$calculate[1];$hitcalc=$hits[0]+$hits[1]; print"z\tRb\t$hitcalc\t$erg\t100kB- 10MB\n";' | while read target; do cat analog.dat | grep -v 1MB | replace "10kB-100kB" "markerstring$target" | perl -e 'while (<STDIN>){ $_=~ s/markerstring/10kb-100kB\n/g; print $_;}'; done | perl -e '$i=0; while(<STDIN>){$buffer[$i]=$_; $buffer[$i]=~ s/^[\t ]//; $i++;}; open(UPDATE,">analog.dat"); print UPDATE @buffer; close(UPDATE);'; pwd; grep x analog.dat 2>&1 > /dev/null; if [ "$?" == "0" ]; then rmagic.pl; else echo "invalid configure file in `pwd`" >> ~/invalid-config; fi; cd reports; rmagic-fix.pl DAILYSUM.html; ls --color=no *html | while read filename1; do rm-ads.pl $filename1; done; cat FILETYPE.html | replace "</td></tr></table>" "</td></tr></table><p><table cellpadding=\"5\" border=\"1\" width=\"85%\" cellspacing=\"0\"><tr><th>Zugriffsart</th><th>Anzahl der Anfragen</th><th>Prozentsatz</th></tr><tr><td>Cable/DSL</td><th align=\"right\">""`cat ../analog.dat | grep cable | while read a b c d e; do echo $d; done | perl -e '$buffer=0; while(<STDIN>){ $buffer=$buffer+$_; } print"$buffer</th><th align=\\"right\\"><script language=\\"javascript\\">function roundit(Num, Places)\{ if(Places>0)\{ if((Num.toString().length - Num.toString().lastIndexOf(\\".\\"))>(Places+1)) \{var Rounder=Math.pow(10,Places);return Math.round(Num*Rounder)/Rounder;\}else return Num;\}else return Math.round(Num);\}var erg=roundit(100/xxvaluexx*$buffer,2);document.write(erg+\\"%\\");</script>";'`""xx</th></tr></table>" | replace "xx</th></tr></table>" "</th></tr><td>Modem/56k</td><th align=\"right\">""`cat ../analog.dat | grep modem | while read a b c d e; do echo $d; done | perl -e '$buffer=0; while(<STDIN>){ $buffer=$buffer+$_; } print"$buffer</th><th align=\\"right\\"><script language=\\"javascript\\">test=100-erg; document.write(roundit(test,2)+\\"%\\");</script></th></tr></table>";'`" | replace "xxvaluexx" "`cat ../analog.dat | grep SR | grep x | while read a b c; do echo $c; done`" | perl -e '$i=0; while (<STDIN>){$buffer[$i++]=$_;} open(UPDATE2,">FILETYPE.html"); print UPDATE2 @buffer; close(UPDATE2);';done; /var/www/html.video/newlogv2/script-passwords

ttysnoop

ssh mit ttysnoops kompilieren ...  /configure --with-login=`which ttysnoops` (schaut besser aus :)  in der config file uselogin yes oder so...

limitierung ttysnoop: 1.) fenstergrösse ist auf 80x25 limitiert 2.) funktioniert nicht mit NIS!

ttysnoop ttypX ...

dpkg-divert --divert /bin/login.real --add /bin/login
mv /bin/login /bin/login.real
echo "* socket login /bin/login.real" > /etc/snooptab
cp /etc/inittab /etc/inittab.valid
perl -p -i,orig -e 's#getty#getty -l /bin/login.real#g' /etc/inittab .. für lokale sessions, aber auch beachten
ln -sf /usr/sbin/ttysnoops /bin/login
init q
echo "UseLogin yes" >> /etc/ssh/sshd_config bzw /usr/local/etc/sshd_config
/etc/init.d/ssh restart 

das selbe in bsd

watch -W ttypx

NIS

[yp]chfn - lokal/NIS change username and information
[yp]chsh - lokal/NIS change shell
ypwhich - return name of NIS server or map master
ypmatch - print the values of one or more keys from a NIS map
ypset - bind ypbind to a particular NIS server
yppoll - return version and master server of a NIS map
yppush - force propagation of changed NIS databases

utmp

utmp, wtmp - login records

#include <utmp.h>

       The  utmp file allows one to discover information about who is currently using the system.  There may
       be more users currently using the system, because not all programs use utmp logging.

       Warning: utmp must not be writable, because many system programs (foolishly) depend on its integrity.
       You  risk  faked  system logfiles and modifications of system files if you leave utmp writable to any
       user.

w, who relies on utmp also file leeren und weit und breit wird kein user mehr in sicht sein ...

beim aufruf von deluser(script)/userdel(bin) wird utmp bevor der user wirklich gelöscht werden kann kontrolliert ob er wirklich noch eingelogt ist...

logout ist (afaik) z.b verantwortlich dafür das der user nach dem auslogen aus dieser file gelöscht wird

sollte ein user root rechte haben und sich etwas auskennen kann er sich mit diesem feature verstecken (sample "exploits" sind natürlich wieder überall erhältlich...) einzige kontrolle terminals /dev/pts/...

tar in verbindung mit split

tar -czvf - | split -b 2048m - backupfile.tar.gz.
erstellt:
backupfile.tar.gz.aa
backupfile.tar.gz.ab

cat backupfile.tar.gz.* | tar -xzvf -

crypto ergebnisse

debian:/devel/crypto# make main; ./main 30 CaesarPermutationXORexampletest1
make: `main' is up to date.
Key: 1
es fehlen: 0 zeichen!
L&#65533;nge des neuen strings: 0 : alter string32
F&#65533;lle mit nullen:
CaesarPermutationXORexampletest1
strlen eingabe: 2
Encodieter text: 
Part 0: (0)     E`du`sPdsowt`thq
Part 1: (16)    n[QRdx`opldtdut3
======== DECODING =========
Part 0: (0)     CaesarPermutatio
Part 1: (16)    nXORexampletest1

MarkusRechberger/Notizen (zuletzt geändert am 2007-12-23 22:47:46 durch localhost)