<commit_before>import msf.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import javax.swing.*;
import javax.imageio.*;

sub host_selected_items {
	local('$sid $session $i $s $h $o');

	host_attack_items($1, $2);

	if ($2[0] in %hosts && 'sessions' in %hosts[$2[0]]) {
		foreach $sid => $session (%hosts[$2[0]]['sessions']) {
			if ($session["type"] eq "meterpreter") {
				$i = menu($1, "Meterpreter $sid", $sid);
				showMeterpreterMenu($i, \$session, \$sid);
			}
			else if ($session["type"] eq "shell") {
				$i = menu($1, "Shell $sid", $sid);
				showShellMenu($i, \$session, \$sid);
			}
		}
	}

	item($1, "Services", 'v', lambda({ createServiceBrowser($hosts) }, $hosts => $2));
	item($1, "Scan", 'c', lambda({ launch_msf_scans(join(", ", $hosts)); }, $hosts => $2));

	separator($1);

	$h = menu($1, "Host", 'H');

		$o = menu($h, "Operating System", 'O');
		item($o, "Cisco IOS", 'C', setHostValueFunction($2, "os_name", "Cisco IOS"));
		item($o, "FreeBSD", 'F', setHostValueFunction($2, "os_name", "FreeBSD"));
		item($o, "Linux", 'L', setHostValueFunction($2, "os_name", "Linux"));
		item($o, "NetBSD", 'N', setHostValueFunction($2, "os_name", "NetBSD"));
		item($o, "Mac OS X", 'M', setHostValueFunction($2, "os_name", "Apple Mac OS X"));
		item($o, "OpenBSD", 'O', setHostValueFunction($2, "os_name", "OpenBSD"));
		item($o, "Printer", 'P', setHostValueFunction($2, "os_name", "Printer"));
		item($o, "Solaris", 'S', setHostValueFunction($2, "os_name", "Solaris"));
		item($o, "Unknown", 'U', setHostValueFunction($2, "os_name", ""));
		$i = menu($o, "Windows", 'W');
			item($i, '1. 95/98/2000', '1', setHostValueFunction($2, "os_name", "Micosoft Windows", "os_flavor", "2000"));
			item($i, '2. XP/2003', '2', setHostValueFunction($2, "os_name", "Microsoft Windows", "os_flavor", "XP"));
			item($i, '3. Vista/7', '3', setHostValueFunction($2, "os_name", "Microsoft Windows", "os_flavor", "Vista"));

		item($h, "Remove Host", 'R', clearHostFunction($2));
}

sub view_items {
	# make it so we can recreate this menu if necessary...
	setf('&recreate_view_items', lambda({ [$parent removeAll]; view_items($parent); }, $parent => $1));

	item($1, 'Console', 'C', { thread(&createConsoleTab); });
	
	if ($RPC_CONSOLE !is $null) {
		item($1, 'RPC Console', 'P', {
			[$frame addTab: "msfrpcd", $RPC_CONSOLE, {}];
		});
	}

	if ($mclient !is $client && $mclient !is $null) {
		item($1, 'Event Log', 'E', &createEventLogTab);
	}

	separator($1);

	item($1, 'Credentials', 'r', { thread(&createCredentialsTab); });
	item($1, 'Downloads', 'D', { thread(&createDownloadBrowser); });
	item($1, 'Jobs', 'J', { thread(&createJobsTab); });
	item($1, 'Loot', 'L', { thread(&createLootBrowser) });

	separator($1);

	local('$t');
	$t = menu($1, 'Report Data', 'R');

	item($t, 'Activity Logs', 'A', gotoFile([new File: getFileProper(systemProperties()["user.home"], ".armitage")]));
	item($t, 'Export Data', 'E', { 
		thread({ 
			local('$file');
			$file = [new File: generateArtifacts()];
			[gotoFile($file)];
		}); 
	});
}

sub armitage_items {
	local('$m');<commit_msg>go back to Reporting from Report Data<commit_after>import msf.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import javax.swing.*;
import javax.imageio.*;

sub host_selected_items {
	local('$sid $session $i $s $h $o');

	host_attack_items($1, $2);

	if ($2[0] in %hosts && 'sessions' in %hosts[$2[0]]) {
		foreach $sid => $session (%hosts[$2[0]]['sessions']) {
			if ($session["type"] eq "meterpreter") {
				$i = menu($1, "Meterpreter $sid", $sid);
				showMeterpreterMenu($i, \$session, \$sid);
			}
			else if ($session["type"] eq "shell") {
				$i = menu($1, "Shell $sid", $sid);
				showShellMenu($i, \$session, \$sid);
			}
		}
	}

	item($1, "Services", 'v', lambda({ createServiceBrowser($hosts) }, $hosts => $2));
	item($1, "Scan", 'c', lambda({ launch_msf_scans(join(", ", $hosts)); }, $hosts => $2));

	separator($1);

	$h = menu($1, "Host", 'H');

		$o = menu($h, "Operating System", 'O');
		item($o, "Cisco IOS", 'C', setHostValueFunction($2, "os_name", "Cisco IOS"));
		item($o, "FreeBSD", 'F', setHostValueFunction($2, "os_name", "FreeBSD"));
		item($o, "Linux", 'L', setHostValueFunction($2, "os_name", "Linux"));
		item($o, "NetBSD", 'N', setHostValueFunction($2, "os_name", "NetBSD"));
		item($o, "Mac OS X", 'M', setHostValueFunction($2, "os_name", "Apple Mac OS X"));
		item($o, "OpenBSD", 'O', setHostValueFunction($2, "os_name", "OpenBSD"));
		item($o, "Printer", 'P', setHostValueFunction($2, "os_name", "Printer"));
		item($o, "Solaris", 'S', setHostValueFunction($2, "os_name", "Solaris"));
		item($o, "Unknown", 'U', setHostValueFunction($2, "os_name", ""));
		$i = menu($o, "Windows", 'W');
			item($i, '1. 95/98/2000', '1', setHostValueFunction($2, "os_name", "Micosoft Windows", "os_flavor", "2000"));
			item($i, '2. XP/2003', '2', setHostValueFunction($2, "os_name", "Microsoft Windows", "os_flavor", "XP"));
			item($i, '3. Vista/7', '3', setHostValueFunction($2, "os_name", "Microsoft Windows", "os_flavor", "Vista"));

		item($h, "Remove Host", 'R', clearHostFunction($2));
}

sub view_items {
	# make it so we can recreate this menu if necessary...
	setf('&recreate_view_items', lambda({ [$parent removeAll]; view_items($parent); }, $parent => $1));

	item($1, 'Console', 'C', { thread(&createConsoleTab); });
	
	if ($RPC_CONSOLE !is $null) {
		item($1, 'RPC Console', 'P', {
			[$frame addTab: "msfrpcd", $RPC_CONSOLE, {}];
		});
	}

	if ($mclient !is $client && $mclient !is $null) {
		item($1, 'Event Log', 'E', &createEventLogTab);
	}

	separator($1);

	item($1, 'Credentials', 'r', { thread(&createCredentialsTab); });
	item($1, 'Downloads', 'D', { thread(&createDownloadBrowser); });
	item($1, 'Jobs', 'J', { thread(&createJobsTab); });
	item($1, 'Loot', 'L', { thread(&createLootBrowser) });

	separator($1);

	local('$t');
	$t = menu($1, 'Reporting', 'R');

	item($t, 'Activity Logs', 'A', gotoFile([new File: getFileProper(systemProperties()["user.home"], ".armitage")]));
	item($t, 'Export Data', 'E', { 
		thread({ 
			local('$file');
			$file = [new File: generateArtifacts()];
			[gotoFile($file)];
		}); 
	});
}

sub armitage_items {
	local('$m');
{'fraction_non_alphanumeric': 0.2548449612403101, 'fraction_numerical': 0.020348837209302327, 'mean_word_length': 5.29369918699187, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3344675', 'n_tokens_mistral': 2566, 'n_tokens_neox': 2350, 'n_words': 554}