msgbartop
Blog di Bernardino (Dino) Ciuffetti
msgbarbottom

13 giu 11 How to unpack a patch.e2 enigma2 file from linux

The enigma2 patch file, generally named patch.e2, is a packet binary file containing a cramfs root filesystem and a linux kernel in zboot format.
It is commonly used by some TV decoder linux distribution systems to update the system firmware.

I didn’t find a quick way to extract the “/” cramfs filesystem from patch.e2 files from a linux system, so I decided to write a small utility from myself.

It is in attach, it’s called unpack_e2 and it’s very easy to use.
Just compile it with:

gcc -o unpack_e2 -O2 -Wall unpack_e2.c

And call it with the patch.e2 file as the first argument.
The two files produced are cram.img and kernel.img.

dino@dam2k:~/AZBOX_RTi_E2$ ./unpack_e2 /tmp/patch.e2
Team name: RTi Team
Description: Core 1.0
Version: 1.0.0
About: v.1.0
Kernel description: #78_May27
Size of cram image: 47542272 bytes (45.34 Mb)
Size of kernel image: 6584320 bytes (6.28 Mb)
Unpacking cramfs image to cram.img
Unpacking kernel image to kernel.img

Warning: it will work only with the new E2 image format (I think >= Core RC12).

If for some weird reason you need to extract the linux binary kernel file, you must use those commands:
# mount -t auto -o loop kernel.img /mnt
# dd if=/mnt/xrpc_xload_vmlinux_ES4_prod.bin skip=1 bs=836 |zcat >/tmp/vmlinux.bin

P.S. To do the reverse (pack a patch.e2) follow this link: http://sourceforge.net/projects/rticoree2/files/image_tools/

Ciao, Dino.

unpack_e2.c

31 mag 11 liborient: A simple LGPLv3 linux C library proof of concept

Today i posted to the orientdb mailinglist and I’ve written about liborient, my very first orientdb C library implementation.
We are searching for new developers to join. This is what I putted to the list.

Hi all.
I’m making an attempt to write a proof of concept, simple, LGPLv3
OrientDB C library for linux.

The library is written in best effort, so don’t kill me if you see bad
code for now…
As a starting point, there is already a very first implementation of
some simple binary protocol methods.
For those there are interested, this is the API that it’s just (it
seems…) working with the latest OrientDB SVN version:
http://www.tuxweb.it/temp/apishot/liborient/liborient_8h.html#func-members

You can view development code here:
http://svn.tuxweb.it/cgi-bin/viewvc.cgi/liborient/trunk/main/liborient/src/

INSTALL:
1) Install the latest GNU autoconf, automake and libtool
2) svn co http://svn.tuxweb.it/SVN/projects/liborient/trunk/main/liborient
3) cd liborient
4) ./autogen.sh
5) ./configure –prefix=/tmp/liborient
6) make
7) make check
8) make install

Warning: this is a very first proof of concept implementation that I
started to study OrientDB. Do not use it in production environments.

Even if I think “the scalable way”, I’m a Linux SysAdmin and not a
full time developer, so may be the API is not well designed and the
code is ugly.
We need people that write code. If you are interested, please join in
and contribute.

This is a sample C program that links liborient… and works :-)
http://svn.tuxweb.it/cgi-bin/viewvc.cgi/liborient/trunk/main/liborient/test/single_orient.c?view=markup

<snip>
orientdb *oh;
o_conh *och;
unsigned long cid;

// create a new liborient handler
oh = orient_new();
// setup library debug level to “ORIENT_DEBUG”
orient_debug_setlevel(oh, ORIENT_DEBUG);
// setup debug callback
orient_debug_sethook(oh, &your_debug_function);
// preparing to open a new binary connection handler for orientDB
och = orient_prepare_connection(oh, ORIENT_PROTO_BINARY, “localhost”, “2424″);
// setting admin credentials
orient_set_credentials(oh, och, ORIENT_ADMIN, “root”, “pippo”);
// setting user credentials
orient_set_credentials(oh, och, ORIENT_USER, “reader”, “reader”);
// create the real connection with orientdb server
cid = orient_connect(oh, och, timeout);
// open the database “demo”
orient_dbopen(oh, och, cid, “demo”, timeout);
// get the DB size
dbsize = orient_db_size(oh, och, cid, timeout);
// get the total number of records
records = orient_db_countrecords(oh, och, cid, timeout);
// close the database
orient_dbclose(oh, och, cid, timeout);
// free library stuff
orient_free(oh);
</snip>

Any thoughts?
Ciao, Dino Ciuffetti.

11 mar 11 Japan earthquake 11 mar

earthquake in Japan: great number of big circles on my phone… never seen before… Japanese kids, guys, moms, people, hold on. We are with all of you!!!

android earthquake alert app, big circles on my android map over japan

android earthquake alert app, big circles on my android map over japan show a great number of big quakes over Japan. Hold on guys!! We are with you.

05 mar 11 Great event, great day

Today was one of the most productive day of the year for me. Codemotion event was great, full of great talks, good new ideas and tech staff demistified.
Great speech on orientdb and nosql by Luca Garulli and very good talk by Alessandro Nadalin: “REST in peace”, the RESTful + ESI correct usage.

02 mar 11 ajax_proxy cross domain php in bundle with orientdb

I’m very happy that my simple proxy php script is now in bundle with a great product: orientdb.
Now, I’m going to take two beers!! Cheers!!!!

28 feb 11 ajax_proxy: the cross domain PHP ajax proxy

Hi all.
Maybe all web developers know the security restriction that any browser enforce: ajax requests must be destinated to the calling application domain.

We may need for example an external HTTP/REST, RSS, generic low level XML or json encoded web provider, distributed database, and so on. So, how can a web developer design an application that make use of an external HTTP provider from the browser?

Obviously we can use a reverse proxy on the calling domain, like squid or apache mod_proxy (ProxyPass /yoururl http://destination:port/yoururl) and point the javascript XMLHttpRequest to the proxy that is inside the calling domain, or we can create a DNS third level A record in our domain that point to the destination server.

[WARNING!!!]
Working with proxy servers is very very very dangerous, so let do this to a good sysadmin! You are warned!
[/WARNING!!!]

While this is true, generally the web developer it’s not a system administrator or simply he wants to go on stage quickly and without too much effort.

So how can we solve the problem? We could implement a simple web proxy at the application layer that pick the request inside our domain and forward it to the destination server, then reply to the caller.

Let’s go on. Here at NuvolaBase.com we have developed the first version of a simple but powerful PHP script that aims to resolve the problem of having a javascript request that tries to retrieve a HTTP page published on an external domain. It’s called ajax_proxy and it’s open source (LGPLv3).

http://svn.tuxweb.it/cgi-bin/viewvc.cgi/ajax_proxy/ajax_proxy.php?view=markup

You can download it here:
svn co http://svn.tuxweb.it/SVN/projects/ajax_proxy/

or

http://svn.tuxweb.it/SVN/projects/ajax_proxy/ajax_proxy.php

It’s young but it implements GET/POST request, may be PUT/DELETE/etc. More tests to come.

Please let me know your stories and considerations.
I’m at: dino@tuxweb.it

Ciao, Dino.

08 feb 11 NuvolaBase.com, the OrientDB on the Cloud

So this is finally there. NuvolaBase.com (alpha release) has been published yesterday at UIM-GDB in Barcelona by Luca Garulli, the OrientDB author.

I am really excited as TuxWeb cofounder for joining our technical collaboration with him for the alpha realization of this project.

I personally cover all the system administration and low level stuff.

- dAm2K!!

26 mar 10 Il tuo server linux personale

Se quello che hai sempre cercato e’ avere il tuo personalissimo server linux up and running 24 ore su 24, SliceHost e’ l’opzione giusta per te.

Questa meravigliosa azienda americana (in Italia purtroppo certe cose ce le sogniamo alla grande!) ha sviluppato un sistema automatico con interfaccia web in grado di fornirti in tempo reale per pochi dollari al mese una tua personalissima macchina virtuale con cui potrai realizzare e gestire il tuo server linux in tutta tranquillita’.
Banda e connettivita’ internazionale a internet non sono un problema e potrai scegliere tra vari tagli di offerte pronte per te.

Se sei interessato, dai un’occhiata al sito https://manage.slicehost.com/customers/new?referrer=af57db3020e04bb27352e271753a7a18 e affiliati anche tu.

Avrai la possibilita’ di scegliere la distribuzione linux che piu’ ti aggrada e il tuo server linux personale sara’ in piedi in pochi secondi.

Noi di TuxWeb lo stiamo utilizzando con successo per gestire i siti internet di alcuni nostri clienti.

Ciao, Dino – http://www.tuxweb.it/

13 mar 10 DynaBlast, and your access_log give you something

If you want an apache httpd server access_log scanner written in C that check for you every IP address that exceed a given number of hits in the last given time period, then DynaBlast is a tool that make sense for you.

This tool, released as usual in GPLv2, can be spawned every minute in crontab without the risk of having two instances running: we make use of a lock mechanism.
It has a fast mode that can skip already parsed line from a consecutive scan, so each time it runs, it play very fast.

In stdout you’ll get the scanning result. Ex:

blacklisted:10.248.220.43
blacklisted:23.212.121.165

You can download DynaBlast from here: http://www.tuxweb.it/?section=progetti/dynablast

Ciao, Dino.

21 feb 10 Scandalo, the fast and Simple clamdscan mail frontend

Hi people.
I’m now talking about a simple GPLv2, C written, small program that work as a very fast clamdscan antivirus frontend.

Scandalo can take a mail on standard input and parse it from viruses, piping it to clamdscan.
It then get the virus status from clamdscan and put a mail header called “X-Virus-Ret” returning the virus scanner status.
It also put a mail header called “X-Virus-stream” returning the first virus name found (if any).

You can then setup a rule on your (say, maildrop) mail filter to pipe the incoming mail to scandalo, and another rule to check the return scanned mail header for viruses.
If a virus was found, you can drop the mail, or put it into a .Virus maildir.

If you have any question, I’m the developer of scandalo.
Scandalo – http://www.tuxweb.it/?section=progetti/scandalo&

Write me a note at dino@tuxweb.it.

Ciao, Dino.