예제 #1
0
파일: FiSH.c 프로젝트: kelek-/FiSH-irssi
void authenticated_fish_setup(const char *password, void *rec) {
	char B64digest[50];
	char iniPasswordHash[50];
 
        get_ini_password_hash(sizeof(iniPasswordHash), iniPasswordHash);
 
	calculate_password_key_and_hash(password, iniKey, B64digest);
 
	if (strcmp(B64digest, iniPasswordHash) != 0) {
		printtext(NULL, NULL, MSGLEVEL_CRAP,
			  "\002FiSH:\002 Wrong blow.ini password entered... Please \002/fishlogin\002 to try again");
		return;
	}
	printtext(NULL, NULL, MSGLEVEL_CRAP,
		  "\002FiSH:\002 Correct blow.ini password entered, lets go!");
 
	setup_fish();
}
예제 #2
0
파일: FiSH.c 프로젝트: bcome/FiSH-irssi
void fish_init(void)
{
	char iniPasswordHash[50], B64digest[50];

	strcpy(iniPath, get_irssi_config());	// path to irssi config file
	strcpy(strrchr(iniPath, '/'), blow_ini);

	if (DH1080_Init() == FALSE)
		return;

	getIniValue("FiSH", "ini_password_Hash", "0", iniPasswordHash,
		    sizeof(iniPasswordHash), iniPath);
	if (strlen(iniPasswordHash) == 43) {
		prompt_for_password(iniKey);
		calculate_password_key_and_hash(iniKey, iniKey, B64digest);

		if (strcmp(B64digest, iniPasswordHash) != 0) {
			printtext(NULL, NULL, MSGLEVEL_CRAP,
				  "\002FiSH:\002 Wrong blow.ini password entered, try again...");
			printtext(NULL, NULL, MSGLEVEL_CRAP,
				  "\002FiSH module NOT loaded.\002");
			return;
		}
		printtext(NULL, NULL, MSGLEVEL_CRAP,
			  "\002FiSH:\002 Correct blow.ini password entered, lets go!");
	} else {
		strcpy(iniKey, default_iniKey);
		printtext(NULL, NULL, MSGLEVEL_CRAP,
			  "\002FiSH:\002 Using default password to decrypt blow.ini... Try /setinipw to set a custom password.");
	}

	signal_add_first("server sendmsg", (SIGNAL_FUNC) encrypt_msg);
	signal_add_first("message private", (SIGNAL_FUNC) decrypt_msg);
	signal_add_first("message public", (SIGNAL_FUNC) decrypt_msg);
	signal_add_first("message irc notice", (SIGNAL_FUNC) decrypt_notice);
	signal_add_first("message irc action", (SIGNAL_FUNC) decrypt_action);

	signal_add_first("message own_private", (SIGNAL_FUNC) format_msg);
	signal_add_first("message own_public", (SIGNAL_FUNC) format_msg);

	signal_add_first("channel topic changed",
			 (SIGNAL_FUNC) decrypt_changed_topic);
	signal_add_first("message topic", (SIGNAL_FUNC) decrypt_topic);
	signal_add_first("server incoming", (SIGNAL_FUNC) raw_handler);

	signal_add("query created", (SIGNAL_FUNC) do_auto_keyx);
	signal_add("query nick changed", (SIGNAL_FUNC) query_nick_changed);

	command_bind("topic+", NULL, (SIGNAL_FUNC) cmd_crypt_topic);
	command_bind("notice+", NULL, (SIGNAL_FUNC) cmd_crypt_notice);
	command_bind("notfish", NULL, (SIGNAL_FUNC) cmd_crypt_notice);
	command_bind("me+", NULL, (SIGNAL_FUNC) cmd_crypt_action);
	command_bind("setkey", NULL, (SIGNAL_FUNC) cmd_setkey);
	command_bind("delkey", NULL, (SIGNAL_FUNC) cmd_delkey);
	command_bind("key", NULL, (SIGNAL_FUNC) cmd_key);
	command_bind("showkey", NULL, (SIGNAL_FUNC) cmd_key);
	command_bind("keyx", NULL, (SIGNAL_FUNC) cmd_keyx);
	command_bind("setinipw", NULL, (SIGNAL_FUNC) cmd_setinipw);
	command_bind("unsetinipw", NULL, (SIGNAL_FUNC) cmd_unsetinipw);

	command_bind("fishhelp", NULL, (SIGNAL_FUNC) cmd_helpfish);
	command_bind("helpfish", NULL, (SIGNAL_FUNC) cmd_helpfish);

	settings_add_bool_module("fish", "FiSH", "process_outgoing", 1);
	settings_add_bool_module("fish", "FiSH", "process_incoming", 1);
	settings_add_bool_module("fish", "FiSH", "auto_keyxchange", 1);
	settings_add_bool_module("fish", "FiSH", "nicktracker", 1);

	settings_add_str_module("fish", "FiSH", "mark_broken_block",
				" \002&\002");
	settings_add_str_module("fish", "FiSH", "mark_encrypted", "");
	settings_add_str_module("fish", "FiSH", "plain_prefix", "+p ");

	settings_add_int_module("fish", "FiSH", "mark_position", 0);

	printtext(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
		  "FiSH v1.00 - encryption module for irssi loaded! URL: https://github.com/falsovsky/FiSH-irssi\n"
		  "Try /helpfish or /fishhelp for a short command overview");

	module_register("fish", "core");
}