mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
add read from channel
remove button for appstore connect submission lower ios version update icon to remove transparency
This commit is contained in:
BIN
ShhShell.pxd
BIN
ShhShell.pxd
Binary file not shown.
@@ -503,7 +503,7 @@
|
|||||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 18;
|
IPHONEOS_DEPLOYMENT_TARGET = 16;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
@@ -533,7 +533,7 @@
|
|||||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 18;
|
IPHONEOS_DEPLOYMENT_TARGET = 16;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
|||||||
@@ -268,6 +268,8 @@ class SSHHandler: ObservableObject {
|
|||||||
|
|
||||||
private func interactiveShellSession(channel: ssh_channel) {
|
private func interactiveShellSession(channel: ssh_channel) {
|
||||||
var status: CInt
|
var status: CInt
|
||||||
|
var buffer: [CChar] = Array(repeating: 0, count: 256)
|
||||||
|
var nbytes: CInt = 0
|
||||||
|
|
||||||
status = ssh_channel_request_pty(channel)
|
status = ssh_channel_request_pty(channel)
|
||||||
guard status == SSH_OK else { return }
|
guard status == SSH_OK else { return }
|
||||||
@@ -277,9 +279,23 @@ class SSHHandler: ObservableObject {
|
|||||||
|
|
||||||
status = ssh_channel_request_shell(channel)
|
status = ssh_channel_request_shell(channel)
|
||||||
guard status == SSH_OK else { return }
|
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)))")
|
logger.critical("\(String(cString: ssh_get_error(&self.session)))")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,9 @@ import SwiftUI
|
|||||||
struct ShhShellApp: App {
|
struct ShhShellApp: App {
|
||||||
@StateObject var sshHandler: SSHHandler = SSHHandler(username: "", password: "")
|
@StateObject var sshHandler: SSHHandler = SSHHandler(username: "", password: "")
|
||||||
|
|
||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
WindowGroup {
|
WindowGroup {
|
||||||
ContentView(handler: sshHandler)
|
ContentView(handler: sshHandler)
|
||||||
}
|
}
|
||||||
.windowResizability(.contentMinSize)
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,10 +71,10 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.disabled(!(connected && handler.authorized))
|
.disabled(!(connected && handler.authorized))
|
||||||
|
//
|
||||||
Button("request a shell") {
|
// Button("request a shell") {
|
||||||
handler.openShell()
|
// handler.openShell()
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user