Post-exploitation with Cortana is also simple. Cortana's built-in functions can make post-exploitation easy to tackle. Let's understand this using the following example script:
on heartbeat_15s { local('$sid'); foreach $sid (session_ids()) { if (-iswinmeterpreter $sid && -isready $sid) { m_cmd($sid, "getuid"); m_cmd($sid, "getpid"); on meterpreter_getuid { println(" $3 "); } on meterpreter_getpid { println(" $3 "); } } } }
In the preceding script, we used a function named heartbeat_15s. This function repeats its execution every 15 seconds. Hence, it is called a heart beat function.
The local function will denote that $sid is local to the current function. The next foreach statement is a loop that hops over ...