Total Pageviews

Wednesday 5 October 2016

vagrant-hackerbox


The hacker's box built on top of Vagrant.

Background
Vagrant is a great tool for creating and configuring lightweight, reproducible, portable virtual machine environments. And there’re already lots of prebuilt boxes for instant use. But these bare boxes lack some necessary apps and tools, which means you should install and configure lots of things in order to have fun working with these bare boxes.
This project provides a simple, integrated way to bake a bare vagrant base box into a hackerbox, wait, what defines a hackerbox?
I think a hackerbox should:
  • have vim installed, together with a proper vimrc,
  • have a powerful interactive shell instead of the dumb system built-in shell,
  • have git installed, yeah, no git, no work,
  • have some tiny and convenient tools installed, such as curl, rlwrap, htop, etc.
That’s only the basics, since most bare base box contains Python, and I work with Python, so I define extra Python standards for my hackerbox:
  • have virtualenv installed,
  • have pip installed, enable pip download cache, set proper pip index-url.
I’m not familiar with Ruby or Perl, so I don’t know is there any amazing tools for Ruby or Perl. If you have some suggestions, please tell me, if you send me a pull request, I will be really appreciated.
The current hackerbox is built on top of ubuntu base box, especially on precise(ubuntu 12.04), other linux distribution base box will be supported in the near future.

Quick Start
You should have the following installed:
Then you should get a base ubuntu box, I recommend precise64:
vagrant box add precise64 --provider virtualbox http://files.vagrantup.com/precise64.box
Ensure you have the proper network connection, then:
git clone git://github.com/xiaohanyu/vagrant-hackerbox
cd vagrant-hackerbox
vagrant up
Then take a cup of coffee, have a rest, after 5 or 10 minutes, you’ll have a fully functional hackerbox, hooray!
As mentioned before, the hackerbox is built on top of prebuilt base box, you may wonder how. Actually, that’s why vagrant is such an amazing tool. The hackerbox is built through vagrant package, you may refer here for details.
vagrant package --output hackerbox_precise64.box
You can share your box with your friends! And, I share my prebuilt hackerbox with you:
vagrant box add hackerbox_precise64 --provider virtualbox https://www.dropbox.com/s/uzuc3h5p7tysin2/hackerbox_precise64.box
mkdir hackerbox
cd hackerbox
vagrant init hackerbox_precise64
vagrant up
Chinese user can get hackerbox_precise64 here. I didn’t find a good web storage which provide direct download link, such as dropbox, sorry for that.

What’s in HackerBox
Now let’s see what hackerbox provides for you.
First, it contains some ubuntu packages:
  • aptitude
  • ack: Beyond grep.
  • byobu: Text-based window manager and terminal multiplexer.
  • cloc: Count Lines of Code.
  • cscope: A developer’s tool for browsing source code.
  • curl: curl groks URLs.
  • htop: An interactive process viewer for Linux.
  • make: Just make it.
  • nmap: Free Security Scanner For Network Exploration & Hacking.
  • nmon: All in one Nigel’s performance Monitor for Linux.
  • pinfo: A lynx-style info and man reader.
  • proxychains: a tool that forces any TCP connection made by any given application to follow through proxy.
  • ranger: A vim-inspired filemanager for the console.
  • rlwrap: A readline wrapper.
  • tig: Text-mode interface for git.
For ubuntu’s apt, you can provide a custom sources.list to boost your apt-get.
The hackerbox replace bash with zsh as the default login shell, and integrate the popular community-driven oh-my-zsh framework. It also provide some tiny shell tools and settings, see hackerrc for details.
The hackerbox provide a handy python 2.x environment, including:
For vim, the hackerbox adopt amix/vimrc, which is the most popular ‘vimrc’ in github.
Enough stuff! The hackerbox has provided a really convenient and comfortable working virtual machine environment, at least for me. Hope you enjoy it!

Todo
  • Add some other popular linux distribution support, such as Arch, CentOS
  • Reorganize the ansible playbook directory structure.

References

from https://github.com/xiaohanyu/vagrant-hackerbox