Sharing Your Hotel WiFi Voucher With Yourself

If you are in a foreign country, away from home, staying at a hotel, chances are you have horrible data roaming. Whether it is speed or cost, you want to get connected to a wifi hotspot as soon as possible.

Security problems aside, one of the issues with paid (or given as a pre-paid voucher to staying guests) wifi is that the system has some form of access controls. Most often your browser will get hijacked and taken to the log-in page. When you authenticate, the hotspot associates your MAC address with the credentials you supplied, and you are free to browse the internet.

Well, what happens if this association is permanent? I.e. once you log in with your computer, only that computer can use the hotspot. What about your phone? What about other devices? In such case, you have purchased internet access, but the access is restricted to one appliance, instead of one person.

There may be terms and conditions which you could violate by bypassing the restriction. Read them and see if you’re allowed to connect other devices.

Meh. So how could we get around it?

Solution: share internet from this device.
So you got internet on your phone. Good. Share this access via cable or bluetooth (or wifi, perhaps) with your other devices. Problem solved! Quick and easy, if your phone supports it.
You could do this with your laptop as well, but you would probably need an external wireless network card as well.

Solution: use the same MAC address.
Note the MAC address of your phone, and then associate the account with your phone. When you want to use your laptop, simply change the MAC of your wireless interface to that of your phone. Disconnect your phone before you connect your laptop.
On Linux, you would run something like “sudo ifconfig wlan0 hw ether aa:bb:cc:dd:ee:ff”, where wlan0 is your wireless interface and the a-f is the MAC of your phone.

Extending the Wired Network Without any Cables

In the time before wireless, we used copper cables to get connected to the rest of the internet. That worked fine, until WiFi made us lazy cable-hating internet consumers. If you need cable connection, then the cat6 should be inside your walls. But preferably you shouldn’t have any cables at all. And if you’re living in a house where you can’t do cable management inside the walls, there are special ethernet-via-power-outlet appliances you can get as a workaround.

I don’t trust those appliances. They are lousy. But I needed a wired connection to my Raspberry Pi and NAS, which just happened to be in the other side of my apartment, some very-far distance from my router. How do I do that?

Well, I could ignore the fact that cables are an eye sore, and condition myself to not see a potential cable running along the walls (or across the floor, most likely). But I’d probably never hear the end of it whenever someone came to visit.

I could move the devices, although that wouldn’t be much fun.

I could try to fit the devices with WiFi. Finally, an idea which seemed promising! The Raspberry Pi could run a wireless adapter, and then bridge that via the ethernet port to the NAS. The speeds would be terrible, it would be rather unstable, and it would not support any additional network devices… but it would do the job.

Finally, I looked around and purchased a €10 wireless router which I then hooked up as a client to my existing wireless network. The configuration bridges the 4 ethernet ports with the rest of my network. It’s not as cheap as using a cable, but it’s a pretty inexpensive solution anyway. I haven’t benchmarked the speeds, but
I haven’t run into any issues thus far with it :).

This Blag Ain’t Dead Yet!

All right, all right, I admit there has not been a content update in quite a while now, but that doesn’t mean that the blog is dead! It’s still very much alive and still going strong with some a lot of daily visits.

The life signs might have been weak, but that doesn’t mean that the heart wasn’t beating. I’ve still been doing the required WordPress-maintenance; approving comments, updating, emptying the spam (some 14k messages per time!). So why didn’t I write?

I’d say time constraints. But that’s only half the truth.

I’d say that I’ve done nothing interesting, nothing that is worth writing about. But that simply wouldn’t be true.

It’s more a combination between having a lot of other engaging projects, together with already having too much stuff to write for other purposes.

Oh well.

Let’s see if we can get this blag moving again :).

Recovering a WinRAR Archive Password

Passwords are great, and most of the time it’s safe to forget one of them. If you forget your password to some online service, you’re (almost always) able to restore it via some web interface. If you forget your Windows password (not including Windows 8, perhaps?) you’re able to alter or wipe it using some live system running off a CD or USB-thumbdrive.

Forgetting an encryption password is a bit worse, since the entire point of encryption is to make the information unreadable unless you have the right key. Some systems have recovery measues in place, but far from all. So if you forget the password to your RAR archive, what can you do?

Some of the compression archive formats support password protection (which is encryption), but this only covers how to recover WinRAR passwords.

And recovering is a nice word for cracking. And no, you’re not allowed to crack other people’s archives.

Step 1: Download cRARk

You’re able to get the software from for free. There are both Windows and Linux versions available, as well as with and without GPU support. While I havn’t had the pleasure of testing the GPU versions, generally utilizing the GPU makes the entire process a lot faster.

Step 2: Extract

Extract the archive. I’ll leave this to you. I reckon you must already be able to handle RAR files, since you are recovering the password for one =).

Step 3: Run

Open a terminal (or cmd.exe, if you are on Windows) and navigate to the folder where you extracted the archive. In Windows, you can hold Shift and right click – and then click “open command window here”.

On Linux using the non-GPU version, you can type:

./crark-hp -g15 -ptest.def myarch.rar

The first part is the binary (program) used. “./” indicates that we want to run the program named crark-hp in our current folder. You can try to use crark as well, but it failed to detect RAR version for my test archive.

“-g” defines the maximum character limit that the program will search through. “-g15” sets this limit to 15. You can use the “-l” flag to set the minimum limit. Note that no parameters have space between the flag and the value.

“-p” sets the password definition file. The standard is default.def, which you will have to create yourself. Specify it to make sure what rules you are running. More about this later on.

“myarch.rar” specifies the RAR file to use.

Step 4: Done (or not?)

cRARk will notify you when it has either found your password or exhausted the key space (searched everything and found nothing).

About password definition files

The password definition files basicly define what passwords should be used. We are performing a brute force attack, but can specify what set of characters to use. cRARk comes with good documentation on how to write this file, and what can be used to efficiently recover passwords. You can find the chapter on the definitions here.

An example would be (haven’t tested this one, beware typos):

$a = [abcdefghijklmnopqrstuvwxyz]
$a *

Or look at the sample english.def.


How to Fix Windows 7 Not Detecting Any Wireless Networks.

A few weeks ago my laptop running Windows 7 failed to detect any wireless networks after waking up from sleep. After a couple of reboots it suddenly worked until the next power or sleep cycle. Rebooting and hoping for the best wasn’t a viable option…

So how do you fix Windows not finding any wireless networks?


As it turns out, reinstalling the driver works (or at the very least it works for me every time). There might be an issue between the system and the driver.

Step 1: Open device manager (bring up the start menu (press the Win-key) and type device manager, open it) and expand the tree containing network devices. Right click on your wireless card and select uninstall.

wifi2Make sure not to delete the actual driver, because that will prohibit Windows from reinstalling the driver later on.

Step 2: Right click on Network Adapters and select Scan for Hardware Changes. Well, you can pretty much right click anywhere and select that option.

Step 3: Done! Your computer should now detect wireless networks like it should Connect to your wireless network! You might have to enter your wireless key again – I have to re-enter it every single time I do this procedure.


Hope that works for you!

How to Restore OwnCloud Password Without an Email

Forgetting your password can be tiresome, especially if you’re the (only) administrator. Owncloud allows you to reset your password via the user-supplied email address, but this does of course only work if you have an email associated with your account.

Furthermore, the system needs to have a mail server configured. Perhaps you don’t, because of some reason, want to have a mail server up and running.

So here’s how you reset your owncloud admin (or user) password the quick and dirty way.

NOTE: This worked for me, at the time of posting. Future versions might not work this way. Please do proper research before looking into my solution. I am in no way responsible for you breaking something. OK?

First, log in as root or make sure you have sudo access. Or at least make sure you are allowed to modify the owncloud files.

cd /var/www/owncloud/core/lostpassword

We will be modifying the password reset function, instead of going into the database. Please back your existing controller.php file up, and understand that you are going to be susceptible to hacking attempts while making the following modifications.

nano controller.php

We want to supply an email to the system by hard-coding it, and then print the password-reset URL to us. OwnCloud will then continue with its own procedures and attempt to mail the password to the email you provide. Essentially we’re printing the link you’re supposed to get via mail. If you leave this modification in place, anyone will be able to gain access to your OwnCloud!

Go to line 48 and on the line below insert (line 48 begins with $email)

$email = “your-email@domain.tld”; //Set email

Then go to line 53 and on the line below insert (line 53 begins with $link, and this is line 53 after you added the previous line.)

echo $link; //Print email reset link (DO NOT LEAVE THIS IN PLACE)

Now go to your OwnCloud, and try to log in. When it fails, click forgot password link, and then enter your username. You should see the password reset URL pop up. Copy, paste, and chose a new password.

Then, enter

nano controller.php

And remove the lines you just added! DO NOT LEAVE THEM IN PLACE.

I found this to be easier than to edit the database.


Configure SSH to Use Keyfiles Automatically

If you have multiple SSH-keys, perhaps a different one to each server, this can make your life a lot easier. Less typing is better.

Or perhaps you are configuring a remote git repository, or access through some other software.

Go ahead and

nano ~/.ssh/config

And add

IdentityFile ~.ssh/yourkey

Change the domain and filename of your key to the proper values.

Stop Apache2 from listening on port 80

I assume you have enabled SSL so the site is accessible via HTTPS.

Assuming you haven’t changed the configuration, go ahead and type

unlink /etc/apache2/sites-enabled/000-default

This would remove the symlink named 000-default, which points to the default vhost found in sites-available. If you have altered the config, make sure to remove any vhost listening on *:80.

This first step is kind of straight-forward. You want Apache2 to stop listening on port 80, you remove any vhost on that port. But that’s not all.

Open up ports.conf

nano /etc/apache2/ports.conf

Comment out (put # at the beginning of the line)

NameVirtualHost *:80
Listen 80

Go ahead and restart the web server and load the changes

service apache2 restart

Now Apache2 should listen on port 443, and 443 only.