Content tagged as linux

WinAoE - AoE Windows Driver

ATA over Ethernet for Windows

PostgreSQL 8.3 root login as postgres

PostgreSQL Logo

I am writing some backup scripts for a server, and I needed a way to let the root user on the machine to login to PostgreSQL as 'postgres' user to perform some administrative operations.

To do so, I had to make a few changes to the configuration file, to let the root user to authenticate via local-socket without providing a password (the script is launched automatically by cron, no user interaction needed).

/etc/postgresql/8.3/main/pg_hba.conf

1
2
# TYPE  DATABASE    USER        CIDR-ADDRESS    METHOD
local           all             postgres                                        ident rootaspg

Mobile phone addressbook backup

mobilephone-pda

This is a small bashscript i wrote to backup my mobile phone addressbook into LDIF format to import in LDAP. It uses gnokii to dump the phone/sim addressbooks.

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
 
OUTFILE="./addressbook_$(date +"%Y%m%d-%H%M%S").ldif"
ERRLOG="/tmp/gnokii-backup-errlog-$(pwgen 10 1).log"
 
echo > "$OUTFILE"
 
echo -n "Backupping SIM memory ... "
gnokii --getphonebook SM 1 end -l  >> "$OUTFILE" 2> "$ERRLOG" && echo "[ DONE ]" || echo "[FAILED]"
cat "$ERRLOG" | sed "s/^/  /g"
rm "$ERRLOG"
 
echo -n "Backupping PHONE memory ... "

Mutt: Define custom headers

How to define custom headers into mutt and attach files?

To run mutt in batch-mode (without user interaction) passing custom headers to it, you can use the my_hdr command, appending the -e parameter:

-e "my_hdr From: My User "

To attach files, use the -a parameter:

-a ./file-to-attach.tgz

And directly pass the mail body on standard input and the subject with -s

So, a command to send an e-mail could be:

  

How to get an e-mail on user login

Keys

Updated: 2009/11/20 00:44

Yeah, maybe I am a bit paranoid, but I want to know in real-time who logs into and from which address to my machines.
Since logging that to file is too much insecure (if one gets the control of the machine, he can delete every file he wants..) I built a script that sends me an alert e-mail each time a user logs in.

It uses mutt to compose an e-mail attaching the output of some commands.

The script is quite simple:

List Hardware on a machine

To list the hardware on a machine, use lshw:

Gentoo: sys-apps/lshw
Debian: lshw

$ lshw --help
Hardware Lister (lshw) - B.02.13
usage: lshw [-format] [-options ...]
       lshw -version

	-version        print program version (B.02.13)

format can be
	-html           output hardware tree as HTML
	-xml            output hardware tree as XML
	-short          output hardware paths
	-businfo        output bus information
	-X              use graphical interface

options can be
	-class CLASS    only show a certain class of hardware

[aircrack-ng] Tutorial: Simple WEP Crack

Aircrack-Logo

Version: 1.09 December 28, 2008
By: darkAudax
Italian translation: ~redShadow~

Introduzione

Questo tutorial illustra un semplice caso di cracking di una chiave WEP. Lo scopo di questo tutorial è fornire le conoscenze basilari e rendere familiari con i concetti. Assume che tu abbia una scheda wireless funzionante con i driver già patchati per l'iniezione di pacchetti.

Pulitura nomi file

Terminal-01

Quante volte capita di avere a che fare con file di varia provenienza a cui l'autore si è sbizzarrito a dare nomi assurdi contenenti, oltre a spazi, perfino caratteri in utf-8 ecc..?

Questo script serve per cercare di rimettere un po' a posto le cose, sostituendo spazi con underscore, lettere accentate con lettere "normali", ecc..

ManPages browser per Drupal

Druplicon

..ecco qua un nuovo modulo per Drupal! :)
E' un semplicissimo browser per le pagine del manuale UNIX ('man'), cosa che trovo molto comoda, soprattutto per funzioni di ricerca ecc.. ecc..

Al momento, i sorgenti sono disponibili via SVN su http://svn.hackzine.org/drupalmodules/modules/manpages/ (in particolare si veda il branch 6.x-0.x):

svn co http://svn.hackzine.org/drupalmodules/modules/manpages/branches/6.x-0.x/ manpages

CountDown.py - v0.1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/python
 
"""
 
    CountDown.py v0.1 - a simple countdown app
    Copyright (C) 2009  Samuele ~redShadow~ Santi - http://www.hackzine.org
 
    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 PARTICULA

Keytouch: come usare i tasti speciali della tastiera

Cos'è keytouch

Spesso ci si chiede come sfruttare appieno i vari "tasti speciali" presenti sulla maggior parte delle tastiere recenti, magari personalizzando anche un po le varie funzioni.
Una metodo comodo di fare ciò è keytouch (http://keytouch.sourceforge.net/), che permette una comoda gestione delle funzioni assegnate ai vari tasti.
Sulla gentoo, gli ebuild da emergere sono:

  • x11-misc/keytouch - il core (fondamentale)
  • x11-misc/keytouch-editor - l'editor di tastiera, utile per aggiungere mappature personalizzate

OpenFOAM on Gentoo

Su consiglio di mavimo ho deciso di provare OpenFOAM.. già che ci sono, pubblico i passi da seguire per l'installazione su Gentoo:

Installazione dall'overlay "sunrise"

Per procedere occorre avere layman installato. se così non fosse:

1
# emerge app-portage/layman

..una volta installato

1
# layman -L

dovrebbe ritornare la lista degli overlay disponibili.
Quello che interessa a noi è:

1
* sunrise         [Subversion] (source: http://overlays.gentoo.org...)

DM-Crypt HOWTO

Dm-crypt

This tutorial is about how to set up a crypted partition on linux using dmcrypt.
Of course, you can use either fisical partitions or files using a loopback device.

Loopback or partition?

A loopback means that you have a file that is on a partition that you then mount using a special device called a loopback. The loop device then acts as a normal block device transforming your file into just another hard disk :)

Archiver Bash Script

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
 
#
#     archive.sh - A fast archiver, useful for making snapshots
#     Copyright (C) 2008  Samuele ~redShadow~ Santi
#     http://hackzine.org
#
#     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 

Arduino Volume Changer

Ecco il mio primo programma su arduino.. :D
Un sistema fantastico per regolare il volume della scheda audio.. leggendo il valore di un potenziometro!
Decisamente una cosa utile, ma a parte quello..

Pagina sul wiki: http://doku.hackzine.org/projects/arduino/volume_changer

Login sulla porta seriale



Come avrete notato, sono uno che non aggiorna un blog per un mese poi scrive di fila 3 post linkando articoli scritti sul wiki (che consiglio di andare a vedere se volete roba fresca :D)..

Questa volta, linko un howto che ho scritto per spiegare la procedura per redirigere la console del kernel e aprire poi un login sulla porta seriale (o su un altro device a caratteri)..

Altri due script utili..

Terminal-01

Pubblico anche altri due script comodi che ho realizzato:

archive.sh
Scriptino bash per creare velocemente archivi di backup di una cartella, includendo nel nome del file data e ora
http://doku.hackzine.org/scripts/archive

bulkchmod.sh
Script per cambiare velocemente e ricorsivamente i permessi su file/cartelle con un comando del tipo
bulkchmod 755 644 /path/to/files
http://doku.hackzine.org/scripts/bulkchmod

Pixel Sand sul framebuffer con python!

Python Logo

Rendo finalmente disponibile al pubblico (cioè mi decido a pubblicare.. :D) il codice di uno script realizzato tempo fa per creare un'effetto "sabbia colorata" sullo schermo, modificando il framebuffer direttamente da python senza librerie aggiuntive..

Il link all'articolo sul wiki (in inglese..):
http://doku.hackzine.org/scripts/pxsand.py

Who Am I?

~redShadow~ A.K.A. Samuele Santi is an Italian Open Source developer, currently working as a freelance developer, mainly in the web applications sector. Favourite programming languages: PHP and, of course, Python!

apt (1) citroen (1) contact manager (1) backup (3) aircrack (1) e-mail (2) 3d (3) caos (1) development (11) archive (1) database (3) blogroll (7) apache (1) debian (1) Drupal (21) camera mia (1) debug (1) bash (11) alcool (1) cocktails (1) algorythms (1) address book (2) circuits (1) como lake rovers (1) aoe (1) arduino (1) documentation (2) cryptography (1) awstats (3) blender (3) cars (1) doku (1) cartoons (1) C++ (2) code (3) dmcrypt (1) curl (1) Drupal Forms (1) audio (1) 2v (1)