- Metasploit kali linux туториал
- Quick way
- MSFDB
- Start the Kali PostgreSQL Service
- Initialize the Metasploit PostgreSQL Database
- Launch msfconsole in Kali
- MetaSploit tutorial for beginners
- Metasploit history
- Using Metasploit
- Start the database service
- Getting help in metasploit
- Identify a remote host – run an nmap scan inside metasploit
- MetaSploit tutorial for beginners – Pick a vulnerability and use an exploit
- MetaSploit tutorial for beginners – Configure the exploit
- Execute the exploit against the remote host
- Thats the very basics of using metasploit covered! I hope you enjoyed my basic metasploit tutorial for beginners.
- You Might Also Like
- Blackarch on the chuwi hi10pro – install and config
- ECHELON aka PRISM
Metasploit kali linux туториал
In keeping with the Kali Linux Network Services Policy, no network services, including database services, run on boot as a default, so there are a couple of steps that need to be taken in order to get Metasploit up and running with database support.
Quick way
You an have everything up and running, by starting the PostgreSQL service and set it up just by doing:
[email protected]:~$ sudo msfdb init [+] Starting database [+] Creating database user 'msf' [+] Creating databases 'msf' [+] Creating databases 'msf_test' [+] Creating configuration file '/usr/share/metasploit-framework/config/database.yml' [+] Creating initial database schema [email protected]:~$
You can even take it one step further by doing sudo msfdb run and it will do the same as the above, as well as start msfconsole afterwards
MSFDB
To help interactive with various parts of the Metasploit configuration there is msfdb :
[email protected]:~$ sudo msfdb Manage the metasploit framework database msfdb init # start and initialize the database msfdb reinit # delete and reinitialize the database msfdb delete # delete database and stop using it msfdb start # start the database msfdb stop # stop the database msfdb status # check service status msfdb run # start the database and run msfconsole [email protected]:~$
Please note: this is a different version of msfdb that is shipped with the default project
Start the Kali PostgreSQL Service
Start the Kali PostgreSQL Service
Metasploit uses PostgreSQL as its database so it needs to be launched first:
[email protected]:~$ sudo msfdb start [+] Starting database [email protected]:~$
You can verify that PostgreSQL is running by checking the output of ss -ant and making sure that port 5432 is listening, or using sudo msfdb status :
[email protected]:~$ sudo msfdb status ● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled) Active: active (exited) since Sun 2021-02-07 02:15:42 EST; 4s ago Process: 157089 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 157089 (code=exited, status=0/SUCCESS) Feb 07 02:15:42 kali systemd[1]: Starting PostgreSQL RDBMS. Feb 07 02:15:42 kali systemd[1]: Finished PostgreSQL RDBMS. COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME postgres 157071 postgres 5u IPv6 647182 0t0 TCP localhost:5432 (LISTEN) postgres 157071 postgres 6u IPv4 647183 0t0 TCP localhost:5432 (LISTEN) UID PID PPID C STIME TTY STAT TIME CMD postgres 157071 1 1 02:15 ? Ss 0:00 /usr/lib/postgresql/13/bin/postgres -D /var/lib/postgresql/13/main -c config_file=/etc/postgresql/13/main/postgresql.con [i] No configuration file found [email protected]:~$
Initialize the Metasploit PostgreSQL Database
With PostgreSQL up and running, we next need to create and initialize the msf database:
[email protected]:~$ sudo msfdb init [i] Database already started [+] Creating database user 'msf' [+] Creating databases 'msf' [+] Creating databases 'msf_test' [+] Creating configuration file '/usr/share/metasploit-framework/config/database.yml' [+] Creating initial database schema [email protected]:~$
Launch msfconsole in Kali
Now that the PostgreSQL service is up and running and the database is initialized, you can launch msfconsole and verify database connectivity with the db_status command as shown below:
[email protected]:~$ msfconsole -q msf6 > msf6 > db_status [*] Connected to msf. Connection type: postgresql. msf6 >
Updated on: 2023-Mar-06
Author: g0tmi1k
MetaSploit tutorial for beginners
This (updated for 2021) MetaSploit tutorial for beginners is meant to be a starting guide on how to use MetaSploit if you have never used it before. It assumes that you already have MetaSploit installed and that it works, or that you are running Kali / other pen testing distro of linux (eg Parrot or BlackArch).
Metasploit history
Metasploit was created by H. D. Moore in 2003 as a portable network tool using Perl.
Metasploit 3.0 began to include fuzzing tools, used to discover software vulnerabilities, rather than just exploits for known bugs. This avenue can be seen with the integration of the lorcon wireless (802.11) toolset into Metasploit 3.0 in November 2006.
By 2007, the Metasploit Framework had been completely rewritten in ruby.
On October 21, 2009, the Metasploit Project announced that it had been acquired by Rapid7, a security company that provides unified vulnerability management solutions.
Metasploit 4.0 was released in August 2011
Metasploit Framework is opensource and you can view their code repo here: https://github.com/rapid7/metasploit-framework
Using Metasploit
The basic concept you need to use in order to know how to use MetaSploit is pretty easy when you have used the tool a few times and is as follows:
– Run msfconsole in your terminal
– Identify a remote host and add to the metasploit database
– Identify a vulnerability in the remote host that you wish to exploit
– Configure the payload to exploit the vulnerability in the remote host
– Execute the payload against the remote host
Once you have practiced and mastered this pattern, you can perform most of the tasks within Metasploit. As this is a MetaSploit tutorial for beginners, I’ll walk you through the steps you need to know to scan your first machine.
If you enjoy this tutorial, please check out my metasploit tutorials below
Start the database service
In your favourite Kali Linux Terminal (I recommend terminator), run the following command to start up a database server on your machine. This database is used to store all your results (so that you can come back to them later on, or share the database with others if working on a team)
If this is the first time you are running metasploit, then you will need to run the following command to create a database schema
You can now start metasploit using the msfconsole command from the terminal
Or using the kali linux menu system you will find it under “Exploitation tools > metasploit framework”
This is msfconsole. Msfconsole is the main command line interface to MetaSploit. There are other interfaces available – GUI interfaces (armitage), and a web interface too (websploit). With msfconsole you can launch exploits, create listeners, configure payloads etc.
Getting help in metasploit
MetaSploit has lots of great documentation built in. You can access this documentation if you type help to get a basic list of commands.
help show will give you the help section for the show command. You can then pass additional queries, such as show exploits
help search will give you the help section for the search command
To show a list of all available port scanners:
More examples of port-scanning remote machines and saving the output into the metasploit database are here
There is also a way to search within msfconsole for various exploits:
See metasploit unleashed for more examples of the search command
Identify a remote host – run an nmap scan inside metasploit
You can now run an nmap scan from inside msfconsole and save the output into the MetaSploit database.
To add these hosts to your list of remote targets
MetaSploit tutorial for beginners – Pick a vulnerability and use an exploit
Once you have performed an operating system fingerprint (or you have identified the application running on the remote host, eg by imporing nessus results into metasploit) and know what your remote hosts operating system is (using nmap, lynix, maltego, wp-scan, etc) you can pick an exploit to test. rapid7 have an easy way to find exploits. There is also a way to search within msfconsole for various exploits:
See metasploit unleashed for more examples of the search command
Once you have found a suitable exploit to use against the vulnerability in the remote host, issue the following command into msfconsole:
eg: use exploit/unix/webapp/php_wordpress_total_cache
From this point on, the available options change based on the exploit you are using, but you can get a list of the available options with:
For a list of the available targets:
MetaSploit tutorial for beginners – Configure the exploit
In MetaSploit each exploit has a set of options to configure for your remote host:
This gives a list. You need to set the options with ‘yes’ next to them in the ‘required’ column.
If you issue the ‘hosts -R’ command then you will see that the remote hosts parameters are already filled in for you.
Execute the exploit against the remote host
If metasploit is successful in exploiting the vulnerability, you will know – most likely it will pop a shell for you. If you don’t get a shell, then your exploit may not have worked – you may have to try a different exploit for the same vulnerability, or you may have to gain better information on your targets – perhaps you wrongly identified the version of the service.
Thats the very basics of using metasploit covered! I hope you enjoyed my basic metasploit tutorial for beginners.
If you enjoy this tutorial, please check out my metasploit tutorials below
You Might Also Like
Blackarch on the chuwi hi10pro – install and config
September 2, 2017
ECHELON aka PRISM
August 30, 2013