Tyleo-Dev-AutoIT-Oldies/SSH-VT/SSH-VT.au3

177 lines
7.3 KiB
AutoIt
Raw Permalink Normal View History

2024-02-18 21:17:39 +00:00
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=SSH.ico
#AutoIt3Wrapper_Outfile=Releases\SSHVT_x32.exe
#AutoIt3Wrapper_Outfile_x64=Releases\SSHVT_x64.exe
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_Res_Comment=SSH-VirtualTerm (SSHVT)
#AutoIt3Wrapper_Res_Description=SSH-VirtualTerm (SSHVT)
#AutoIt3Wrapper_Res_Fileversion=1.2.0.6
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_ProductName=SSH-VirtualTerm
#AutoIt3Wrapper_Res_ProductVersion=1.2.0.0
#AutoIt3Wrapper_Res_CompanyName=Tyleo Softwares
#AutoIt3Wrapper_Res_LegalCopyright=Tyleo Softwares
#AutoIt3Wrapper_Res_LegalTradeMarks=Tyleo Softwares
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include "MetroGUI-UDF\MetroGUI_UDF.au3"
#include "Extensions.au3"
GetSoftDetails(@AutoItExe,"RELEASE")
#cs
Tyleo Software Project Base v1
Created With CNP and DevTools Base Folder
All Softwares created with this base are Free and Open Sourced.
Join our Guilded Server ! https://www.guilded.gg/i/2DRlM7Mp
#ce
$sshvt_config = @UserProfileDir & "\.ssh\sshvt_" & @UserName
if not FileExists($sshvt_config) Then
IniWrite($sshvt_config,"SSHVT","Profile Name","Default")
IniWrite($sshvt_config,"SSHVT","Private Key",@UserProfileDir & "\.ssh\id_rsa")
IniWrite($sshvt_config,"SSHVT","Host","localhost")
IniWrite($sshvt_config,"SSHVT","Port","22")
IniWrite($sshvt_config,"SSHVT","User",@UserName)
EndIf
$sshvt_cfg_profile = IniRead($sshvt_config,"SSHVT","Profile Name","Default")
$sshvt_cfg_priv = IniRead($sshvt_config,"SSHVT","Private Key",@UserProfileDir & "\.ssh\id_rsa")
$sshvt_cfg_host = IniRead($sshvt_config,"SSHVT","Host","localhost")
$sshvt_cfg_port = IniRead($sshvt_config,"SSHVT","Port","22")
$sshvt_cfg_user = IniRead($sshvt_config,"SSHVT","User",@UserName)
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("SecureSHell - " & $sshvt_cfg_profile, 522, 125, 276, 544)
GUISetFont("10","","","Segoe UI")
GUISetBkColor($CurrentAccent)
Global $Group1 = GUICtrlCreateGroup(" SecureShell Settings ", 0, 0, 521, 90)
Global $User = GUICtrlCreateInput($sshvt_cfg_user, 128, 20, 180, 21)
Global $Host = GUICtrlCreateInput($sshvt_cfg_host, 128, 43, 180, 21)
Global $Port = GUICtrlCreateInput($sshvt_cfg_port, 128, 66, 180, 21)
Global $Priv = GUICtrlCreateButton("PRIVKEY MODE", 320, 9, 200, 25)
GUICtrlSetFont(-1,"12",900)
Global $Pass = GUICtrlCreateButton("PASSWORD MODE", 320, 35, 200, 25)
GUICtrlSetFont(-1,"12",900)
Global $Cmd = GUICtrlCreateButton("OPEN CONSOLE", 320, 61, 200, 25)
GUICtrlSetFont(-1,"12",900)
Global $LUser = GUICtrlCreateLabel("USERNAME", 6, 20, 90, 17)
Global $LHost = GUICtrlCreateLabel("HOSTNAME", 6, 43, 90, 17)
Global $LPass = GUICtrlCreateLabel("PORT", 6, 66, 90, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $SoftLine = GUICtrlCreateLabel($CurrentName & " " & $CurrentVersion & " " & $CurrentBaseVersion, 1, 90, 519, 17)
Global $Menu = GUICtrlCreateMenu("Configuration")
Global $Menu_PrivKey = GUICtrlCreateMenuItem("Select Private Key" & @TAB & $sshvt_cfg_priv,$Menu)
Global $Menu_PrivKeyMenu = GUICtrlCreateMenu("Create a New Key",$Menu)
Global $Menu_PrivKeyGen_rsa2 = GUICtrlCreateMenuItem("RSA" & @TAB & "2048bits (normal)",$Menu_PrivKeyMenu)
Global $Menu_PrivKeyGen_rsa3 = GUICtrlCreateMenuItem("RSA" & @TAB & "3072bits (high)",$Menu_PrivKeyMenu)
Global $Menu_PrivKeyGen_rsa4 = GUICtrlCreateMenuItem("RSA" & @TAB & "4096bits (ultra)",$Menu_PrivKeyMenu)
Global $Menu_PrivKeyGen_rsa1 = GUICtrlCreateMenuItem("RSA" & @TAB & "1024bits (low)",$Menu_PrivKeyMenu)
GUICtrlCreateMenuItem("",$Menu_PrivKeyMenu)
Global $Menu_PrivKeyGen_ecdsa1 = GUICtrlCreateMenuItem("ECDSA" & @TAB & "256bits (low)",$Menu_PrivKeyMenu)
Global $Menu_PrivKeyGen_ecdsa2 = GUICtrlCreateMenuItem("ECDSA" & @TAB & "384bits (medium)",$Menu_PrivKeyMenu)
Global $Menu_PrivKeyGen_ecdsa3 = GUICtrlCreateMenuItem("ECDSA" & @TAB & "521bits (high)",$Menu_PrivKeyMenu)
GUICtrlCreateMenuItem("",$Menu)
Global $Menu_ReloadCfgNr = GUICtrlCreateMenuItem("Configuration Reload (N)" & @TAB & "NO WRITE / RELOAD ONLY",$Menu)
Global $Menu_ReloadCfgWr = GUICtrlCreateMenuItem("Configuration Reload (W)" & @TAB & "OVERWRITE / UPDATE",$Menu)
GUICtrlCreateMenuItem("",$Menu)
Global $Menu_ProfileRename = GUICtrlCreateMenuItem("Rename your Profile",$Menu)
Global $Menu_About = GUICtrlCreateMenu("About")
Global $Menu_About_D = GUICtrlCreateMenuItem("Devs",$Menu_About)
GUICtrlCreateMenuItem("",$Menu_About)
Global $Menu_About_T = GUICtrlCreateMenuItem("Website",$Menu_About)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Menu_About_D
TyleoAbout($CurrentName)
Case $Menu_About_T
ShellExecute("https://tyleodev.fr")
Case $Menu_PrivKeyGen_rsa2
Run("ssh-keygen")
Case $Menu_PrivKeyGen_rsa3
Run("ssh-keygen -b 3072")
Case $Menu_PrivKeyGen_rsa4
Run("ssh-keygen -b 4096")
Case $Menu_PrivKeyGen_rsa1
Run("ssh-keygen -b 1024")
Case $Menu_PrivKeyGen_ecdsa1
Run("ssh-keygen -t ecdsa -b 256")
Case $Menu_PrivKeyGen_ecdsa2
Run("ssh-keygen -t ecdsa -b 384")
Case $Menu_PrivKeyGen_ecdsa3
Run("ssh-keygen -t ecdsa -b 521")
Case $Menu_PrivKey
$KeySel = FileOpenDialog("Select Private Key",@UserProfileDir & "\.ssh","All (*)|KeyFile (*.key)|KeyFile ECDSA (*.ecdsa)",1)
$sshvt_cfg_priv = $KeySel
UpdateConfig()
Case $Menu_ProfileRename
$NewName = InputBox("PROFILE RENAME " & $CurrentName,"New Name ?",$sshvt_cfg_profile,"","",125)
$sshvt_cfg_profile = $NewName
UpdateConfig()
Case $Cmd
Run("cmd",@UserProfileDir)
Case $Pass
UpdateConfigNoReload()
Run("ssh -p " & $sshvt_cfg_port & " " & $sshvt_cfg_user & "@" & $sshvt_cfg_host)
Case $Priv
UpdateConfigNoReload()
ConsoleWrite("ssh -p " & $sshvt_cfg_port & " " & $sshvt_cfg_user & "@" & $sshvt_cfg_host & " -i" & " " & $sshvt_cfg_priv)
Run("ssh -p " & $sshvt_cfg_port & " " & $sshvt_cfg_user & "@" & $sshvt_cfg_host & " -i" & " " & $sshvt_cfg_priv)
Case $Menu_ReloadCfgNr
Reload()
Case $Menu_ReloadCfgWr
UpdateConfig()
EndSwitch
WEnd
Func UpdateConfig()
IniWrite($sshvt_config,"SSHVT","Profile Name",$sshvt_cfg_profile)
IniWrite($sshvt_config,"SSHVT","Private Key",$sshvt_cfg_priv)
$sshvt_cfg_host = GUICtrlRead($Host)
IniWrite($sshvt_config,"SSHVT","Host",$sshvt_cfg_host)
$sshvt_cfg_port = GUICtrlRead($Port)
IniWrite($sshvt_config,"SSHVT","Port",$sshvt_cfg_port)
$sshvt_cfg_user = GUICtrlRead($User)
IniWrite($sshvt_config,"SSHVT","User",$sshvt_cfg_user)
Reload()
EndFunc
Func UpdateConfigNoReload()
IniWrite($sshvt_config,"SSHVT","Profile Name",$sshvt_cfg_profile)
IniWrite($sshvt_config,"SSHVT","Private Key",$sshvt_cfg_priv)
$sshvt_cfg_host = GUICtrlRead($Host)
IniWrite($sshvt_config,"SSHVT","Host",$sshvt_cfg_host)
$sshvt_cfg_port = GUICtrlRead($Port)
IniWrite($sshvt_config,"SSHVT","Port",$sshvt_cfg_port)
$sshvt_cfg_user = GUICtrlRead($User)
IniWrite($sshvt_config,"SSHVT","User",$sshvt_cfg_user)
Return True
EndFunc
Func Reload()
Run(@AutoItExe)
Exit(0)
EndFunc