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 cRARk.net 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.

Cheers!

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?

wifi1

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.

wifi4

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.

Cheers!

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

Host example.com
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.

Enable HTTPS on Apache2

This would be a quick way to enable HTTPS (SSL) on Apache2.

cd /etc/apache2/sites-enabled
ln -s 001-ssl ../sites-available/default-ssl
nano 001-ssl

Make sure that the vhost configuration is valid. By default it is configured to /var/www. You might want to have some other directory as your document root.

Then run

a2enmod ssl
service apache2 restart

Do leave a comment if you get any errors. Remember to use sudo if you do not have a root shell.

Find Big Files Wasting Your Disk Space With WinDirStat

Storage isn’t that much of a problem anymore, since storage capacity is cheap. But, then again, the files we store are a lot bigger today. And how are you supposed to find what files are hogging your storage space?

For finding a stray file, searching for an asterisk (“*”) and then sorting by size does the trick. No need for fancy software. But sometimes your need a little bit more power.

WinDirStat will, after analyzing your hard drive(s) give you some really useful information. Primarily, you will see a graphical representation of your space, allowing you to find large files in an instant. It will also allow you to see the size of any directory (which is the sum of its content).

You can see how much space every file type allocates. So you’ll be able to notice large amounts of small files as well. Go check WinDirStat out! (http://windirstat.info/)

There’s a Linux variant available as well.

iPhone 4 Dies Before 0% Battery

Some time ago my iPhone 4 died, claiming it was low on battery. Strange, I thought, because it reported 15% just a few minute earlier. So why would my iPhone discharge before the battery is drained?

Turns out the iPhone 4 (or any other model, perhaps) can at times report an incorrect amount of charge. Perhaps you’ve never fully charged the device, or perhaps a bug occurred.

Anyway, how do you fix the battery meter on the iPhone 4?

  1. Restart your iPhone.
  2. Then, you drain the battery. Let the phone discharge on its own, or speed it up by using it (i.e. playing a game).
  3. Let it sit for an hour or two. This is to make sure it’s empty.
  4. Start charging your iPhone, and be sure not to interrupt the charging
  5. Let it sit for an additional hour or two after it’s fully charged. This is to make sure it’s fully charged.

That’s it! Now your iPhone should be recalibrated and report the correct charge.