Thursday 14 June 2012

Setting up metasploit framework on any linux the easy way !!

In this post i will be guiding you through an easy method of setting up your exploitation framework and this tool is nothing else than the superior metasploit framework..

GUYS THIS TUTORIAL IS FOR LINUX OS, IF YOU WANT THE SAME FOR WINDOWS COMMENT, MESSAGE ME.

So lets start out,

tools required :: a linux os

its upto you which one you prefer, im using arch linux but you can use ubuntu. Its a newbie-friendly distro as compared to arch.
www.ubunut.com

Assuming that your os in installed, doesnt matter on disk or virtually and updated (if not do it, and if you dont kno how, check below).

This whole framework is dependent on ruby language,
so first of all we require to resolve the required dependencies.
------------------------------------------------------------------------------------------------------------------------------

apt-get update && apt-get upgrade
//this will do the update part

now the dependencies

$ sudo apt-get install ruby libopenssl-ruby libyaml-ruby libdl-ruby libiconv-ruby libreadline-ruby irb ri rubygems

this will install the necessay packages
-------------------------------------------------------------------------------------------------------------------------------


Now the method we will using to fetch metasploit for our system is using subversion.
to kno more about it.
http://subversion.apache.org/

So install this also


-----------------------------------------------------------------------------------------------------------------------------------
$ apt-get install subversion
-----------------------------------------------------------------------------------------------------------------------------------

And now some other deps also to build native extensions

------------------------------------------------------------------------------------------------------------------------------------
$ sudo apt-get install build-essential ruby-dev libpcap-dev
------------------------------------------------------------------------------------------------------------------------------------

Now the minor things are done now comes the important part

Subversion is a version control system, basically what it does is it synchorises your local folder with the remote folder being used as a developement base

The remote url we will be :: https://www.metasploit.com/svn/framework3/trunk/

this is from where subversion will fetch all the files

So first to check your subversion setup issue this command

-----------------------------------------------------------------------------------------------------------------------------------
$ svn ls https://www.metasploit.com/svn/framework3/trunk/

svn >> acronym for subversion this is used for commands
-----------------------------------------------------------------------------------------------------------------------------------

something like this should be visible, it will list down the remote folders and files


If you get something similar that means you are ready to go.

now, do
------------------------------------------------------------------------------------------------------------------------------------
$ svn checkout https://www.metasploit.com/svn/framework3/trunk/ msf
or
$ svn co https://www.metasploit.com/svn/framework3/trunk/ msf

both are same, co is for checkout same as svn for the whole
--------------------------------------------------------------------------------------------------------------------------------------
This will create a folder named msf with all the files in your current directory.

This a big download and takes few seconds to initiate so wait for it,

soon it will start and your screen will be filled with data transfer details


So now you are back with all the downloaded files.

if you now issue ls command you will surely
see all the files

This is it this your framework succesfully installed.

 UPDATE

Now to update it this command can be used, for that you have to come to this directory everytime, as subversion checks the current directory to recognize the point of last update

------------------------------------------------------------------------------------------------------------------------------------
$ svn update
------------------------------------------------------------------------------------------------------------------------------------
//As you have just installed it you wont be requiring any update but i would recommend you keep updating it in a day or two for latest exploits, me myself usually do it everyday, you can automate this also with crontab.

After each update there is a revision no. left to keep track like this

Now you can test your main tool, in this all of these msf* tools are extremely useful and if used in a combined manner can render a desired exploitation.



issue this command
------------------------------------------------------------------------------------------------------------------------------------
$ ./msfconsole
------------------------------------------------------------------------------------------------------------------------------------
if it loads up without any errors with ruby interpreter then you are good to go and it should look like this, and you will be welcomed with a msf> prompt







EXTENSIONS

Now comes the part for installing extensions, not a priority but it is required to enable raw sockets and wifi modules.


Raw sockets,
go to your dir where you installed msf and then into external and then

----------------------------------------------------------------------------------------------------------------------------------
$ cd /opt/metasploit3/msf3/external/pcaprub/

$ ruby extconf.rb
$ make && make install

----------------------------------------------------------------------------------------------------------------------------------

Wifi modules

-----------------------------------------------------------------------------------------------------------------------------------

# cd  /opt/metasploit3/msf3/external/ruby-lorcon2/
# svn co http://802.11ninja.net/svn/lorcon/trunk lorcon2
# cd lorcon2
# ./configure --prefix=/usr && make && make install
# cd ..
# ruby extconf.rb
# make && make install

-------------------------------------------------------------------------------------------------------------------------------------

And we are done so go on test out your new framework.

Thanks for reading and plz comment for any help

B-)



No comments:

Post a Comment