Cortana Tutorial - Armitage
Cortana Tutorial - Armitage
Cortana Tutorial - Armitage
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
prompt($console, "\Umeterpreter\U> ");<br />
To process input from this console, we use the tab_text_input event. When input occurs,<br />
this script appends it to the console and uses &m_cmd to send the command to the<br />
Meterpreter session.<br />
on tab_text_input {<br />
append($1, "\Umeterpreter\U> $3 $+ \n");<br />
m_cmd($sid, $3);<br />
}<br />
Now, when a meterpreter event fires, we append the output to the text console:<br />
on meterpreter {<br />
append($console, $3);<br />
}<br />
You may have noticed that this script does not take any steps to deconflict input or events it<br />
receives from those potentially fired by other scripts. In this example it's not necessary<br />
because we launched the &showMeterpreterShell function with &spawn. Spawned<br />
functions are treated like separate <strong>Cortana</strong> scripts (as if the user had loaded them<br />
separately). Spawned functions do not receive events from other scripts and their actions<br />
do not cause events to fire in other scripts.<br />
Because this is a spawned function, it must call &quit when it's done like any other script.<br />
By calling &quit, this spawned function will stop receiving events and <strong>Cortana</strong> will free any<br />
resources it holds.<br />
}<br />
on tab_close {<br />
quit();<br />
}<br />
Tables<br />
Besides text consoles, the other common way <strong>Armitage</strong> displays information is through a<br />
table. Use the &open_table_tab function to create a table tab. Here are its arguments:<br />
$table = open_table_tab("title", $arg, @cols, @rows, @buttons, "hook", multi?);<br />
The first argument to this function specifies the title of the tab. The second argument, $arg,<br />
is an argument that is propagated to events related to this table tab.<br />
The third argument, @cols, is a list of columns for the table. The fourth argument is an<br />
array of rows. Each row is a dictionary where each key corresponds to a column.<br />
The fifth argument, @buttons, specifies which buttons to display below the table. When a<br />
user clicks a button, <strong>Cortana</strong> will fire a tab_table_click event.<br />
33