# Msfconsole

### Installing Msfconsole

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

or we can use apt install method to download it on kali linux

```
sudo apt update
sudo apt install metasploit-framework
```

#### Managing msfdb database

```
sudo /etc/init.d/postgresql start 
sudo systemctl status postgresql
```

After starting the postgres sql we will setup the msf database using following commands

```
db_status
```

once the connection to postgre is applied , You can use any of the following commands to manage the database:

* **msfdb init -** It initializes the database on msfconsole
* **msfdb reinit** – Deletes and re-initializes the database
* **msfdb delete** – Deletes the database
* **msfdb start** – Starts the database
* **msfdb stop** – Stops the database
* **msfdb status** – Shows the database status
* **msfdb run** – Starts the database and runs msfconsole

These commands will efficently manage the console database and then we can enable history of queries & results on the msfconsole.

***

## Example modules of MSF Console

#### Enumeration & Scanning Modules :&#x20;

```
SYN SCAN : auxiliary/scanner/portscan/syn
TCP SCAN : auxiliary/scanner/portscan/tcp
```

#### Version Scan :&#x20;

```
SMB Version : auxiliary/scanner/smb/smb_version
```

#### Exploitation & Reverse Shell :&#x20;

```
use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
```
