diff --git a/ShhShell.pxd b/ShhShell.pxd index ede140f..b576bdd 100644 Binary files a/ShhShell.pxd and b/ShhShell.pxd differ diff --git a/ShhShell.xcodeproj/project.pbxproj b/ShhShell.xcodeproj/project.pbxproj index a16d175..c0d24a6 100644 --- a/ShhShell.xcodeproj/project.pbxproj +++ b/ShhShell.xcodeproj/project.pbxproj @@ -503,7 +503,7 @@ INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 18; + IPHONEOS_DEPLOYMENT_TARGET = 16; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -533,7 +533,7 @@ INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 18; + IPHONEOS_DEPLOYMENT_TARGET = 16; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/ShhShell/SSHHandler.swift b/ShhShell/SSHHandler.swift index a99a5df..5bc065f 100644 --- a/ShhShell/SSHHandler.swift +++ b/ShhShell/SSHHandler.swift @@ -268,6 +268,8 @@ class SSHHandler: ObservableObject { private func interactiveShellSession(channel: ssh_channel) { var status: CInt + var buffer: [CChar] = Array(repeating: 0, count: 256) + var nbytes: CInt = 0 status = ssh_channel_request_pty(channel) guard status == SSH_OK else { return } @@ -277,9 +279,23 @@ class SSHHandler: ObservableObject { status = ssh_channel_request_shell(channel) guard status == SSH_OK else { return } + +// Task { + while (ssh_channel_is_open(channel) != 0) && (ssh_channel_is_eof(channel) == 0) { + nbytes = ssh_channel_read(channel, &buffer, UInt32(MemoryLayout.size(ofValue: buffer)), 0) + if nbytes < 0 { + return + } + if nbytes > 0 { + write(1, buffer, Int(nbytes)) + } + sleep(1) + } +// } + print(String(utf8String: buffer)) } - func logSshGetError() { + private func logSshGetError() { logger.critical("\(String(cString: ssh_get_error(&self.session)))") } } diff --git a/ShhShell/ShhShellApp.swift b/ShhShell/ShhShellApp.swift index 33c0c61..6cd771e 100644 --- a/ShhShell/ShhShellApp.swift +++ b/ShhShell/ShhShellApp.swift @@ -11,10 +11,9 @@ import SwiftUI struct ShhShellApp: App { @StateObject var sshHandler: SSHHandler = SSHHandler(username: "", password: "") - var body: some Scene { - WindowGroup { - ContentView(handler: sshHandler) - } - .windowResizability(.contentMinSize) - } + var body: some Scene { + WindowGroup { + ContentView(handler: sshHandler) + } + } } diff --git a/ShhShell/Views/ContentView.swift b/ShhShell/Views/ContentView.swift index a0ff550..6783f7d 100644 --- a/ShhShell/Views/ContentView.swift +++ b/ShhShell/Views/ContentView.swift @@ -71,10 +71,10 @@ struct ContentView: View { } } .disabled(!(connected && handler.authorized)) - - Button("request a shell") { - handler.openShell() - } +// +// Button("request a shell") { +// handler.openShell() +// } } } }