Getting Armitage Running on Kali with the Latest Free Metasploit Framework

Getting Armitage Running on Kali with the Latest Free Metasploit Framework

You're not going to be able to run the following command to start msf5 (these are legacy to mfs4 and below)

 service metasploit start

 -or-

 service metasploit stop

Because the new metaspoit-framework doesn't work that way :(

 Follow these steps. You might be able to script this at some point.

1. Check to see if postgreSQL is installed:

 service postgresql start

2.  If postgresql isn't installed, do this:

 sudo apt-get install postgresql

3. Then try this* again:

 service postgresql start

 *postgresql will not start on boot on Kali for arm64

 4. Install the 'new' metasploit framework. From https://github.com/rapid7/metasploit-framework/wiki/Nightly-Installers:

curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \

 chmod 755 msfinstall && \

 ./msfinstall

 5. Create the msf database, database.yml. 

msfdb init

 (There's also a msfdb reinit command and a msfdb delete command if necessary, like something gets corrupted in the database.yml file and it needs to be recreated or deleted and created again.) 

6. The path is MSF_DATABASE_CONFIG=/usr/share/metasploit-framework/config/database.yml, which will come in handy later. You will need to add the path to the ~/.bashrc end of file using nano and reboot. The line to add (I'll go over this again later) is:

export MSF_DATABASE_CONFIG=/usr/share/metasploit-framework/config/database.yml

 You can check to see if the path is in memory with the following command:

echo $MSF_DATABASE_CONFIG

7. Run msfconsole for the first time from the GNOME GUI, not over SSH, and if you get database errors, like unable to find a database at a listening port, which I have encountered every time I have gone through this process, follow these instructions. 

 Sample errors:

 [-] * WARNING: No database support: could not connect to server: Connection refused        Is the server running on host "localhost" (::1) and accepting        TCP/IP connections on port 5432? could not connect to server: Connection refused       

 * WARNING: No database support: FATAL: password authentication failed for user "msf" FATAL: password authentication failed for user "msf"

Solving this issue was a bit of trial, error, and alchemy for me, so I don't know which of these commands solved my msfconsole's ability to connect to the postgresql database. 

 A handy command to see if postgresql is listening on 5432

ss -ant

 You should look for and see localhost listening on port 5432:

 State Recv-Q Send-Q   Local Address:Port    Peer Address:Port Process

LISTEN 0     128            0.0.0.0:22           0.0.0.0:*

LISTEN 0     128          127.0.0.1:5432         0.0.0.0:*

ESTAB 0     64       192.168.86.74:22     192.168.86.78:50391

LISTEN 0     128               [::]:22              [::]:*

LISTEN 0     128              [::1]:5432            [::]:*

 Problem solved.

All I had to do was re-generate the snakeoil certificates and it worked.

I googled and found a solution at: https://gist.github.com/yyuu/4335041

The solution used, in my case, was just the first 2 lines of the code below:

sudo apt-get install ssl-certsudo

make-ssl-cert generate-default-snakeoil

sudo usermod --append --groups ssl-cert yyuu

ls -l /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/private/ssl-cert-snakeoil.key

From <https://forums.kali.org/showthread.php?44664-Metasploit-framework-errors-quot-could-not-connect-to-server-quot>

What is referenced above is snakeoil.sh which is this:

sudo apt-get install ssl-cert

sudo make-ssl-cert generate-default-snakeoil

sudo usermod --append --groups ssl-cert yyuu

ls -l /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/private/ssl-cert-snakeoil.key

 THEN

service postgresql restart

 8. Make sure msfconsole successfully connects to the postgresql database before rebooting.

 msfconsole

 <msf unicorn or other graphic>

   =[ metasploit v5.0.83-dev-                       ]

+ -- --=[ 1990 exploits - 1088 auxiliary - 340 post     ]

+ -- --=[ 560 payloads - 45 encoders - 10 nops          ]

+ -- --=[ 7 evasion                                     ]

 Metasploit tip: You can use help to view all available commands

 ^^^This is progress. You now have msfconsole connecting to postgresql without error. You must get here before installing armitage.

 9. Do an update

sudo apt-get update

 10. Reboot

sudo reboot

echo $MSF_DATABASE_CONFIG to make sure MSF_DATABASE_CONFIG=/usr/share/metasploit-framework/config/database.yml is in the PATH

 12. Install armitage

sudo apt-get install armitage

 13. Launch armitage in the Kali GNOME GUI. Open a terminal and type:

armitage

This time after a few banal questions, like how it should connect to the msf service and database, armitage should start.


 


Hamad Aljack

Graphic Designer & Medical Student

2y

i installed armitage but when i try to open it i get "could not connect to database."

Cheikh Elghawth

Core network | Transmission | Security | DevSecOps

2y

thank you.

Ali ABDEL AZIZ

Assistant professor at Egypt-Japan University of Science and Technology (E-JUST)

2y

Thanks for sharing

Derek Grocke

Director / Founder at CyberOps Pty Ltd

3y

Thanks for sharing... Armitage breaking after a recent upgrade was anoyoing. It appeared to be a change in sudo privileges and the non "root" user. After setting the environment varable in ~/.bashrc fixed the issue... i.e. could not find the database when starting.

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics