07.01.2013 Views

Cortana Tutorial - Armitage

Cortana Tutorial - Armitage

Cortana Tutorial - Armitage

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

By default, the table tab is empty. This &refresh_vulns function will populate a table tab<br />

for us. It uses the &call function to call db.vulns through the Metasploit Remote API. This<br />

function returns an array of dictionaries that contain information about each vulnerability.<br />

Conveniently, the keys of the returned dictionaries match the columns of the table tab. We<br />

use &table_set to set the contents of the table tab.<br />

sub refresh_vulns {<br />

local('$vulns');<br />

$vulns = call("db.vulns")['vulns'];<br />

table_set($1, $vulns);<br />

}<br />

Note: db.vulns is an undocumented function in the Metasploit Remote API.<br />

Fortunately, the <strong>Armitage</strong> team server emulates all db.* calls for us. Even if the<br />

Metasploit Remote API db.* calls disappear, they will continue to work through<br />

<strong>Armitage</strong>.<br />

By now, our Vulnerabilities tab is populated with all of the vulnerabilities in the database.<br />

Next, let's make the Refresh button work. Here's the table_tab_click event listener:<br />

on tab_table_click {<br />

if ($3 eq "Refresh") {<br />

refresh_vulns($1);<br />

}<br />

}<br />

Finally, let's define a popup menu. This menu item copies the contents of the refs column to<br />

the clipboard:<br />

popup vuln_hook {<br />

item "Copy References" {<br />

clipboard_set(join(", ", table_selected_single($1, "refs")));<br />

}<br />

}<br />

Image Viewer<br />

<strong>Cortana</strong> also provides a generic image viewer. This is the same image viewer used for<br />

displaying screenshots and webcam shots.<br />

To open an image tab, use:<br />

$tab = open_image_tab("title", $arg, @buttons)<br />

The first argument is the title of the tab. The second argument is propagated to all events<br />

triggered by this tab. The third argument is an array of buttons that <strong>Cortana</strong> should display<br />

below the image.<br />

To set an image for an image tab, use the &set_image function:<br />

set_image($tab, "/path/to/file.jpg");<br />

35

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!