custom_meta() – automating Metasploit

Let's now take a look at the custom_meta method, which is responsible for handling all the Metasploit modules. It does this with the help of the Pexpect library.

As can be seen in section (1) in the following snippet, we are using pexpect.spawn to invoke "msfconsole -q", on our terminal. This will invoke a Metasploit process over a virtual terminal and would return the control of that process to the variable declared as a child:

Whenever we invoke msfconole, if there is no error, we would get a Metasploit prompt as msf>. This is what we are specifying in section (2), [.*>, .., ..] , as the 0th index. ...

Get Hands-On Penetration Testing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.