void fish_init(void) { char iniPasswordHash[50]; printtext(NULL, NULL, MSGLEVEL_CLIENTNOTICE, "FiSH " FISH_VERSION " - encryption module for irssi loaded!\n" "URL: https://github.com/falsovsky/FiSH-irssi\n" "Try /helpfish or /fishhelp for a short command overview"); command_bind("fishhelp", NULL, (SIGNAL_FUNC) cmd_helpfish); command_bind("helpfish", NULL, (SIGNAL_FUNC) cmd_helpfish); command_bind("fishlogin", NULL, (SIGNAL_FUNC) cmd_fishlogin); if (DH1080_Init() == FALSE) return; get_ini_password_hash(sizeof(iniPasswordHash), iniPasswordHash); if (strlen(iniPasswordHash) != 43) { 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."); setup_fish(); } else { printtext(NULL, NULL, MSGLEVEL_CRAP, "\002FiSH:\002 Current blow.ini is password protected."); cmd_fishlogin(NULL, NULL, NULL); } module_register("fish", "core"); }
void fish_init(void) { char iniPasswordHash[50], SHA256digest[35], B64digest[50], *iniPass_ptr; int i; strcpy(iniPath, get_irssi_config()); // path to irssi config file strcpy(tempPath, iniPath); strcpy(strrchr(iniPath, '/'), blow_ini); strcpy(strrchr(tempPath, '/'), "/temp_FiSH.$$$"); if (DH1080_Init()==FALSE) return; GetPrivateProfileString("FiSH", "ini_password_Hash", "0", iniPasswordHash, sizeof(iniPasswordHash), iniPath); if (strlen(iniPasswordHash) == 43) { iniPass_ptr = getpass(" --> Please enter your blow.ini password: "******"\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); 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"); }
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"); }