Working with interfaces

Cortana also provides a flexible approach while working with interfaces. Cortana provides options and functions to create shortcuts, tables, switching tabs, and various other operations. Suppose we want to add custom functionality, such as when we press the F1 key from the keyboard; Cortana displays the UID of the target host. Let's see an example of a script that will enable us to achieve this feature:

bind F1 { 
$sid ="3"; 
spawn(&gu, \$sid);   
}  
sub gu{   
m_cmd($sid,"getuid"); 
on meterpreter_getuid { 
show_message( " $3 "); 
} 
} 

The previous script will add a shortcut key, F1, that will display the UID of the target system when pressed. The bind keyword in the script denotes binding of the functionality with the F1 key. ...

Get Mastering Metasploit - Third Edition 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.