Fast System VerSioning

http://fsvs.tigris.org/

It is a complete backup/restore/versioning tool for all files in a directory tree or whole filesystems, with a subversionTM repository as the backend.
You may think of it as some kind of tar or rsync with versioned storage.

Verbose bash history

/etc/bashrc

HISTSIZE=4000
HISTFILESIZE=4000

for f in .bash_history .bash_verbose_history; do
        if [ `wc -l $HOME/$f | awk '{print $1}'` -gt 3000 ] ; then
                cp -f $HOME/$f $HOME/$f-`date -I`
        fi
done

if [ -n "$SSH_CLIENT" ]; then
        TTY=`echo $SSH_CLIENT| cut -d \  -f1`
else
        TTY=`tty | sed -e "s:/dev/::"`
fi

PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo `date +"%Y-%m-%d %k:%M:%S"` $USER $TTY "$(history 1)" >> ~/.bash_verbose_history'

VPN layer 3 con OpenSSH

Dalla versione 4.3 di OpenSSH è stato introdotto il supporto per TUN/TAP. Questo sigifica che è possibile stabilire un tunnel cifrato tra due peer o due (o piu) reti.
Questo script si occupa di fare il discover dei device tun da utilizzare, assegnare gli indirizzi e le rotte al tunnel (locali e sul peer remoto) ed eseguire comandi aggiuntivi tramite un file di configurazione.

testvpn.conf:

SSH_OPTS="-i /home/pietro/.ssh/id_dsa" # optional: options for ssh command
RUSER=root  # user to login on remote peer
PEER=172.42.10.2 # ip of remote peer
RTUNADDR=10.10.100.2 # remote ip of tunnel
LTUNADDR=10.10.100.1 # local ip of tunnel
#LOCAL_TUN=tun0 #optional: static definition of local tun device
#REMOTE_TUN=tun1 #optional: static definition of remote tun device
REMOTE_NET=172.16.40.1 # remote network
ENABLE_PEER_IP_FORWARD=true # enable ip forwarding on remote host
TRY_LOAD_PEER_TUN_MOD=true # try loading tun/tap kernel module
BAILOUT_COMMAND="logger died"
# in POST_TUN_PEER_COMMAND and POST_TUN_LOCAL_COMMAND use ‘ instead " !!!
# $LOCAL_TUN is local tun device
# $REMOTE_TUN is remote tun device
POST_TUN_PEER_COMMAND=‘iptables -I FORWARD -i $REMOTE_TUN -j ACCEPT’ # optional: command to execute on remote peer
POST_TUN_LOCAL_COMMAND=‘ip route add 192.168.6.0/24 via $RTUNADDR dev $LOCAL_TUN’ # optional: command to execute on local peer
LOCAL_IP="ip" # optional: local ip command binary
REMOTE_IP="ip" # optional: remote ip command binary
SSH="ssh" # optional: ssh binary

Reading Windows and Office product key

I product key di M$ Windows e Office vengono salvati nel registro in alcune chiavi cifrate
Pygetkey decifra le chiavi e le stampa a video oppure le salva in chiaro in un’altra chiave di registro. Puo’ inoltre preleveare i product key da un pc remoto.

Pygetkey è scritto in python e richiede un’installazione di python 2.X per windows

Esempio:

pygetkey -c SYSTEM\Test

creerà i valori WINDOWS-KEY e OFFICE-2007-KEY all’interno della chiave HKEY_LOCAL_MACHINE\SYSTEM\Test:

[HKEY_LOCAL_MACHINE\SYSTEM\Test]
"WINDOWS-KEY"="XQM13-K3M7R-32HRX-XF3Q-GMF63"
"OFFICE-2007-KEY"="JPBW9-BPY6B-79M9M-RJYJV-6G5B6"

i valori vengono creati sotto l’albero di registro HKEY_LOCAL_MACHINE nella chiave specificata dal
parametro -c e potranno avere i seguenti nomi:

WINDOWS-KEY: la chiave di windows
OFFICE-{2000,2007,2003,XP}-KEY: le chiavi di office trovate a seconda della versione.
La chiave specificata dal comando DEVE esistere, in caso contrario verrà ritornato un errore.

L’opzione -r HOST indica a pygetkey di interrogare un host remoto.

Leggere chiavi di registro su un pc remoto:
readrreg.py è ingrado di leggere le chiavi di registro da un pc remoto:

C:\dev\getkey>readrreg.py -k "SYSTEM\Test" -r RemotePC
office-2007-key: XQM13-K3M7R-32HRX-XF3Q-GMF63
windows-key: JPBW9-BPY6B-79M9M-RJYJV-6G5B6

Creazione dei binari
E’ possibile creare un eseguibile di pygetkey e readrreg in modo da non installare python sui pc, per creare i binari occorre
installare py2exe (http://www.py2exe.org) per l’appropriata versione di Python ed eseguire il seguente comando:

python.exe setup.py py2exe

Qesto creera’ una directory dist contente dei file, quelli strettamente necessari all’esecuzione di pygetkey.exe e readrreg.exe sono:

* pygetkey.exe
* readrreg.exe
* library.zip
* python25.dll (il 25 dipende dalla versione di Python installata)
* MSVCR71.dll

PS: non sono sicuro funzioni correttamente con Office 2000

Download:
pygetkey è scaricabile all’indirizzo: http://www.bertera.it/software/pygetkey/
Gli eseguibili di pygetkey e readrreg e le librerie necessarie per windows 32bit sono scaricabili qua: http://www.bertera.it/software/pygetkey/dist/
python è scaricabile all’indirizzo: http://www.python.org
py2exe è scaricabile all’indirizzo: http://www.py2exe.org

il README di pygekey e readrreg: http://www.bertera.it/software/pygetkey/README