Integrating BeEF and Metasploit
We know now that BeEF is a great framework for exploiting the browser and that Metasploit is a great framework for exploiting a host. In this recipe, we'll see how we can use BeEF and Metasploit together. After hooking a browser with BeEF, we redirect the victim's browser to an executable that creates a reverse shell.
Getting ready
BeEF comes preinstalled on Kali Linux. In the examples provided, an instance of Metasploitable2 is used to demonstrate hooking a browser via XSS. For more information on how to set up systems in a local lab environment, refer to the Installing Metasploitable2 and Installing Windows Server recipes in Chapter 1, Getting Started. Additionally, this section will require a script to be written to the filesystem using a text editor, such as Vim or GNU nano. For more information on how to write scripts, refer to the Using text editors (Vim and GNU nano) recipe in Chapter 1, Getting Started.
How to do it…
Now let's learn how to integrate BeEF...