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.
Spawning <strong>Cortana</strong> Instances<br />
Many <strong>Cortana</strong> events are local. This means, <strong>Cortana</strong> fires event listeners in the script that<br />
generated the event originally. This is important. If five scripts are loaded, it would cause<br />
chaos if each script had to deconflict console events from the other scripts. <strong>Cortana</strong> is very<br />
good at maintaining isolation.<br />
If you're writing a large script, you will start to the feel the need for event isolation in your<br />
local script. It's possible to achieve this by spawning a new <strong>Cortana</strong> instance from your<br />
script. To do this, use the &spawn function. This function accepts another function as an<br />
argument and several named arguments to install into the global scope of the new <strong>Cortana</strong><br />
instance.<br />
Spawned <strong>Cortana</strong> instances are treated like any other script co-‐hosted with your script.<br />
They must call the &quit function to free their resources and stop receiving events. They<br />
may respond to events. And they are isolated from other scripts (including their parent).<br />
5. Controlling <strong>Armitage</strong><br />
Keyboard Shortcuts<br />
When run from inside of <strong>Armitage</strong>, <strong>Cortana</strong> scripts have several opportunities to extend<br />
<strong>Armitage</strong> and take advantage of its conventions.<br />
One such opportunity is keyboard shortcuts. Scripts may bind to nearly any key<br />
combination they like. Use the bind keyword to bind a keyboard shortcut. This example<br />
shows Hello World! in a dialog box when Ctrl and H are pressed together.<br />
bind Ctrl+H {<br />
show_message("Hello World!");<br />
}<br />
Keyboard shortcuts may be any ASCII characters or a special key. Shortcuts may have one<br />
or more modifiers applied to them. A modifier is one of: Ctrl, Shift, Alt, or Meta. Scripts may<br />
specify the modifier+key.<br />
Appendix D lists some of the keys you may bind to.<br />
Popup Menus<br />
<strong>Cortana</strong> scripts may also extend <strong>Armitage</strong> with new menus. <strong>Cortana</strong> adds menus by<br />
defining a popup for a pre-‐defined hook. Appendix E lists all of the menu hooks available.<br />
The following example adds a Browser Autopwn menu item to the Attacks menu at the top<br />
of <strong>Armitage</strong>.<br />
popup attacks {<br />
item "&Browser Autopwn" {<br />
launch_module("Browser Autopwn", "auxiliary",<br />
"auxiliary/server/browser_autopwn", %());<br />
25