There’s no place like ::1

I Bought a New PSP!

| Comments

Yesterday I bought a nice new Play Station Portable. Unfortunately, it came with a 2.71 TA-082 motherboard. I’m happy that it can now be downgraded to 1.50 as easily as the old motherboards.

Now I’ve ordered a 4Gb Sony Memory Stick Pro Duo from eBay and I’ll wait for it to arrive. Then we’ll have fun :)

Opening Files in GNOME

| Comments

If you ever wonder why MacOS users have a nice little command-line application called “open” to open an arbitrary file with the correct application, and you – a proud Linux user – don’t, you have come to the right place :)

If you use GNOME (KDE sucks :P) you probably have a nice little command-line application called “gnome-open”.

It does exactly what you are thinking. It find the mime-type of the file you pass as a parameter and use the GNOME configured application for that mime-type.

Since I am lazy (and probably you too) don’t forget to put this on your .bashrc (or equivalent):

alias open="gnome-open" 
alias o="gnome-open" 

Have fun with your console!

(Probably KDE (and others) have a similar application)

Extracting PHP From HTML Files With AntLR3

| Comments

As part of my investigation work on PHP, I needed a preprocessor capable of extracting all the PHP from a PHP file, discarding all HTML it encounters.

Initially I thought it would be a hard job, but latter found that AntLR3 makes this job really easy!

I wrote something like this:

lexer grammar FuzzyPHP;

options { filter=true; }

PHP : ‘‘ { System.out.println(getText()); };

This happens to work really good :) Now I can continue my PHP parser…

*: Of course my code doesn’t work when you have strings like '?>'. Here’s a new version that should work :)

PHP : ‘SINGLE_QUOTED_STRING | DOUBLE_QUOTED_STRING)) ’?>’ { out.println(getText()); };

SINGLE_QUOTED_STRING : ’\’’ (’\\’ | ’\\’’ | ~(’\’‘))* ’\’’ ;

DOUBLE_QUOTED_STRING : ’”’ (’\\’ | ’\”’ | ~(’”’)) * ’”’ ;

Linux and the AES Module

| Comments

Since the last year, I spent a lot of time studying cryptography and data protection on Linux. Since then I use cryptographic methods to cipher all my hard drives.

I started using loop-AES and then switched to dm-crypt + LUKS. This are really great and secure methods to protect your data. I spent some time using Twofish, but I found it slower than AES (I always use 256bit keys).

Recently however, I’ve heard that there are some Linux kernel optimized modules for specific hardware. I’ve header reports that these assembly implementations are more than 5 times faster than the C AES standard module.

Since I’m running ate 64bits on my server (Athlon 64 3500+), I decided to give it a try:

$ rmmod aes; modprobe aes_x86_64

And OH MY GOD!! It seems that I have a new machine!! This is completely different!! Thank you ASM sick guys!

PS – For you with x86 (Pentium or higher) use aes-i585

Pirate Ninja Penguins

| Comments

Today I give a talk at my university about data protection using cryptographic techniques in Linux. It was a good talk, there was around 30 people in the room.

The talk was recorded entirely so I plan to have a digital copy of me very soon :) I will post the slides on another post, as soon as they are uploaded to a stable server.

*: Slides PDF here. Enjoy! *[UPDATE 2]: The slides moved to another server. Get your copy here. Have fun :-)