Journalog #3: eudyptula – challenge #1

This is not really a challenge; I’ve done it before. Anyways, now I have the insight about what’s happening behind-the-scenes, and also it’s very easy to recreate the environment and obtain the tools I need to do it.

The first challenge is very simple, as rephrased in my own words:

Write a hello world linux kernel module for your current kernel (supposedly 2.6+), which writes “Hello World!” to your kernel debug log level, upon its initialization.

Tools and programs you’ll need: vim, make, insmod, lsmod, rmmod. And, later on, mutt or sendmail or similar to send your work to little.


It’s better to start with the Makefile. Add at least two targets to it: all and clean. Refactoring variables (for example, paths) is also nice, if you see yourself repeating the same strings in both targets.

Later, you will create a hello.c file which should be very simple in nature. It should have two functions, one for initialization and one for cleanup for the time the module is unloaded. It will probably also have a couple of standard macros for modules.

Testing your work should also be very straightforward: (i) make, (ii) insmod hello.ko, (iii) rmmod hello. And see your log messages with dmesg | tail.

After everything is done, you can use mutt to send your sources to little, either interactively (hint: use ‘a’ to add attachments) or with a single command:

mutt -s "<id> challenge 1" -a hello.c -a Makefile < <message>

where <message> is a file corresponding to the body or your email.


Journalog #3: eudyptula – challenge #1

Journalog #2: cryptopal

Little is dead. Probably. Whatever. My shitty mutt setup won’t have enough patience to wait for its reply, so I am moving on to another challenge.

But before, here is a quick pause to talk about setting up email clients: who cares??? Once upon a time, a few mistakes and years ago, I would find pretty awesome to have a decent mutt/alpine setup. Nowadays, this is pretty much useless, unless you also talk to other people with the same setup. For example, it is probably a paradise to use mutt to send emails to LKLM or to cool wizards like Eric Raymond or Richard Stallman, or even to the next g{uy,irl} replying to your comment on Hacker News. For now, I think Inbox is becoming more and more awesome. Disclaimer: this is not an ad, it’s just a personal recommendation from a guy that never lets its inbox have more than fifty unread emails (it all comes down to the whole debate between the oldieeee spam-fuck-off-from-my-mailbox and oh-your-email-is-super-relevant-cmon-lets-talk).

–> Cryptopals <–. Don’t expect me to duplicate information here, click in the link and see it by yourself. It’s basically a set of challenges about cryptography, in the same style of the eudyptula challenge. Theoretically, you don’t need any (prior) crypto experience to start with.

I would really like to learn Rust and to use that knowledge to solve these challenges, or alternatively Clojure and next-gen-Python. However, I don’t have much commitment to do this at the moment; I’d rather give it a shot with my wannabe C/C++ code.

If all goes well, then possibly a series of posts will follow with comments on each of the challenges. If not, then…what? Nobody will notice it anyway; everybody is busy out there trying to catch pokemon and/or watching Friends. Kinda reasonable, depending on your point of view.

So…here comes the nerdy stuff.


I should stop using the word journal. But here’s how I approached the challenge (you can do it in 5 minutes with your tricky Ruby/Python/Perl; you don’t need to read my poor adventures in C/C++. But it’s all about the experience; I’d rather spend one week in a single problem but get mostly everything out of it and document my thought process, rather than…(?)…blah):

Challenge 1, set 1: convert hex to base64. OK. Hex, not integer/ascii/char/byte. I struggled to get that. It’s actually kinda simple, but most converters you will find out there (including the base64 program available on OS X and on several linux distros) will assume your input is in ASCII.

So, no no no. Don’t you even dare to do a shitty system(“base64 <blablabla>”) call.

The first thing I did was to actually read how to convert from <blah> to base64. The process is really simple to understand (hint: Wikipedia), especially after you try it yourself with two or three examples. It does not really matter whether your input is in decimal/ASCII or hex; but hex is easier to manipulate.

Things that help:

  • bitwise operat{ors,ions} (especially <<, >> and &).
  • several helper functions (bonus: to do it in a functional language, it should be probably very elegant if it is well coded and idiomatic)

I decided to code and run everything within CRUX with vim and without any plugins, even my .vimrc file. Plain/vanilla stuff.

Here is the first working version of my code. Warning: coded after 1am. I am going to improve it until the weekend; more on that later.

….ooooops. Damn, I have a CRUX under VMWare. How do you expect me to copy the code to this blog? I don’t have a X server, I don’t want to install VMWare extensions, I don’t want to take a screenshot of the code (eeergh).


I will fix it before going to the second set. And that’s it for {the ,to}day.

Journalog #2: cryptopal

Journalog #1: eudyptula

I have no idea if it’s still alive, but I want to participate in the eudyptula challenge again. Last time I did it was probably a little less than 2 years ago, and I was still playing with with Arch at the time.

I am using OS X this month, which screws the whole thing from the beginning. I have to use a virtual machine then. VMWare Fusion is already installed in my system, so whatever. I have to grab a Linux box now. Heck…something very lightweight, no-frills. First thing that comes to mind: CRUX. Yeah, it’s you baby.

ISO file is ~400MB in size. I said lightweight, not small. Installation process is cool.

Screen Shot 2016-07-12 at 9.08.22 PM5 min or so and everything is properly set up. Bootloader, fstab…nothing fancy. CRUX uses LILO (I forgot about that!), but this is a simulated BIOS system anyway (in VMWare), so TO /dev/null, mister GRUB2! And you then reach a few seconds of enlightenment, away from the 21st century. systemd? Xorg? What’s that? OK, there are some btrfs packages laying around. Still!! What? The folks at (no hyperlink. Go figure.) have a point.

Serendipity: it turns out some people really take this seriously.

All set, rebooting. Let’s work!! I am going to do everything as root, I don’t care. Screw. It’s 2016, virtual machines do have snapshots, bae.

I need to send one plain text (non-HTML) email to start the challenge. That’s all. So I need to grab mutt. I don’t care about sendmail, mail, fetchmail, whatever; so I will need a TUI to do basic stuff. Yah, I know, mutt will use sendmail behind-the-scenes, whatever.

This leads me to…package management. How to install mutt? Heck, no apt-get, yum, pacman. I chose CRUX, now I pay for that, right?? Not really. CRUX has a very basic ports/package management system, I’d compare it to OpenBSD. Hopefully, mutt is going to be present there. It is. So…1 or 2 min reading its handbook and it turns out all I need is

ports -u && prt-get install mutt

Cool. Now here comes the PITA stuff. I have to get a very basic ~/.muttrc. Well, it would be a PITA if we were in the 2000s, but no one cares about man pages anymore(1). Stack Overflow and hippie blogs are the way to go. So a quick Googling here and there leads me to a basic IMAP + SMTP mutt setup with my email provider.

…er, no. Grrrrrr. Mutt does not recognize smtp. Whaaat?! It turns out the default mutt from CRUX is not compiled with smtp enabled. You gotta be kidding me. Okay, let’s compile it from source with the correct flags. I would usually probably take 20+ minutes to figure this out, but I think after all these years playing with linux distros I learned something. It took me less than 3 minutes to go to /usr/ports/opt/mutt and edit the Pkgfile over there, then run pkgmk and finally pkgadd -u to install it. I didn’t have any prior knowledge of this stuff, it was mostly a matter of Cmd-F’ing the handbook webpage and introspecting (=a fancy word for trial-and-error) the command line.

OK, mutt is now installed. WITH SUPPORT FOR EVERYTHING I NEED, damn it. Now…let’s log in. Cool, it works. Actually…my email provider (Google, yaaay) tells me I am logging in from an insecure app, and thus it blocks my login attempt. Aaaaaaaa….ok, I like this feature! But I temporarily disable it (note to self: re-enable it later, you security freak creature!).

Test #1: hello world email sent back to myself. OK, my phone rings. In fact, twice. Leave me alone, I am migrating my apps, I have more than one email client installed on it. You never did that?! Well…everything’s working, so I just send an email to little@eudyptyla.

And this is supposed to be a happy ending. For today. Except that…maybe this challenge does not even exist anymore. I hope it does, I really want to do it. Time is key.

Screen Shot 2016-07-12 at 9.35.04 PM.png


(1) man anymore: this is my first footnote. For more information, see anymore(8).

Journalog #1: eudyptula