Using the BeEF autorule engine
We have now seen some of the power of BeEF. Wouldn't it be great if we could automate some of that power? With the BeEF autorule engine, we can do just that. As an example, it would be great to create a persistent connection automatically with our victim as soon as the browser is hooked. This recipe looks into this and some other ideas.
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…
In order to automate...