Category Archives: Scripts, Programs

Automatic backup when inserting a drive

I bought a 500 GB 2.5″ external disk drive to backup the data of my laptop. It is small, quiet, easy to move and far enough for the important data I want to backup, mostly documents, e-mails or script from work. Being lazy, it happened that I did not backup my data. Yes, it is [...]

Yersinia : patch to compile under openSUSE (11.1)

Yet another post in the series of compilation failures due to unexpected libraries paths. This time, it is about Yersinia and the ncurses library. I made the following yersinia-opensuse11.1 patch which should work for openSUSE 11.1 and maybe other versions or distros.

Compilation of PackETH on openSUSE

PackETH is a nice gkt tool to play with Ethernet packet. I encountered some path issues with the Makefile and openSUSE 11.1 64 bits to compile it, so here is the packETH-opensuse patch to compile correctly. If you are on a 32 bits system, all you will have to do is editing the CPPFLAGS line [...]

“Why Mono doesn’t suck”

For the sake, a nice post which I hope will contribute to stop the FUD against Mono.

Hacked !

This blog got hacked yesterday. It looks like some spammer managed to inject some PHP code into almost all *.php files of WordPress. It was not just like the classic SQL injection that is usually used to post some malicious post. The following code was added :

Perl : how to monitor a service remotely using sockets

I came to program my first Perl script based on sockets, after setting an IPSEC tunnel.

This tunnel is linking the remote peer and the local peer through an OpenBSD VPN gateway (managed with Isakmp).

The problem is that this connection is limited time, for access right reason. So it is not a 24 hours standard tunnel, but rather an on-demand type connection.

Note that the connection is automatically reseted by the remote peer, by invaliding the cookie of the connection and therefore obliging to renegotiate the VPN tunnel from the beginning : phase 1 of the key exchange.

In one word, the Isakmp service has to be restarted every time we need the tunnel to be up.

Of course, this is not the purpose of Isakmp to have such a mecanism and what is interesting is to start the tunnel from the local peer, every time it needs to do some transfer.

The graph below summarizes the situation :

IPSEC tunnel with OpenBSD as a VPN gateway

That why I came to develop a script that listen on a socket and allow that peer to remotely restart the Isakmp service.

How to strip the attachment from an IMAP mail

While trying hard long and long hours to write a perl script that can extract attachments from pieces of e-mail, I realized that there were no clear info on the web on how to do, and that if I successed, I would publish that script.

Finally I succeded. That is actually very easy and that is probably why nothing was ever published about it. But, when you are a beginner in Perl (I learned it in 1 week), you normally need a little bit more help. Also, I was not alone in that case and there were a numerous questions on various forum, but without satisfying answers.

OpenVPN and DNS on a linux client

I got a weired issue with Linux clients while it worked fine with Windows machines. For some reason, the /etc/resolv.conf did not get updated.

I found out a workaround thanks to this page.

Of course, your server configuration file must contain (if 192.168.1.1 is your DNS server):

push "dhcp-option DNS 192.168.1.1"