NuLL3rr0r

The blog of Mohammad S. Babaei

International Day Against DRM at Packt Publishing

Digital Restrictions Management (DRM) harms almost everyone, but most people have never heard of it. Today is one of our best opportunities to change that.

There are people around the world coming together to say that we will not tolerate the remote deletions, unethical surveillance, and invasive restrictions of DRM. In fact, with events in at least nine countries and huge online participation, it’s the world’s biggest anti-DRM protest.

Well, I just found out that this year, to demonstrate their continuing support for Day Against DRM, as they celebrates International Day Against DRM, May 6th 2015, Packt Publishing is offering all its DRM-free content at $10 for 24 hours only on May 6th – with more than 3000 eBooks and 100 Videos available across the publisher’s website.

Book Review: Application Development With Qt Creator - Second Edition

Almost three weeks ago I received a review request from one of the Packt Publishing staffs to review Application Development with Qt Creator, 2nd Edition written by Ray Rischpater which has been recently published by Packt Publishing. Since I’ve been developing cross platform Qt (cute, often mispronounced as Q-T cue-tee) applications from Qt 4 era back in 2008 – when Qt Creator was not around yet and the project was running by Trolltech at the time – and a handful of Qt Quick mobile applications over the past two years, I consider myself eligible enough to write a brief review on it. So, I was provided with a review copy and after reading it cover to cover, my thoughts on the book are as follows.

Application Development with Qt Creator, 2nd Edition

Application Development with Qt Creator, 2nd Edition (by Ray Rischpater, Packt Publishing)

Wifi Fix for Asus Google Nexus 7 Cellular, When SIM-Card Is Inserted

As a Nexus 7 tablet user I’ve been struggling with my Nexus 7 WiFi from the moment that I’ve owned it. It was originally released with Android 4.2.0 installed. Nonetheless, Android 4.2.1 and 4.2.2 didn’t get me anywhere with the WiFi issue. In fact, you may have suffered from this issue, and are already familiar with. After inserting a SIM-Card into the device, Android asks to restart the device. However, after rebooting you will notice the WiFi module won’t work. No matter how hard you try it won’t see any WiFi network while keeps saying “WPS failed. Please try again in a few minutes”. Even tried an open unencrypted WiFi without any luck. In fact, the only solution that worked for me was removing the SIM-Card completely and do a factory reset.

Also as you may have noticed, it’s been quiet some time since an issue has been opened on Google Code around this issue on Nexus 4, Nexus 7 and Nexus 10 devices. Unfortunately, it seems that Google doesn’t care about this issue at all, and they closed the issue while ago. Even worse, they won’t allow comments any more (At the time of this writing there are 1223 comments on the issue which shows how serious the situation is).

Anyway, if you’re one of the sufferers from this issue, still there may be some good news for you. It appears that the root of all evil is inserting a non-U.S. SIM-Card on your device. Hopefully, I suddenly came across an Android application called WiFi Fix for Android 4.x by Fardjad Davari, which completely solved the problem for me. It’s been a week since I tried this application and found no more issue with my WiFi.

In fact, the process is very easy and straightforward to follow. Here is what worked for me on Nexus 7 with latest CyanogenMod 10.1 nightly builds (It may work on Nexus 4 or Nexus 10, too):

Getting Real IP Addresses Using Nginx and CloudFlare

OK, I suppose you know what CloudFlare is, and are familiar with Nginx configuration process, before we proceed any further. Just in case you don’t know, CloudFlare offers free and commercial, cloud-based services to help secure and accelerate websites. The thing is, I’m really satisfied with the services they offer except a repellent issue about logging the real IP address of your website’s visitors. Since CloudFlare acts as a reverse proxy, all connections come from CloudFlare’s IP addresses, not the real visitors anymore. Anyway, using Nginx there’s a simple workaround for this issue, which I’ll describe in the rest of this post.

Colors Talk: A Colorful Terminal / Console

If you’ve ever used a GNU Gentoo or Funtoo Linux variant, or a live version of any of them, you may have noticed their eye-catching colorful terminal or console. Whether you’re on a virtual console or one of KDE, GNOME, XFCE, LXDE terminal apps.

A Colorful Xfce4 Terminal on FreeBSD (Bash)

A Colorful Xfce4 Terminal on FreeBSD (Bash)

The default Xfce4 Terminal on FreeBSD (sh/csh)

The default Xfce4 Terminal on FreeBSD (sh csh)

When I’ve migrated from Funtoo to FreeBSD, the one thing that I’ve missed so badly was its colorful terminal. The nice thing about these colors is taht they always give you some valuable hints, e.g., currently you’re root user or a regular user, the file is a symlink (Symbolic link), executable or just a regular file.

Well, it’s pretty easy to have your own colorful terminal or console, once you’ve found out how Gentoo and Funtoo did that. Fortunately, it works on *BSD and all other Linux distros as well. So, stay with me and I’ll describe the process in the following.

Nano, Syntax Highlighting

GNU nano is my favorite text editor while I’m on console. Although, it doesn’t offer syntax highlighting by default, it comes with a decent set of syntax highlighting files. Usually, these files are exist in /usr/local/share/nano or /usr/share/nano, depending on your distro’s preference. You can enable syntax highlighting for your prefered language(s) by including related file(s) with .nanorc extension in your ~/.nanorc file.

~/.nanorc - FreeBSD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
include "/usr/local/share/nano/asm.nanorc"
include "/usr/local/share/nano/awk.nanorc"
include "/usr/local/share/nano/c.nanorc"
include "/usr/local/share/nano/cmake.nanorc"
include "/usr/local/share/nano/css.nanorc"
include "/usr/local/share/nano/debian.nanorc"
include "/usr/local/share/nano/fortran.nanorc"
include "/usr/local/share/nano/gentoo.nanorc"
include "/usr/local/share/nano/groff.nanorc"
include "/usr/local/share/nano/html.nanorc"
include "/usr/local/share/nano/java.nanorc"
include "/usr/local/share/nano/makefile.nanorc"
include "/usr/local/share/nano/man.nanorc"
include "/usr/local/share/nano/mgp.nanorc"
include "/usr/local/share/nano/mutt.nanorc"
include "/usr/local/share/nano/nanorc.nanorc"
include "/usr/local/share/nano/objc.nanorc"
include "/usr/local/share/nano/ocaml.nanorc"
include "/usr/local/share/nano/patch.nanorc"
include "/usr/local/share/nano/perl.nanorc"
include "/usr/local/share/nano/php.nanorc"
include "/usr/local/share/nano/pov.nanorc"
include "/usr/local/share/nano/python.nanorc"
include "/usr/local/share/nano/ruby.nanorc"
include "/usr/local/share/nano/sh.nanorc"
include "/usr/local/share/nano/tcl.nanorc"
include "/usr/local/share/nano/tex.nanorc"
include "/usr/local/share/nano/xml.nanorc"
~/.nanorc - Funtoo or Gentoo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
include "/usr/share/nano/asm.nanorc"
include "/usr/share/nano/awk.nanorc"
include "/usr/share/nano/c.nanorc"
include "/usr/share/nano/cmake.nanorc"
include "/usr/share/nano/css.nanorc"
include "/usr/share/nano/debian.nanorc"
include "/usr/share/nano/fortran.nanorc"
include "/usr/share/nano/gentoo.nanorc"
include "/usr/share/nano/groff.nanorc"
include "/usr/share/nano/html.nanorc"
include "/usr/share/nano/java.nanorc"
include "/usr/share/nano/makefile.nanorc"
include "/usr/share/nano/man.nanorc"
include "/usr/share/nano/mgp.nanorc"
include "/usr/share/nano/mutt.nanorc"
include "/usr/share/nano/nanorc.nanorc"
include "/usr/share/nano/objc.nanorc"
include "/usr/share/nano/ocaml.nanorc"
include "/usr/share/nano/patch.nanorc"
include "/usr/share/nano/perl.nanorc"
include "/usr/share/nano/php.nanorc"
include "/usr/share/nano/pov.nanorc"
include "/usr/share/nano/python.nanorc"
include "/usr/share/nano/ruby.nanorc"
include "/usr/share/nano/sh.nanorc"
include "/usr/share/nano/tcl.nanorc"
include "/usr/share/nano/tex.nanorc"
include "/usr/share/nano/xml.nanorc"

Note: If the file doesn’t exist, you should create it first:

1
$ touch ~/.nanorc

Nano, Do Not Wrap Text

GNU nano is my favorite text editor while I’m on console. However, there’s one thing about nano which annoys me: automatic text wrapping!

Hopefully, there are two simple ways to overcome this. By using either -w command-line argument, or set nowrap configuration command within the file ~/.nanorc.

1. The temporary solution by using -w command-line argument, which should be used each time you run nano:

1
$ nano -w /path/to/file

2. The permanent solution by setting off automatic text wrapping using the configuration command set nowrap, in the ~/.nanorc file:

~/.nanorc
1
set nowrap

Note: If the file doesn’t exist, you should create it first:

1
$ touch ~/.nanorc

Write Your Own Cross-platform Cryptographic Library

Previously I’ve described the process of building Crypto++ on both FreeBSD and Windows using the GCC, MinGW and VC++ compilers.

Now, we want to develop our own cross-platform cryptographic wrapper library around Crypto++. I’ve already uploaded the full source code to GitHub. You can find the link to the code on github at the end of this article.

Before you proceed, you have to build the Crypto++ library as I mentioned earlier here.