The Fuck

Magnificent app which corrects your previous console command, inspired by a @liamosaur tweet.

Few more examples:

➜ apt-get install vim
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

➜ fuck
sudo apt-get install vim [enter/↑/↓/ctrl+c]
[sudo] password for nvbn:
Reading package lists... Done
➜ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

➜ fuck
git push --set-upstream origin master [enter/↑/↓/ctrl+c]
Counting objects: 9, done.
➜ puthon
No command 'puthon' found, did you mean:
 Command 'python' from package 'python-minimal' (main)
 Command 'python' from package 'python3' (main)
zsh: command not found: puthon

➜ fuck
python [enter/↑/↓/ctrl+c]
Python 3.4.2 (default, Oct  8 2014, 13:08:17)
➜ git brnch
git: 'brnch' is not a git command. See 'git --help'.

Did you mean this?

➜ fuck
git branch [enter/↑/↓/ctrl+c]
* master
➜ lein rpl
'rpl' is not a task. See 'lein help'.

Did you mean this?

➜ fuck
lein repl [enter/↑/↓/ctrl+c]
nREPL server started on port 54848 on host - nrepl://
REPL-y 0.3.1


Create Virtual Hosts with Apache

Apache is very flexible, and it’s easy to configure Apache to handle several domains even when your Web server only has one IP address to share between them. You can use this to host multiple sites, or just to provide a sandbox for development rather than making changes on your live site. This weekend, we’ll learn how to create virtual hosts with Apache.

Setting up virtual hosts might seem like a big challenge, but it’s not. In fact, you can set up a virtual host with just a few edits to Apache’s configuration and by setting up additional directories for the documents. For this how to, I want to use an Apache installation on a Ubuntu server. Please be aware, the instructions for this may require modification if being done on a non-Debian distribution because of the way that Apache is packaged. However, the Apache directives should be standard across distributions and should work even if Apache isn’t running on Linux.

Creating the Directory Structure

Before the configurations can be tackled, the directory structure for the virtual site must be created. We are going to be working with Apache as installed on a Ubuntu server, so the Apache document root will be/var/www. The directory structure for the new Web site can be created anywhere. Some create those directories in their home (~/) directory, some create them in /usr/local/apache, and other, various locations. For the sake of simplicity, We are going to illustrate setting the virtual host in the document root of Apache (in Ubuntu that would be /var/www). By doing this, it will not be necessary to change ownership of the newly created directory or the parent directory housing the virtual host (since Apache must have access to the directories and files.)

We are going to set up the virtual host So to create the directories for the virtual host, the following commands must be run:

  • sudo mkdir /var/www/
  • sudo chmod -R 755 /var/www/

Now that the home directory for the virtual host is done, it’s time to start configuring Apache so it is aware of the new site. After configuring Apache, the site can then be built within /var/www/

Apache Configuration

The first step in the Apache configuration is to make sure Apache knows virtual hosts are enabled. In the Ubuntu set up look for a line (near the bottom) of /etc/apache/apache2.conf that looks like:

Include sites-enabled/

Make sure that line is not commented out (does not begin with a ‘#‘ character). That sites-enabled include points to /etc/apache/sites-enabled. A look in that directory will reveal a file called 000-default. That file should contain all of the directory containers needed for virtual sites on the server. To create a new virtual host (to map the example, create a new file within sites-available called /etc/apache/sites-available/ The contents of that file will look something similar to this (depending upon the needs and application of the virtual host):

   ServerAdmin webmaster@localhost
   #We want to be able to access the web site using or
   DocumentRoot /var/www/
   #log file for this server
   CustomLog /var/log/apache2/ combined

The above code assumes that is the actual domain to be used (insert proper domain where necessary). It’s almost ready to fire up, but we have two simple steps left before restarting Apache. The first step is to create a link in /etc/apache/sites-enabled to the file we just created. This is done with the following steps:

  1. Change to the /etc/apache/sites-enabled directory with the command cd /etc/apache/sites-enabled .
  2. Create the link with the command sudo ln -s /etc/apache/sites-available .

It is also possible to create the links automatically with the command sudo a2ensite and then, should the virtual site need to be disabled, remove the link with the command sudo a2dissite

The last step is to make sure the server knows that our new virtual site is to be found on the server and not out on the Internet. For this, do the following:

  • Open up the /etc/hosts file in a text editor (with administrative rights).
  • Add a line like localhost.localdomain localhost .
  • Save and close that file.

Now it’s time to restart Apache with the command sudo /etc/init.d/apache2 restart and test virtual host by pointing a browser to the address.

Non-Debian Servers

If the server hosting the virtual sites is a non-Debian distribution, the steps are different for hosting virtual sites. Here’s how it works:

  1. Create the directory container for the virtual site in /etc/httpd/conf/httpd.conf. This container will look similar to that used for the Debian-based server.
  2. Make sure the Apache configuration file is aware of virtual hosts by making sure the line Include conf.d/*.conf is not commented out.
  3. Create the new virtual hosts file (we’ll call it vhosts.conf) in /etc/httpd/conf.d/ .
  4. Add the virtual site to the /etc/hosts file.
  5. Restart Apache with the command /etc/rc.d/init.d/httpd restart.

The directory container, for the non-Debian host, will look similar to the very basic container below:

<VirtualHost *:80>
   DocumentRoot /var/www/html/

The virtual hosts file mentioned above, will need to look like this:

   DocumentRoot /var/http/www/

   DocumentRoot /var/http/www/

Building Time

Now that the virtual host is up and running, it is now possible to build the site within the/var/www/ directory.

You can do this for as many virtual hosts as you need (assuming the server can take the added load).


Building a Huge Dictionary, for Dictionary Attacks in Hacking

For Wifi Hack: Crack WPA2 Or WPA Password, we generally use a dictionary attack, a brute force type attack in Kali Linux. It has to certain some complex computations and processings but by the end of it it still needs a good word dictionary to actually be able to attack and be successful.

I have just made an attempt to be able to create an exhaustive word list, via permutation and combination of all possible characters based on a US-English Keyboard.

Below is the code for the same:

package in.techutils.wordlist.generator;

import java.util.ArrayList;
import java.util.List;

public class Tester {

    public static List combos = new ArrayList();
    public static int fileIndex = 0;
    public static final String PATH = "C:/Projects/ set";

    static void printAllKLength(char set[], int k) {
        int n = set.length;
        printAllKLengthRec(set, "", n, k);

    static void printAllKLengthRec(char set[], String prefix, int n, int k) {

        if (k == 0) {
            if (combos.size() == 999999) {
                System.out.println("Writing to File..." + (++fileIndex));
        for (int i = 0; i < n; ++i) { String newPrefix = prefix + set[i]; printAllKLengthRec(set, newPrefix, n, k - 1); } } public static void main(String[] args) { char set1[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 !`~:;_@#$%^&*(){}[]-_=+|?".toCharArray(); int k = 8; printAllKLength(set1, k); } public static void fileDump() { PrintWriter out = null; try { out = new PrintWriter(PATH +" "+ fileIndex + ".txt"); StringBuffer sb = new StringBuffer(""); for (String comb : combos) { sb.append(comb).append("\n"); } out.println(sb); } catch (Exception e) { System.out.println("error for file: " + PATH +" "+ fileIndex + "--->"
                    + e);
        } finally {
            if (out != null) {



The Algorithm stores 999999 keys per file leading upto 8MB per file.

Also this process is for 8 key characters only. It will be more time taking in 8->16 characters.
The above code is lengthy approach but I think it must be extensive enough. I had to kill the process midway(1 hr into the execution) and ended up with 74.5 GB.

If anyone can run this and get it completed, i think we will be having the complete dictionary attack set….:)