Monday, August 25, 2014

How to install Kali Linux in Ubuntu Virtualbox for penetration testing and hacking

 
 

   In this post, I'm going to share step by step how to install Kali Linux in Ubuntu Virtualbox for penetration testing and hacking.Before we go further , please make sure you have Virtualbox installed in your Ubuntu system.Please check my previous tutorial on how to install Virtualbox in Ubuntu .

Requirement

Kali Linux require
1.A minimum of 10 GB disk space for the Kali Linux install
2.For i386 and amd64 architectures, a minimum of 512MB RAM.



What we will do in this tutorial

1. Download Latest Kali Linux
2. Check Sha1sum (optional)
3. Create Kali Linux Virtual Machine on Virtualbox
4. Configure Kali Linux Virtual Machine additional  settings
5. Install Kali Linux on Hard Drive
6. Reboot and login to Kali Linux Virtual Machine




Steps


1.Download kali linux from their website.

 1.1) Choose the right software version compatible with your system by checking in   the terminal

shark_attack@Positive-Space:~$  file /sbin/init


Checking System CPU bit

Choose the right file to download

1.2)Choose either to download using torrent or direct.


Saving Torrent

Downloading Torrent

Downloading in progress


2. Check Sha1sum (optional)  once the download completed.This step is to make sure the downloaded file  is not corrupted

2.1) Open the terminal and navigate to the downloaded file location.

2.2) Run command to check sha1sum  and use Sha1sum given in Kali Linux download page. In my case, my Sha1sum is "6edfe99df28747d828ef6de17ded66fed6659a86"

shark_attack@Positive-Space:~/Downloads/kali-linux-1.0.8-i386$  sha1sum kali-linux-1.0.8-i386 | grep 6edfe99df28747d828ef6de17ded66fed6659a8  


Copy the Sha1sum from website

2.3)  Check the file  on your system terminal .


Sha1sum checking



3. Create Kali Linux Virtual Machine on Virtualbox

3.1) Open Oracle Virtualbox Manager from 'Dash Home'


Search Ora

3.2)Click 'New' to add new virtual system

Adding new Virtual system
3.3)Give your Virtual machine 'Name ,Type and Version > Next'

Name,Type,Version


3.4)Allocate memory size for your virtual system. I'm using 1024MB for my Kali Linux. The RAM amount depends on what  you plan to do with your Virtualbox, how many client you want to run concurrently on Ubuntu host and don't forget Ubuntu host also needs RAM to work . Then proceed with 'Next' button .

RAM size


3.5) Click 'Create virtual hard drive' > 'Create' .  Kali Linux require at least 10 GB of hard drive size.



3.6) Choose VDI to install Kali Linux on your hard drive. For further reading on virtual storage, please visit here.
Choose VDI


3.7)Choose  'Dynamically allocated' for more flexible storage system. And click 'Next' .For further reading, please visit here.

Dynamically allocated

3.7)Choose file location and size. I Choose 20GB for my Kali Linux  virtual system . Then click 'Create'

Adding disk  size





4. Configure Kali Linux Virtual Machine additional  settings 


4.1) Click 'Settings'

Settings


4.2)Go to System  on the left hand panel and click 'Processor'




4.3)Tick  'Enable PAE/NX' function . PAE is short form of  'Physical Address Extension'. his setting will  enables 32-bit processors to access more than 4 GB of physical memory. If your client is running on 32 bit processor This is made possible by adding 4 bit to memory addresses. if a system is running on 32 bit x86, it will have 36 bit and can addressed up to 64 GB of RAM.

NX means  'No Execute' . This means your CPU know how to prevent memory safer by prevent programs from executing code in that part. 


You can check your processor details in  BIOS .


Enable PAE/NX

4,4) 'Start'  Kali Linux virtual machine .

Click Start

5. Install Kali Linux on Hard Drive

5.1)Choose  Kali Linux image in location where you download it. Then click 'Start'

Choose Kali Linux ISO


Click Start

5.2) Choose 'Install'

Install

5.3) Choose 'Language'


Language

5.4)Choose 'Country'



5.5) Configure the 'Keyboard'



5.6)Configure 'Hostname' . Key in any name you want for your Kali host and 'Continue'



5.7)Configure network 'domain' . you can skip if you want. Then 'Continue'
Network domain

5.8)Configure root password for Kali Linux.Make sure you remember your root password .Press 'Continue' for root password verification
root password

verify root password
5.9)Configuring the clock

Choose your state

5.10)Choose 'Guided-use entire disk' . For more information on other selection, please visit here.



5.11)Choose disk to partition.




5.12)Choose 'All files in one partition (recomended for new users)'






5.13) Choose 'Finish partitioning and write changes to disk'




Confirm and finished

5.14) Choose 'Yes' .The system will then begin to install and will prompt if needs any feedback from the user.



5.15) You will be prompted with using Network mirror ,I Choose 'No' in this steps.It will continue to install.

(p/s: I think I should choose 'YES' on this step as I face some linux headers issue when creating kali linux guest addition .I will share it in my next post .Please let me know how you go on this step)

Network mirror

5.16)The system will then ask to install GRUB boot loader to master boot record. Choose 'Yes' . It will complete the installation and will then request for system reboot.Choose 'Continue'



System reboot

6. Reboot and login to Kali Linux Virtual Machine

6.1) Choose the top  'Debian GNU/LINUX , with 3.14-kali-686-pae'



6.2)Click 'Other' and key in 'root'  as username. The system will then request for password .
Click Other

Username = root

Enter Your password


6.3)It will redirect you to Kali Linux in your virtual machine


Welcome Kali Linux


,



How to install latest Virtualbox in Ubuntu




In this post I'm going to share how to install Virtualbox in Ubuntu system .

What we will do in this tutorial

1)Download latest Virtualbox software from Virtualbox website
2)Install Virtualbox through Ubuntu Software centre
3)Configure Virtualbox users in Ubuntu System
4)Download Virtualbox extension pack from Virtualboc website
5)Install Virtualbox extension pack

Steps

1) Download latest Virtualbox software from Virtualbox website. Or you can Google 'virtualbox' and click  'Downloads> virtualbox for linux host'

Virtualbox 4.3.14 for Linux hosts

  1.1) Choose the right software version compatible with your system by checking in   the terminal

shark_attack@Positive-Space:~$  file /sbin/init



32 bit/64 bit



 1.2)Download Virtualbox software compatible with your System

Download Virtualbox software

Save it

2)Install Virtualbox through Ubuntu Software centre

 2.1) Click the  downloaded file. It will direct to Ubuntu Software Centre to complete the installation
Click the downloaded file

Latest Virtualbox version (at the time this post is written)

Authenticate to complete the installation

3)Configure Virtualbox user in Ubuntu System

3.1)Search  'Users and Groups' in Ubuntu  Dash home

Users and Groups

3.2) Click  'Manage Group'


Manage Group

3.3) Click 'vboxusers' in the list and click 'Properties'

vboxusers

3.4) Tick the users you want to allow using Virtualbox 

Allowed Users

Authentication required


 4)Download Virtualbox extension pack from Virtualbox  website.


Download Virtualbox Extension Pack

Save file in your system


 5)Install Virtualbox Extension Pack


5.1) Click the Extension Pack downloaded file

Complete Extension Pack Downloaded file


Install file
 5.2) Scroll down and click 'I agree'

Scroll & Agree

Authentication required

Installation in progress

Installation complete

Virtualbox  and Extension pack is successfully installed on your system .!




Monday, June 2, 2014

How to resize image size on ubuntu (easy way)


   In this post I'm going to share how to resize image size in Ubuntu.This is an easy way out to those who are looking to resize their image file in a simplistic manner .

Steps


1) Download from repo

shark_attack@Positive-Space:~$  sudo apt-get install nautilus-image-converter


Download from repo

 2) Go to the image that need to be converted, right click > Resize images

Resize images

3) Click the desired file size .By default the new file name will be using the existing file name with additional ".resized" at the back of the new file . Then click "Resize" .Your system will resize the file

choose file size

4)Check the new resize file properties by right clicking the new "filename.resized" file.

New file size






Thursday, May 29, 2014

How to resolve factory girl 4.2.0 conflict with ruby 1.9.2 during metasploit framework installation





  In this post,I'm going to share one of the problem that I face during the installation of Metasploit framework from Github on my system .You can check my full installation post here .

Before I go into details. please find below program term and short explanation that is used associated with Ruby.Please click the link for more information.

bundler =Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed .Please check it out here


gems=RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries (in a self-contained format called a "gem"), a tool designed to easily manage the installation of gems, and a server for distributing them. Please refer here for details



rbenv = rbenv is  a program to pick a Ruby version for your application and guarantee that your development environment matches production .Please refer here for more information .


This problem happen when I want to install the required gems and related version to make it work on my system


factory girl (4.2.0) error
--------------------------------
shark_attack@Positive-Space:/opt/metasploit-framework$ sudo bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Using rake (10.1.0)
Using i18n (0.6.5)
Using multi_json (1.0.4)
Using activesupport (3.2.14)
Using builder (3.0.4)
Using activemodel (3.2.14)
Using arel (3.0.2)
Using tzinfo (0.3.37)
Using activerecord (3.2.14)
Using bcrypt-ruby (3.1.2)
Using database_cleaner (1.1.1)
Using diff-lcs (1.2.4)
Gem::InstallError: factory_girl requires Ruby version >= 1.9.2.
An error occurred while installing factory_girl (4.2.0), and Bundler cannot continue.
Make sure that `gem install factory_girl -v '4.2.0'` succeeds before bundling.
shark_attack@Positive-Space:/opt/metasploit-framework$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]
shark_attack@Positive-Space:/opt/metasploit-framework$ gem -v
1.8.11
shark_attack@Positive-Space:/opt/metasploit-framework$ clear


  factory girl require ruby version 1.9.2 while on my system I use ruby version 1.9.3 . After a quick run through the online manual, I found out that the need to rehash  ruby to make it work with my system. Below are steps on how I do it.


Steps summary



1)Install gem bundler
2)Install rbenv

3)rehash ruby
4)bundle install


Steps


1)Install gem bundler.


shark_attack@Positive-Space:/opt/metasploit-framework$ sudo bundle install 
shark_attack@Positive-Space:/opt/metasploit-framework$ sudo gem install bundler
Fetching: bundler-1.5.3.gem (100%)
Successfully installed bundler-1.5.3
1 gem installed
Installing ri documentation for bundler-1.5.3...
Installing RDoc documentation for bundler-1.5.3...
shark_attack@Positive-Space:/opt/metasploit-framework$ rbenv rehash
The program 'rbenv' is currently not installed.  To run 'rbenv' please ask your administrator to install the package 'rbenv'


2)Install rbenv

shark_attack@Positive-Space:/opt/metasploit-framework$

shark_attack@Positive-Space:/opt/metasploit-framework$ sudo apt-get install rbenv
Reading package lists... Done
Building dependency tree   
Reading state information... Done
The following NEW packages will be installed:
  rbenv
0 to upgrade, 1 to newly install, 0 to remove and 2 not to upgrade.
Need to get 15.3 kB of archives.
After this operation, 79.9 kB of additional disk space will be used.
Get:1 http://au.archive.ubuntu.com/ubuntu/ precise/universe rbenv all 0.1.2+git20100922-1 [15.3 kB]
Fetched 15.3 kB in 0s (22.7 kB/s)
Selecting previously unselected package rbenv.
(Reading database ... 275787 files and directories currently installed.)
Unpacking rbenv (from .../rbenv_0.1.2+git20100922-1_all.deb) ...
Processing triggers for man-db ...
Setting up rbenv (0.1.2+git20100922-1) ...
shark_attack@Positive-Space:/opt/metasploit-framework$ clear


3)rehash ruby

shark_attack@Positive-Space:/opt/metasploit-framework$rbenv rehash


4)Run bundle install

shark_attack@Positive-Space:/opt/metasploit-framework$
shark_attack@Positive-Space:/opt/metasploit-framework$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
/var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:295: warning: Insecure world writable dir /home/shark_attack in PATH, mode 040766
Installing rake (10.1.0)
Installing i18n (0.6.5)
Installing multi_json (1.0.4)
Installing activesupport (3.2.14)
Installing builder (3.0.4)
Installing activemodel (3.2.14)
Installing arel (3.0.2)
Installing tzinfo (0.3.37)
Installing activerecord (3.2.14)
Installing bcrypt-ruby (3.1.2)
Installing database_cleaner (1.1.1)
Installing diff-lcs (1.2.4)
Installing factory_girl (4.2.0)
Installing fivemat (1.2.1)
Installing json (1.8.0)
Installing pg (0.16.0)
Installing metasploit_data_models (0.16.9)
Installing mini_portile (0.5.1)
Installing msgpack (0.5.5)
Installing network_interface (0.0.1)
Installing nokogiri (1.6.0)
Installing packetfu (1.1.9)
Installing pcaprub (0.11.3)
Installing redcarpet (3.0.0)
Installing robots (0.10.1)
Installing rspec-core (2.14.5)
Installing rspec-expectations (2.14.2)
Installing rspec-mocks (2.14.3)
Installing rspec (2.14.1)
Installing shoulda-matchers (2.3.0)
Installing simplecov-html (0.5.3)
Installing simplecov (0.5.4)
Installing timecop (0.6.3)
Installing yard (0.8.7)
Using bundler (1.5.3)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
shark_attack@Positive-Space:/opt/metasploit-framework$ clear






Wednesday, May 28, 2014

How to install metasploit framework from Github on Ubuntu



   In this post, I'm going to share How to install metasploit framework from Github on Ubuntu 12.04.Some reference of installing metasploit,I got from here. I have added some steps which I think will make it more easier than the published post.


 The installation process doesn't go well for me as my system have some compatibility issue as you will see in the video .I will do a separate post on it. Below are steps taken to do the installation


Steps summary

1) Update system
2) Install metasploit dependencies
3) (OPTIONAL) Install nmap
4) Download metasploit framework from Github
5) Install gems and version required by metasploit
6) Run metasploit framework
7) Create and connect the database with metasploit
8) Test and optimize metasploit search function
9) Add the  metasploit folder to your system environment


Steps


1)Update and upgrade system

1.1)update system
shark_attack@Positive-Space:~$sudo apt-get update


update system
 1.2)upgrade system
shark_attack@Positive-Space:~$sudo apt-get update

upgrade system


 2)Install  metasploit required dependencies

2.1)Install Ruby 1.9.3 and other dependencies

shark_attack@Positive-Space:~$sudo apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev openjdk-7-jre subversion git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev vncviewer libyaml-dev ruby1.9.3

Install Ruby dependencies


 2.2) Install Ruby libraries that metasploit depend on

 shark_attack@Positive-Space:~$sudo gem install wirble sqlite3 bundler


Install Ruby libraries that metasploit depend

 3)(OPTIONAL) Install nmap
Install NMAP if you still don't use one on your system

 shark_attack@Positive-Space:~$sudo apt-get install nmap


Install nmap
4)Download metasploit framework from Github to your system


 shark_attack@Positive-Space:~$cd /opt
 shark_attack@Positive-Space:~$git clone https://github.com/rapid7/metasploit-framework.git


Dowloading metasploit framework to /opt

 5) Install gems and version required by metasploit.
After finish downloading, go to metasploit folder

shark_attack@Positive-Space:~$cd /opt/metasploit-framework
shark_attack@Positive-Space:/opt/metasploit-framework$sudo bundle install

go to metasploit folder

install bundle
 NOTE: My system have problem installing the gems . It trigger  "girl friday" error as shown in the video. Please check my next post on how I resolve it .I will not share details how to do it in this post .You can see it in this video though :-)

 6)Run metasploit framework .
It might take few minutes for first time loading .

 shark_attack@Positive-Space:~$./msfconsole


run metasploit


Metasploit
 7)Create and connect the database with metasploit

7.1)Create user and postgres database . Make sure you remember what you type in when you create the user and database information.


shark_attack@Positive-Space:~$su -s
root@Positive-Space:~$su postgres
postgres@Positive-Space:/home/shark_attack$ createuser msf -P -S -R -D
postgres@Positive-Space:/home/shark_attack$ createdb -0 msf msf


creating user and db information


7.2)Connect database . msf4 folder will be in your home folder after you run metasploit for the first time.
Go to ./msf4 folder

shark_attack@Positive-Space:~$cd .msf4 
shark_attack@Positive-Space:~/.msf4$


.msf4 folder


7.3)Create a file name "database.yml" and key in the  detail informations that you have created before .Make sure all the details are correct including the password.

shark_attack@Positive-Space:~/.msf4$nano database.yml


 key in your database and user detail as how you configured .




adapter: postgresql

database: msf

password: shark_attack

username: msf

pool: 75

host: 127.0.0.1
port: 5432

timeout: 5







type the db and user info
save it

database.yml in msf4 folder



8)Test  and optimize metasploit search function


8.1)run metasploit framework  from your console and check the database status once it finish load .Remember to run as sudo . It might take few minutes to load the first time

shark_attack@Positive-Space:/opt/metasploit-framework$ sudo ./msfconsole



msf>db_status


checking database status


8.2) This step is just something that I notice doesn't work on my system in which ,whenever I  try to use the search  on metasploit, it will give an error  "Database not connected or cache not built,using slow search" .  It took few minutes to search anything.To resolve this issue, I rebuild the db cache by typing below command .

msf>db_rebuild_cache

Database not connected or cache not built


rebuilding the cache



That's it for today. If you are looking on how to install Kali Linux in Ubuntu ,please visit here.