From ebb5e2f1646e0b52b5be288ea018bbbcdf78acb7 Mon Sep 17 00:00:00 2001 From: cyd01 Date: Mon, 5 Oct 2020 07:55:27 +0200 Subject: [PATCH] Tagging the 0.74.2.4 release of the kitty project. --- 0.74_My_PuTTY/config.c | 12 ++++---- 0.74_My_PuTTY/settings.c | 41 +++++++++++++------------ 0.74_My_PuTTY/version.h | 2 +- 0.74_My_PuTTY/windows/MAKEFILE.MINGW | 2 +- 0.74_My_PuTTY/windows/version_minor.txt | 2 +- 0.74_My_PuTTY/windows/window.c | 31 ++++++++++++------- docs/navigation.md | 2 ++ docs/pages/scoop.md | 2 +- docs/version.txt | 2 +- kitty.c | 40 ++++++++++++------------ kitty.h | 6 +++- kitty_commun.c | 4 +-- kitty_commun.h | 2 +- kitty_crypt.c | 8 ++--- kitty_crypt.h | 6 ++-- kitty_ini.txt | 2 +- kitty_launcher.c | 4 +-- kitty_savedump.c | 25 +++++++++++---- kitty_settings.c | 4 +-- url/urlhack.c | 13 ++++++-- url/urlhack.h | 2 +- 21 files changed, 127 insertions(+), 85 deletions(-) diff --git a/0.74_My_PuTTY/config.c b/0.74_My_PuTTY/config.c index 6f72c9e..1e4dcaf 100644 --- a/0.74_My_PuTTY/config.c +++ b/0.74_My_PuTTY/config.c @@ -17,7 +17,7 @@ #include "kitty.h" #include "kitty_store.h" union control * ctrlHostnameEdit = NULL ; -void MASKPASS( char * password ) ; +void MASKPASS( const int mode, char * password ) ; int stricmp(const char *s1, const char *s2) ; int GetReadOnlyFlag(void) ; #endif @@ -1144,7 +1144,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) { char buffer[1024] ; strcpy( buffer, conf_get_str( conf, CONF_password) ) ; - MASKPASS( buffer ) ; + MASKPASS( GetCryptSaltFlag(), buffer ) ; conf_set_str( conf, CONF_password, buffer ) ; memset( buffer, 0, strlen(buffer) ) ; } @@ -1159,7 +1159,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) { char buffer[1024] ; strcpy( buffer, conf_get_str( conf, CONF_password) ) ; - MASKPASS( buffer ) ; + MASKPASS( GetCryptSaltFlag(), buffer ) ; conf_set_str( conf, CONF_password, buffer ) ; memset( buffer, 0, strlen(buffer) ) ; } @@ -1188,7 +1188,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) { char buffer[1024] ; strcpy( buffer, conf_get_str( conf, CONF_password) ) ; - MASKPASS( buffer ) ; + MASKPASS( GetCryptSaltFlag(), buffer ) ; conf_set_str( conf, CONF_password, buffer ) ; memset( buffer, 0, strlen(buffer) ) ; } @@ -1200,7 +1200,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) { char buffer[1024] ; strcpy( buffer, conf_get_str( conf, CONF_password) ) ; - MASKPASS( buffer ) ; + MASKPASS( GetCryptSaltFlag(), buffer ) ; conf_set_str( conf, CONF_password, buffer ) ; memset( buffer, 0, strlen(buffer) ) ; } @@ -1262,7 +1262,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) { char buffer[1024] ; strcpy( buffer, conf_get_str( conf, CONF_password) ) ; - MASKPASS( buffer ) ; + MASKPASS( GetCryptSaltFlag(), buffer ) ; conf_set_str( conf, CONF_password, buffer ) ; memset( buffer, 0, strlen(buffer) ) ; } diff --git a/0.74_My_PuTTY/settings.c b/0.74_My_PuTTY/settings.c index 7cc2773..97eb6d9 100644 --- a/0.74_My_PuTTY/settings.c +++ b/0.74_My_PuTTY/settings.c @@ -28,7 +28,7 @@ extern char FileExtension[15] ; int cryptpassword( int mode, char * password, const char * host, const char * termtype ) ; int decryptpassword( int mode, char * password, const char * host, const char * termtype ) ; int get_param( const char * val ) ; -void MASKPASS( char * password ) ; +void MASKPASS( const int mode, char * password ) ; int GetBackgroundImageFlag(void) ; int GetCryptSaltFlag() ; #endif @@ -913,7 +913,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf) #ifndef MOD_NOPASSWORD char pst[4096] ; strcpy( pst, conf_get_str(conf, CONF_password ) ); - MASKPASS(pst); + MASKPASS(GetCryptSaltFlag(), pst); cryptpassword( GetCryptSaltFlag(), pst, conf_get_str(conf, CONF_host), conf_get_str(conf, CONF_termtype) ) ; write_setting_s(sesskey, "Password", pst); memset(pst,0,strlen(pst)); @@ -945,24 +945,27 @@ bool load_settings(const char *section, Conf *conf) close_settings_r(sesskey); #ifdef MOD_PERSO if (exists && conf_launchable(conf)) { - if( get_param("INIFILE") == SAVEMODE_DIR ) { - char *name=NULL ; - if( (section!=NULL) && (strlen(section)>0) && (strlen(conf_get_str( conf, CONF_folder))>0) ) { - if( !strcmp(conf_get_str( conf, CONF_folder),"Default") ) { - add_session_to_jumplist(section); - } else { - name=(char*)malloc( strlen(section)+strlen(conf_get_str( conf, CONF_folder))+5); - sprintf(name,"%s/%s",conf_get_str( conf, CONF_folder),section); + if( get_param("INIFILE") == SAVEMODE_DIR ) { + char *name = NULL ; + if( (section!=NULL) && (strlen(section)>0) && (strlen(conf_get_str( conf, CONF_folder))>0) ) { + if( strcmp(conf_get_str( conf, CONF_folder), "Default" ) ) { + name = (char*)malloc( strlen(section)+strlen(conf_get_str( conf, CONF_folder)) + 2 ) ; + sprintf( name, "%s/%s", conf_get_str( conf, CONF_folder), section ) ; + } + } else if( (section!=NULL) && (strlen(section)>0) ) { + name = (char*)malloc( strlen(section)+1 ) ; + sprintf( name, "%s", section ) ; } - } else if( (section!=NULL) && (strlen(section)>0) ) { - name=(char*)malloc( strlen(section)+1); - sprintf(name,"%s",section); + if( name!=NULL ) { + //add_session_to_jumplist(section) ; + add_session_to_jumplist(name) ; + free(name) ; + } else { + add_session_to_jumplist(section) ; + } + } else { + add_session_to_jumplist(section); } - if( name!=NULL ) { add_session_to_jumplist(name); free(name) ; } - else { add_session_to_jumplist(section); } - } else { - add_session_to_jumplist(section); - } } #else if (exists && conf_launchable(conf)) @@ -1586,7 +1589,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf) } } } - MASKPASS(pst); + MASKPASS(GetCryptSaltFlag(), pst); conf_set_str( conf, CONF_password, pst ) ; memset(pst,0,strlen(pst)); } diff --git a/0.74_My_PuTTY/version.h b/0.74_My_PuTTY/version.h index 9981f77..1d6e27a 100644 --- a/0.74_My_PuTTY/version.h +++ b/0.74_My_PuTTY/version.h @@ -1,5 +1,5 @@ #define RELEASE 0.74 #define TEXTVER "Release 0.74" #define SSHVER "-Release-0.74" -#define BINARY_VERSION 0,74,2,3 +#define BINARY_VERSION 0,74,2,4 #define SOURCE_COMMIT "unavailable" diff --git a/0.74_My_PuTTY/windows/MAKEFILE.MINGW b/0.74_My_PuTTY/windows/MAKEFILE.MINGW index 6d15edf..5e66485 100644 --- a/0.74_My_PuTTY/windows/MAKEFILE.MINGW +++ b/0.74_My_PuTTY/windows/MAKEFILE.MINGW @@ -1918,7 +1918,7 @@ kitty_win.o: ../../kitty_win.c ../../kitty_win.h urlhack.o: ../../url/urlhack.c ../../url/urlhack.h \ ../puttymem.h - $(CC) $(COMPAT) $(CFLAGS) $(XFLAGS) -c ../../url/urlhack.c -DEXTERN_REGEXLIB + $(CC) $(COMPAT) $(CFLAGS) $(XFLAGS) -c ../../url/urlhack.c -DEXTERN_REGEXLIB urlhack_nohyperlink.o: ../../url/urlhack.c ../../url/urlhack.h \ ../puttymem.h diff --git a/0.74_My_PuTTY/windows/version_minor.txt b/0.74_My_PuTTY/windows/version_minor.txt index 00750ed..b8626c4 100644 --- a/0.74_My_PuTTY/windows/version_minor.txt +++ b/0.74_My_PuTTY/windows/version_minor.txt @@ -1 +1 @@ -3 +4 diff --git a/0.74_My_PuTTY/windows/window.c b/0.74_My_PuTTY/windows/window.c index 7d403a2..61f8c8d 100644 --- a/0.74_My_PuTTY/windows/window.c +++ b/0.74_My_PuTTY/windows/window.c @@ -309,6 +309,8 @@ COLORREF return_colours258(void) { return colours[258]; } struct netscheduler_tag* netscheduler_new(void) ; void netscheduler_free(struct netscheduler_tag* netscheduler) ; +void AddDynamicSFTPConnect( Conf *conf ) ; + /* String pour charger automatiquement au démarrage un fichier dans un editeur connecté */ static char *LoadFile = NULL ; @@ -318,6 +320,8 @@ int force_reconf = 1 ; // Reinitialiser le fichier de logs void logfile_reinit(void *handle) ; +void set_cmd_line( const char * st ) ; + #ifdef MOD_INTEGRATED_KEYGEN int WINAPI KeyGen_WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show); #endif @@ -733,6 +737,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) #endif #ifdef MOD_PERSO // Initialisation specifique a KiTTY + set_cmd_line( cmdline ) ; SethInstIcons( hinst ) ; InitWinMain(); if( debug_flag ) { @@ -891,7 +896,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) i++ ; char bufpass[1024] ; strcpy( bufpass, argv[i] ); - MASKPASS( bufpass ) ; + MASKPASS( GetCryptSaltFlag(), bufpass ) ; conf_set_str( conf, CONF_password, bufpass ) ; memset( bufpass, 0, strlen(bufpass) ) ; memset( argv[i], 0, strlen(argv[i]) ) ; @@ -3338,7 +3343,7 @@ else if((UINT_PTR)wParam == TIMER_INIT) { // Initialisation if( strlen( conf_get_str(conf,CONF_username) ) > 0 ) { if( strlen( conf_get_str(conf,CONF_password) ) > 0 ) { char bufpass[1024]; strcpy(bufpass,conf_get_str(conf,CONF_password)) ; - MASKPASS(bufpass); strcat(buffer,bufpass); memset(bufpass,0,strlen(bufpass)); + MASKPASS(GetCryptSaltFlag(), bufpass); strcat(buffer,bufpass); memset(bufpass,0,strlen(bufpass)); strcat( buffer, "\\n" ) ; } } @@ -4368,7 +4373,7 @@ free(cmd); case WM_MBUTTONDOWN: case WM_RBUTTONDOWN: #ifdef MOD_RECONNECT - if( ((!backend) || (!is_backend_connected)) && GetAutoreconnectFlag() && is_backend_first_connected ) { // On essaie de se reconnecter + if( ((!backend) || (!is_backend_connected)) && GetAutoreconnectFlag() && is_backend_first_connected ) { // trying to reconnect PostMessage( hwnd, WM_COMMAND, IDM_RESTART, 0 ) ; lp_eventlog(default_logpolicy, "No connection on mouse click, trying to reconnect...") ; break ; @@ -4380,7 +4385,7 @@ free(cmd); #ifdef MOD_PERSO if( GetProtectFlag() ) { break ; } if(!PuttyFlag && GetMouseShortcutsFlag() ) { - if( (message == WM_LBUTTONUP) && ((wParam & MK_SHIFT)&&(wParam & MK_CONTROL) ) ) { // shift + CTRL + bouton gauche => duplicate session + if( (message == WM_LBUTTONUP) && ((wParam & MK_SHIFT) && (wParam & MK_CONTROL) ) ) { // shift + CTRL + left button => duplicate session if( backend && is_backend_connected ) { lp_eventlog(default_logpolicy, "Duplicate session") ; SendMessage( hwnd, WM_COMMAND, IDM_DUPSESS, 0 ) ; @@ -4396,16 +4401,20 @@ free(cmd); break ; } - else if (message == WM_LBUTTONUP && ((wParam & MK_CONTROL) ) ) {// ctrl+bouton gauche => nouvelle icone - if( !GetHyperlinkFlag() || !conf_get_int(conf,CONF_url_ctrl_click) ) { // si les hyperliens ou le ctrl sont désactivés - if( GetIconeFlag() != -1 ) SetNewIcon( hwnd, conf_get_filename(conf,CONF_iconefile)->path, conf_get_int(conf,CONF_icone), SI_NEXT ) ; + else if (message == WM_LBUTTONUP && ((wParam & MK_CONTROL) ) ) { // ctrl + left button => new icon ? + if( !GetHyperlinkFlag() || !conf_get_int(conf,CONF_url_ctrl_click) ) { // if no hyperlink feature or if ctrl + link is disable + if( GetIconeFlag() != -1 ) { + SetNewIcon( hwnd, conf_get_filename(conf,CONF_iconefile)->path, conf_get_int(conf,CONF_icone), SI_NEXT ) ; + } + break ; } else { - if( !urlhack_is_in_link_region(TO_CHR_X(cursor_pt.x), TO_CHR_Y(cursor_pt.y)) ) { // Si sou sla position de la souris il n'y a pas un hyperlien - if( GetIconeFlag() != -1 ) SetNewIcon( hwnd, conf_get_filename(conf,CONF_iconefile)->path, conf_get_int(conf,CONF_icone), SI_NEXT ) ; + if( !urlhack_is_in_link_region(TO_CHR_X(cursor_pt.x), TO_CHR_Y(cursor_pt.y)) ) { // If the is no hyperlink under mouse + if( GetIconeFlag() != -1 ) { + SetNewIcon( hwnd, conf_get_filename(conf,CONF_iconefile)->path, conf_get_int(conf,CONF_icone), SI_NEXT ) ; + } + break ; } } - RefreshBackground( hwnd ) ; - break ; } else if (message == WM_MBUTTONUP && ((wParam & MK_CONTROL) ) ) { // ctrl+bouton milieu => send to tray diff --git a/docs/navigation.md b/docs/navigation.md index 0828964..6c116f4 100644 --- a/docs/navigation.md +++ b/docs/navigation.md @@ -22,6 +22,7 @@ * [Automatic command](pages/AutomaticCommand.md) * [Force CR/LF on enter key](pages/ForceCRLF.md) * [Running a locally saved script on a remote session](pages/LocalScript.md) + * [ZModem integration](pages/ZModem.md) [Graphical]() @@ -42,6 +43,7 @@ * [Binary compression](pages/BinaryCompression.md) * [Clipboard printing](pages/ClipboardPrinting.md) * [Start Cygwin or cmd.exe into KiTTY](pages/cygtermd.md) + * [Background image](pages/covidimus.md) * [File association](pages/FileAssociation.md) * [Other settings](pages/OtherSettings.md) * [Menu key shortcuts definition](pages/MenuShortcuts.md) diff --git a/docs/pages/scoop.md b/docs/pages/scoop.md index 540a7f7..c4abb4b 100644 --- a/docs/pages/scoop.md +++ b/docs/pages/scoop.md @@ -7,5 +7,5 @@ After installing **Scoop**, just run these commands to install **KiTTY**: ``` scoop bucket add extras -sccop install kitty +scoop install kitty ``` diff --git a/docs/version.txt b/docs/version.txt index 3ddd2cb..797578a 100644 --- a/docs/version.txt +++ b/docs/version.txt @@ -1 +1 @@ -0.74.2.3 \ No newline at end of file +0.74.2.4 \ No newline at end of file diff --git a/kitty.c b/kitty.c index e3986f2..b5a656e 100644 --- a/kitty.c +++ b/kitty.c @@ -947,7 +947,7 @@ void RenewPassword( Conf *conf ) { GetSessionField( conf_get_str(conf,CONF_sessionname), conf_get_str(conf,CONF_folder), "HostName", host ); GetSessionField( conf_get_str(conf,CONF_sessionname), conf_get_str(conf,CONF_folder), "TerminalType", termtype ); decryptpassword( GetCryptSaltFlag(), buffer, host, termtype ) ; - MASKPASS(buffer); + MASKPASS(GetCryptSaltFlag(),buffer); conf_set_str(conf,CONF_password,buffer) ; memset(buffer,0,strlen(buffer) ); } @@ -969,7 +969,7 @@ void SetPasswordInConfig( const char * password ) { bufpass[strlen(bufpass)-1]='\0'; } while( (bufpass[strlen(bufpass)-1]=='\n') || (bufpass[strlen(bufpass)-1]=='\r') || (bufpass[strlen(bufpass)-1]=='\t') || (bufpass[strlen(bufpass)-1]==' ') ) { bufpass[strlen(bufpass)-1]='\0' ; } - MASKPASS(bufpass) ; + MASKPASS(GetCryptSaltFlag(),bufpass) ; } else { strcpy( bufpass, "" ) ; } @@ -2085,7 +2085,7 @@ void SendOneFile( HWND hwnd, char * directory, char * filename, char * distantdi strcat( buffer, "-pw \"" ) ; char bufpass[1024] ; strcpy( bufpass, conf_get_str(conf,CONF_password) ) ; - MASKPASS(bufpass) ; strcat( buffer, bufpass ) ; memset( bufpass, 0, strlen(bufpass) ) ; + MASKPASS(GetCryptSaltFlag(),bufpass) ; strcat( buffer, bufpass ) ; memset( bufpass, 0, strlen(bufpass) ) ; strcat( buffer, "\" " ) ; } if( strlen( conf_get_str(conf,CONF_portknockingoptions)) > 0 ) { @@ -2212,7 +2212,7 @@ void RunExternPlink( HWND hwnd, const char * cmd ) { strcat( buffer, "-pw \"" ) ; char bufpass[1024] ; strcpy( bufpass,conf_get_str(conf,CONF_password) ) ; - MASKPASS(bufpass); strcat( buffer, bufpass ) ; + MASKPASS(GetCryptSaltFlag(),bufpass); strcat( buffer, bufpass ) ; memset(bufpass,0,strlen(bufpass)); strcat( buffer, "\" " ) ; } @@ -2307,7 +2307,7 @@ void GetOneFile( HWND hwnd, char * directory, const char * filename ) { strcat( buffer, "-pw \"" ) ; char bufpass[1024] ; strcpy( bufpass,conf_get_str(conf,CONF_password) ) ; - MASKPASS(bufpass); strcat( buffer, bufpass ) ; memset(bufpass,0,strlen(bufpass)); + MASKPASS(GetCryptSaltFlag(),bufpass); strcat( buffer, bufpass ) ; memset(bufpass,0,strlen(bufpass)); strcat( buffer, "\" " ) ; } if( strlen( conf_get_str(conf,CONF_portknockingoptions)) > 0 ) { @@ -2431,7 +2431,7 @@ void GetFile( HWND hwnd ) { strcat( buffer, "-pw " ) ; char bufpass[1024] ; strcpy( bufpass, conf_get_str(conf,CONF_password) ) ; - MASKPASS(bufpass); strcat( buffer, bufpass ) ; memset(bufpass,0,strlen(bufpass)); + MASKPASS(GetCryptSaltFlag(),bufpass); strcat( buffer, bufpass ) ; memset(bufpass,0,strlen(bufpass)); strcat( buffer, " " ) ; } if( strlen( conf_get_filename(conf,CONF_keyfile)->path ) > 0 ) { @@ -3678,7 +3678,7 @@ int InternalCommand( HWND hwnd, char * st ) { if( strlen( conf_get_str(conf,CONF_password) ) > 0 ) { char bufpass[4096], buffer[4096] ; strcpy( bufpass, conf_get_str(conf,CONF_password) ) ; - MASKPASS(bufpass); + MASKPASS(GetCryptSaltFlag(),bufpass); sprintf( buffer, "Your password is\n-%s-", bufpass ) ; memset(bufpass,0,strlen(bufpass)); MessageBox( hwnd, buffer, "Password", MB_OK|MB_ICONWARNING ) ; @@ -3769,30 +3769,32 @@ int SearchWinSCP( void ) { if( WinSCPPath!=NULL) { free(WinSCPPath) ; WinSCPPath = NULL ; } if( ReadParameter( INIT_SECTION, "WinSCPPath", buffer ) != 0 ) { if( existfile( buffer ) ) { - WinSCPPath = (char*) malloc( strlen(buffer) + 1 ) ; strcpy( WinSCPPath, buffer ) ; return 1 ; - } - else { DelParameter( INIT_SECTION, "WinSCPPath" ) ; } + WinSCPPath = (char*) malloc( strlen(buffer) + 1 ) ; strcpy( WinSCPPath, buffer ) ; + return 1 ; + } else { + DelParameter( INIT_SECTION, "WinSCPPath" ) ; } + } //strcpy( buffer, "C:\\Program Files\\WinSCP\\WinSCP.exe" ) ; sprintf( buffer, "%s\\WinSCP\\WinSCP.exe", getenv("ProgramFiles") ) ; if( existfile( buffer ) ) { WinSCPPath = (char*) malloc( strlen(buffer) + 1 ) ; strcpy( WinSCPPath, buffer ) ; WriteParameter( INIT_SECTION, "WinSCPPath", WinSCPPath ) ; return 1 ; - } + } //strcpy( buffer, "C:\\Program Files\\WinSCP3\\WinSCP3.exe" ) ; sprintf( buffer, "%s\\WinSCP3\\WinSCP3.exe", getenv("ProgramFiles") ) ; if( existfile( buffer ) ) { WinSCPPath = (char*) malloc( strlen(buffer) + 1 ) ; strcpy( WinSCPPath, buffer ) ; WriteParameter( INIT_SECTION, "WinSCPPath", WinSCPPath ) ; return 1 ; - } + } sprintf( buffer, "%s\\WinSCP.exe", InitialDirectory ) ; if( existfile( buffer ) ) { WinSCPPath = (char*) malloc( strlen(buffer) + 1 ) ; strcpy( WinSCPPath, buffer ) ; WriteParameter( INIT_SECTION, "WinSCPPath", WinSCPPath ) ; return 1 ; - } + } if( ReadParameter( INIT_SECTION, "winscpdir", buffer ) ) { buffer[4076]='\0'; strcat( buffer, "\\" ) ; strcat( buffer, "WinSCP.exe" ) ; @@ -3800,10 +3802,10 @@ int SearchWinSCP( void ) { WinSCPPath = (char*) malloc( strlen(buffer) + 1 ) ; strcpy( WinSCPPath, buffer ) ; WriteParameter( INIT_SECTION, "WinSCPPath", WinSCPPath ) ; return 1 ; - } } - return 0 ; } + return 0 ; +} // Lance une session dupliquee au meme endroit /* ALIAS UNIX A DEFINIR POUR DUPLIQUER LA SESSION COURANTE Dans le repertoire courant @@ -3841,7 +3843,7 @@ void StartNewSession( HWND hwnd, char * directory, char * host, char * user ) { char bufpass[1024] ; strcpy( bufpass, conf_get_str(conf,CONF_password) ) ; strcat( cmd, " -pw " ) ; - MASKPASS(bufpass) ; + MASKPASS(GetCryptSaltFlag(),bufpass) ; strcat(cmd,"\"") ; strcat(cmd,bufpass) ; strcat(cmd,"\"") ; memset(bufpass,0,strlen(bufpass)); } @@ -3854,7 +3856,7 @@ void StartNewSession( HWND hwnd, char * directory, char * host, char * user ) { char bufpass[1024] ; strcpy(bufpass,conf_get_str(conf,CONF_password)); strcat( cmd, " -pw " ) ; - MASKPASS(bufpass) ; + MASKPASS(GetCryptSaltFlag(),bufpass) ; strcat(cmd,"\"") ; strcat(cmd,bufpass) ; strcat(cmd,"\"") ; memset(bufpass,0,strlen(bufpass)); } @@ -3928,7 +3930,7 @@ void StartWinSCP( HWND hwnd, char * directory, char * host, char * user ) { char bufpass[1024] ; strcat( cmd, ":" ); strcpy(bufpass,conf_get_str(conf,CONF_password)); - MASKPASS(bufpass); + MASKPASS(GetCryptSaltFlag(),bufpass); strcat(cmd,bufpass); memset(bufpass,0,strlen(bufpass)); } @@ -3957,7 +3959,7 @@ void StartWinSCP( HWND hwnd, char * directory, char * host, char * user ) { char bufpass[1024] ; strcat( cmd, ":" ); strcpy(bufpass,conf_get_str(conf,CONF_password)); - MASKPASS(bufpass); + MASKPASS(GetCryptSaltFlag(),bufpass); strcat(cmd,bufpass); memset(bufpass,0,strlen(bufpass)); } diff --git a/kitty.h b/kitty.h index d21ff8b..5661299 100644 --- a/kitty.h +++ b/kitty.h @@ -337,7 +337,6 @@ HWND InfoBox( HINSTANCE hInstance, HWND hwnd ) ; // Renomme une Cle de registre void RegRenameTree( HWND hdlg, HKEY hMainKey, LPCTSTR lpSubKey, LPCTSTR lpDestKey ) ; void DelRegistryKey( void ) ; -void MASKPASS( char * password ) ; void RenewPassword( Conf *conf ) ; // Gere l'envoi dans le System Tray int ManageToTray( HWND hwnd ) ; @@ -395,6 +394,11 @@ void ChangeFontSize(HWND hwnd, int dec) ; void create_settings( const char * name ) ; void SetHostKeyExtension( const char* ext ) ; +void CreateIniFile( const char * filename ) ; +void SendKeyboard( HWND hwnd, const char * buffer ) ; +char * GetRemotePath() ; +void ManageShortcutsFlag( HWND hwnd ) ; + #ifdef MOD_LAUNCHER void InitLauncherRegistry( void ) ; #endif diff --git a/kitty_commun.c b/kitty_commun.c index 2ff13bf..8afbd17 100644 --- a/kitty_commun.c +++ b/kitty_commun.c @@ -389,7 +389,7 @@ void GetPasswordInConfig( char * p ) { int len = strlen( conf_get_str(conf,CONF_password) ) ; if( len>4095 ) { len = 4095 ; } memcpy( bufpass, conf_get_str(conf,CONF_password), len ) ; bufpass[len]='\0'; - MASKPASS(bufpass); + MASKPASS(GetCryptSaltFlag(),bufpass); memcpy( p, bufpass, strlen(bufpass)+1 ) ; memset(bufpass,0,strlen(bufpass)); } @@ -403,7 +403,7 @@ int IsPasswordInConf(void) { if( len>4095 ) { len = 4095 ; } memcpy( bufpass, conf_get_str(conf,CONF_password), len ) ; bufpass[len]='\0'; - MASKPASS(bufpass); + MASKPASS(GetCryptSaltFlag(),bufpass); len = strlen( bufpass ) ; memset(bufpass,0,strlen(bufpass)); return len ; diff --git a/kitty_commun.h b/kitty_commun.h index 77fab96..f36b817 100644 --- a/kitty_commun.h +++ b/kitty_commun.h @@ -113,7 +113,7 @@ void mungestr( const char *in, char *out ) ; void unmungestr( const char *in, char *out, int outlen ) ; // Fonctions de gestion du mot de passe -void MASKPASS( char * password ) ; +void MASKPASS( const int mode, char * password ) ; void GetPasswordInConfig( char * p ) ; int IsPasswordInConf(void) ; void CleanPassword( char * p ) ; diff --git a/kitty_crypt.c b/kitty_crypt.c index 01a04d8..0a51fe7 100644 --- a/kitty_crypt.c +++ b/kitty_crypt.c @@ -31,13 +31,13 @@ void dopasskey( int mode, char * passkey, const char * host, const char * termty } } -int cryptpassword( int mode, char * password, const char * host, const char * termtype ) { +int cryptpassword( const int mode, char * password, const char * host, const char * termtype ) { char PassKey[1024] = "" ; dopasskey( mode, PassKey, host, termtype ) ; return cryptstring( password, PassKey ) ; } -int decryptpassword( int mode, char * password, const char * host, const char * termtype ) { +int decryptpassword( const int mode, char * password, const char * host, const char * termtype ) { char PassKey[1024] = "" ; dopasskey( mode, PassKey, host, termtype ) ; return decryptstring( password, PassKey ) ; @@ -46,8 +46,8 @@ int decryptpassword( int mode, char * password, const char * host, const char * //static char MASKKEY[128] = MASTER_PASSWORD ; static char MASKKEY[128] = "¤¥©ª³¼½¾" ; -void MASKPASS( char * password ) { - //return ; // POUR SIMPLIFIER EN ATTENDANT QUE TOUT FONCTIONNE DANS LA MISE A JOUR > 2013/06/27 +void MASKPASS( const int mode, char * password ) { + if( mode > 0 ) return ; // POUR SIMPLIFIER EN ATTENDANT QUE TOUT FONCTIONNE DANS LA MISE A JOUR > 2013/06/27 if( password==NULL ) return ; if( strlen(password)==0) return ; diff --git a/kitty_crypt.h b/kitty_crypt.h index 552e3ab..2d5ebe3 100644 --- a/kitty_crypt.h +++ b/kitty_crypt.h @@ -5,8 +5,10 @@ int cryptstring( char * st, const char * key ) ; int decryptstring( char * st, const char * key ) ; -int cryptpassword( int mode, char * password, const char * host, const char * termtype ) ; -int decryptpassword( int mode, char * password, const char * host, const char * termtype ) ; +int cryptpassword( const int mode, char * password, const char * host, const char * termtype ) ; +int decryptpassword( const int mode, char * password, const char * host, const char * termtype ) ; + +void MASKPASS( const int mode, char * password ) ; // Procedure de management de la passphrase int GetUserPassSSHNoSave(void) ; diff --git a/kitty_ini.txt b/kitty_ini.txt index ec11520..2ecdee1 100644 --- a/kitty_ini.txt +++ b/kitty_ini.txt @@ -78,7 +78,7 @@ conf=yes ;configdir= ; cryptsalt: set salt mode for password encryption -;cryptsalt=0 +;cryptsalt=1 ; CtHelperPath: the full path to the cthelper.exe binary (Wrapper for Cygwin feature) ;CtHelperPath= diff --git a/kitty_launcher.c b/kitty_launcher.c index 3d89499..337d470 100644 --- a/kitty_launcher.c +++ b/kitty_launcher.c @@ -742,7 +742,7 @@ void RunConfig( Conf * conf ) { char bufpass[1024] ; strcpy( bufpass, conf_get_str(conf,CONF_password)) ; - MASKPASS(bufpass) ; + MASKPASS(GetCryptSaltFlag(),bufpass) ; conf_set_str(conf,CONF_password,bufpass) ; if (restricted_acl) { @@ -782,7 +782,7 @@ void RunConfig( Conf * conf ) { cl = dupprintf("putty %s&%p:%u", argprefix, filemap, (unsigned)size); - MASKPASS(bufpass); + MASKPASS(GetCryptSaltFlag(),bufpass); conf_set_str(conf,CONF_password,bufpass); memset(bufpass,0,strlen(bufpass)); diff --git a/kitty_savedump.c b/kitty_savedump.c index 4e725d1..baa33cb 100644 --- a/kitty_savedump.c +++ b/kitty_savedump.c @@ -7,12 +7,23 @@ int GetAutoStoreSSHKeyFlag(void) ; int GetUserPassSSHNoSave(void) ; int GetCryptSaltFlag() ; -// Buffer contenant du texte a ecrire au besoin dans le fichier kitty.dmp -static char * DebugText = NULL ; - extern int is_backend_connected ; extern int is_backend_first_connected ; +// String contenant la ligne de commande +static char * CmdLine = NULL ; +void set_cmd_line( const char * st ) { + if( st != NULL ) { + if( CmdLine != NULL ) { free( CmdLine ) ; CmdLine = NULL ; } + CmdLine = (char*) malloc( strlen(st) + 1 ) ; + //if( strlen(st)>0 ) MessageBox(NULL,st,"ici",MB_OK); + strcpy( CmdLine, st ) ; + } +} + +// Buffer contenant du texte a ecrire au besoin dans le fichier kitty.dmp +static char * DebugText = NULL ; + void set_debug_text( const char * txt ) { if( DebugText!=NULL ) { free( DebugText ) ; DebugText = NULL ; } if( txt != NULL ) { @@ -95,7 +106,7 @@ void PrintOSInfo( FILE * fp ) { if (dwVersion < 0x80000000) dwBuild = (DWORD)(HIWORD(dwVersion)); - fprintf( fp, "Version is %d.%d (%d)\n", dwMajorVersion, dwMinorVersion, dwBuild ) ; + fprintf( fp, "Version is %lu.%lu (%lu)\n", dwMajorVersion, dwMinorVersion, dwBuild ) ; } @@ -103,7 +114,7 @@ void PrintSystemInfo( FILE * fp ) { // https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-system_info SYSTEM_INFO si; GetSystemInfo( &si ); - fprintf( fp, "wProcessorArchitecture=%d ",si.wProcessorArchitecture ) ; + fprintf( fp, "wProcessorArchitecture=%lu ",si.wProcessorArchitecture ) ; switch(si.wProcessorArchitecture) { case PROCESSOR_ARCHITECTURE_ARM: fprintf(fp,"(PROCESSOR_ARCHITECTURE_ARM: ARM)\n") ; break ; // case PROCESSOR_ARCHITECTURE_ARM64: fprintf(fp,"(PROCESSOR_ARCHITECTURE_ARM64: ARM64)\n") ; break ; @@ -122,6 +133,8 @@ void PrintWindowSettings( FILE * fp ) { RECT r ; char buffer[MAX_VALUE_NAME] ; + fprintf( fp, "CmdLine=%s\n", CmdLine ) ; + GetOSInfo( buffer ) ; fprintf( fp, "OSVersion=%s\n", buffer ) ; if( IsWow64() ) { fprintf( fp, "64 bits System\n" ) ; } else { fprintf( fp, "32 bits System\n" ) ; } @@ -542,7 +555,7 @@ void SaveDumpConfig( FILE *fp, Conf * conf ) { /* On decrypte le password */ char bufpass[4096] ; memcpy( bufpass, conf_get_str(conf,CONF_password), 4095 ) ; bufpass[4095]='\0'; - MASKPASS(bufpass); + MASKPASS(GetCryptSaltFlag(),bufpass); fprintf( fp, "password=%s\n", bufpass ) ; memset(bufpass,0,strlen(bufpass)); diff --git a/kitty_settings.c b/kitty_settings.c index 466f91f..73a5c5e 100644 --- a/kitty_settings.c +++ b/kitty_settings.c @@ -420,7 +420,7 @@ void save_open_settings_forced(char *filename, Conf *conf) { #ifndef MOD_NOPASSWORD char pst[4096] ; strcpy( pst, conf_get_str(conf, CONF_password ) ); - MASKPASS(pst); + MASKPASS(GetCryptSaltFlag(),pst); cryptpassword( GetCryptSaltFlag(), pst, conf_get_str(conf, CONF_host), conf_get_str(conf, CONF_termtype) ) ; write_setting_s_forced(sesskey, "Password", pst); memset(pst,0,strlen(pst)); @@ -1061,7 +1061,7 @@ void load_open_settings_forced(char *filename, Conf *conf) { } } } - MASKPASS(pst); + MASKPASS(GetCryptSaltFlag(),pst); conf_set_str( conf, CONF_password, pst ) ; memset(pst,0,strlen(pst)); } diff --git a/url/urlhack.c b/url/urlhack.c index f6a1ed0..15a96f3 100644 --- a/url/urlhack.c +++ b/url/urlhack.c @@ -1,6 +1,9 @@ /* * HACK: PuttyTray / Nutty * Hyperlink stuff: CORE FILE! Don't forget to COPY IT TO THE NEXT VERSION + * + * On-line tester: https://regex101.com/ + * */ #include #include @@ -18,11 +21,15 @@ static text_region **link_regions; static unsigned int link_regions_len; static unsigned int link_regions_current_pos; -// Essai de regex qui accepte aussi les lien mailto:// -const char* urlhack_default_regex = " (((((https?|ftp|svn):\\/\\/)|www\\.)(([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)|localhost|([a-zA-Z0-9\\-]+\\.)*[a-zA-Z0-9\\-]+\\.(com|net|org|info|biz|int|gov|name|edu|[a-zA-Z][a-zA-Z]))(:[0-9]+)?((\\/|\\?)[^ \"]*[^ ,;\\.:\">)])?)|(mailto:\\/\\/[a-zA-Z0-9\\-_\\.]+@[a-zA-Z0-9\\-_\\.]+\\.[a-z]{2,}))" ; +// Regex with http://, https://, ftp://, mailto: and ssh:// links +const char* urlhack_default_regex = "(((((https?|ftp):\\/\\/)|www\\.)(([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)|localhost|([a-zA-Z0-9\\-]+\\.)*[a-zA-Z0-9\\-]+\\.(com|net|org|info|biz|int|gov|name|edu|[a-zA-Z][a-zA-Z]))(:[0-9]+)?((\\/|\\?)[^ \"]*[^ ,;\\.:\">)]?)?)|(mailto:[a-zA-Z0-9\\-_\\.]+@[a-zA-Z0-9\\-_\\.]+\\.[a-z]{2,})|(ssh:\\/\\/([a-zA-Z0-9\\-_]+(:[^@]*)?@)?[a-zA-Z0-9\\-_\\.]+(:[0-9]{2,5})?(\\/[a-zA-Z0-9\\-_]+)?))" ; +// (((((https?|ftp):\/\/)|www\.)(([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|net|org|info|biz|int|gov|name|edu|[a-zA-Z][a-zA-Z]))(:[0-9]+)?((\/|\?)[^ "]*[^ ,;\.:">)]?)?)|(mailto:[a-zA-Z0-9\-_\.]+@[a-zA-Z0-9\-_\.]+\.[a-z]{2,})|(ssh:\/\/([a-zA-Z0-9\-_]+(:[^@]*)?@)?[a-zA-Z0-9\-_\.]+(:[0-9]{2,5})?(\/[a-zA-Z0-9\-_]+)?)) + + +// Regex with http://, https://, ftp://, mailto:// +//const char* urlhack_default_regex = " (((((https?|ftp|svn):\\/\\/)|www\\.)(([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)|localhost|([a-zA-Z0-9\\-]+\\.)*[a-zA-Z0-9\\-]+\\.(com|net|org|info|biz|int|gov|name|edu|[a-zA-Z][a-zA-Z]))(:[0-9]+)?((\\/|\\?)[^ \"]*[^ ,;\\.:\">)])?)|(mailto:\\/\\/[a-zA-Z0-9\\-_\\.]+@[a-zA-Z0-9\\-_\\.]+\\.[a-z]{2,}))" ; -// Celle-là marche c'est sûr //const char* urlhack_default_regex = "(((https?|ftp):\\/\\/)|www\\.)(([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)|localhost|([a-zA-Z0-9\\-]+\\.)*[a-zA-Z0-9\\-]+\\.(com|net|org|info|biz|int|gov|name|edu|[a-zA-Z][a-zA-Z]))(:[0-9]+)?((\\/|\\?)[^ \"]*[^ ,;\\.:\">)])?"; const char* urlhack_liberal_regex = diff --git a/url/urlhack.h b/url/urlhack.h index c169e72..8c2296b 100644 --- a/url/urlhack.h +++ b/url/urlhack.h @@ -5,7 +5,7 @@ #ifndef _URLHACK_H #define _URLHACK_H -#include "regex.h" +#include typedef struct { int x0, y0, x1, y1; } text_region;