<commit_before>#
# Armitage Collaboration Feature... make no mistake, I'm extremely excited about this.
#

import msf.*;
import armitage.*;
import console.*;

sub createEventLogTab {
	this('$console $client');

	if ($client is $null && $console is $null) {
		$client = [new ConsoleClient: $null, $mclient, "armitage.poll", "armitage.push", $null, "", $null];
        	$console = [new Console: $preferences];
	        [$client setWindow: $console];
		[$client setEcho: $null];
		[$console updatePrompt: "> "];
	}

        [$frame addTab: "Event Log", $console, $null];
}

sub c_client {
	# run this thing in its own thread to avoid really stupid deadlock situations
	return wait(fork({
		local('$handle $client');
		$handle = connect($host, $port);
		$client = newInstance(^RpcConnection, lambda({
			writeObject($handle, @_);
			return readObject($handle);
		}, \$handle));
		return $client;
	}, $host => $1, $port => $2));
}

sub userFingerprint {
	return unpack("H*", digest(values(systemProperties(), @("os.name", "user.home", "os.version")), "MD5"))[0];
}

sub checkForUserConflict {
	cmd($client, $console, "set ARMITAGE_USER", {
		if ($3 ismatch "ARMITAGE_USER => (.*?)\n") {
			local('$user');
			$user = matched();
			if ($user ne userFingerprint()) {
				showError("Congratulations! You're eligible for a free ringtone.

Just kidding. *This is serious*

You're trying to connect to Metasploit when someone else is already 
using it. This won't work. Trust me. 
<commit_msg>fixed a bug causing the collab warning to always come up.<commit_after>#
# Armitage Collaboration Feature... make no mistake, I'm extremely excited about this.
#

import msf.*;
import armitage.*;
import console.*;

sub createEventLogTab {
	this('$console $client');

	if ($client is $null && $console is $null) {
		$client = [new ConsoleClient: $null, $mclient, "armitage.poll", "armitage.push", $null, "", $null];
        	$console = [new Console: $preferences];
	        [$client setWindow: $console];
		[$client setEcho: $null];
		[$console updatePrompt: "> "];
	}

        [$frame addTab: "Event Log", $console, $null];
}

sub c_client {
	# run this thing in its own thread to avoid really stupid deadlock situations
	return wait(fork({
		local('$handle $client');
		$handle = connect($host, $port);
		$client = newInstance(^RpcConnection, lambda({
			writeObject($handle, @_);
			return readObject($handle);
		}, \$handle));
		return $client;
	}, $host => $1, $port => $2));
}

sub userFingerprint {
	return unpack("H*", digest(values(systemProperties(), @("os.name", "user.home", "os.version")), "MD5"))[0];
}

sub checkForUserConflict {
	cmd($client, $console, "set ARMITAGE_USER", {
		if ($3 ismatch "ARMITAGE_USER => (.*?)\n") {
			local('$user');
			$user = matched()[0];
			if ($user ne userFingerprint()) {
				warn("$user vs. " . userFingerprint());
				showError("Congratulations! You're eligible for a free ringtone.

Just kidding. *This is serious*

You're trying to connect to Metasploit when someone else is already 
using it. This won't work. Trust me. 

{'fraction_non_alphanumeric': 0.16923076923076924, 'fraction_numerical': 0.003600654664484452, 'mean_word_length': 4.241852487135506, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2449460', 'n_tokens_mistral': 1070, 'n_tokens_neox': 979, 'n_words': 309}