fix dependencies building, looks like i cant use the sim bc libs are compiled for ios

This commit is contained in:
neon443
2025-06-05 11:17:37 +01:00
parent 2a2ed76f58
commit 7d206478ea
92 changed files with 14342 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:PTYExample/PTYExample.xcodeproj">
</FileRef>
<FileRef
location = "group:../NMSSH-iOS.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,375 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
18221C5A1EA9080300C489F4 /* NMSSH.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18221C591EA9080300C489F4 /* NMSSH.framework */; };
18221C5B1EA9080300C489F4 /* NMSSH.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 18221C591EA9080300C489F4 /* NMSSH.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
183E6A341B38510500727F97 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 183E6A331B38510500727F97 /* Launch Screen.xib */; };
18AE8FA918BBEDD000AE0FC3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18AE8FA818BBEDD000AE0FC3 /* Foundation.framework */; };
18AE8FAB18BBEDD000AE0FC3 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18AE8FAA18BBEDD000AE0FC3 /* CoreGraphics.framework */; };
18AE8FAD18BBEDD000AE0FC3 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18AE8FAC18BBEDD000AE0FC3 /* UIKit.framework */; };
18AE8FB318BBEDD000AE0FC3 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 18AE8FB118BBEDD000AE0FC3 /* InfoPlist.strings */; };
18AE8FB518BBEDD000AE0FC3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 18AE8FB418BBEDD000AE0FC3 /* main.m */; };
18AE8FB918BBEDD100AE0FC3 /* NMAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 18AE8FB818BBEDD100AE0FC3 /* NMAppDelegate.m */; };
18AE8FBC18BBEDD100AE0FC3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 18AE8FBA18BBEDD100AE0FC3 /* Main.storyboard */; };
18AE8FBF18BBEDD100AE0FC3 /* NMViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18AE8FBE18BBEDD100AE0FC3 /* NMViewController.m */; };
18AE8FC118BBEDD100AE0FC3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 18AE8FC018BBEDD100AE0FC3 /* Images.xcassets */; };
18AE8FE018BBF0C100AE0FC3 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 18AE8FDF18BBF0C100AE0FC3 /* libz.dylib */; };
18AE8FE218BBF0C700AE0FC3 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18AE8FE118BBF0C700AE0FC3 /* CFNetwork.framework */; };
18AE8FE518BBF11B00AE0FC3 /* NMTerminalViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18AE8FE418BBF11B00AE0FC3 /* NMTerminalViewController.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
18221C5C1EA9080300C489F4 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
18221C5B1EA9080300C489F4 /* NMSSH.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
18221C591EA9080300C489F4 /* NMSSH.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = NMSSH.framework; sourceTree = BUILT_PRODUCTS_DIR; };
183E6A331B38510500727F97 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = "<group>"; };
18AE8FA518BBEDD000AE0FC3 /* PTYExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PTYExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
18AE8FA818BBEDD000AE0FC3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
18AE8FAA18BBEDD000AE0FC3 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
18AE8FAC18BBEDD000AE0FC3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
18AE8FB018BBEDD000AE0FC3 /* PTYExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "PTYExample-Info.plist"; sourceTree = "<group>"; };
18AE8FB218BBEDD000AE0FC3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
18AE8FB418BBEDD000AE0FC3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
18AE8FB618BBEDD100AE0FC3 /* PTYExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PTYExample-Prefix.pch"; sourceTree = "<group>"; };
18AE8FB718BBEDD100AE0FC3 /* NMAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NMAppDelegate.h; sourceTree = "<group>"; };
18AE8FB818BBEDD100AE0FC3 /* NMAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NMAppDelegate.m; sourceTree = "<group>"; };
18AE8FBB18BBEDD100AE0FC3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
18AE8FBD18BBEDD100AE0FC3 /* NMViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NMViewController.h; sourceTree = "<group>"; };
18AE8FBE18BBEDD100AE0FC3 /* NMViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NMViewController.m; sourceTree = "<group>"; };
18AE8FC018BBEDD100AE0FC3 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
18AE8FC718BBEDD100AE0FC3 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
18AE8FDF18BBF0C100AE0FC3 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
18AE8FE118BBF0C700AE0FC3 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
18AE8FE318BBF11B00AE0FC3 /* NMTerminalViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NMTerminalViewController.h; sourceTree = "<group>"; };
18AE8FE418BBF11B00AE0FC3 /* NMTerminalViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NMTerminalViewController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
18AE8FA218BBEDD000AE0FC3 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
18AE8FE218BBF0C700AE0FC3 /* CFNetwork.framework in Frameworks */,
18AE8FE018BBF0C100AE0FC3 /* libz.dylib in Frameworks */,
18221C5A1EA9080300C489F4 /* NMSSH.framework in Frameworks */,
18AE8FAB18BBEDD000AE0FC3 /* CoreGraphics.framework in Frameworks */,
18AE8FAD18BBEDD000AE0FC3 /* UIKit.framework in Frameworks */,
18AE8FA918BBEDD000AE0FC3 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
18AE8F9C18BBEDD000AE0FC3 = {
isa = PBXGroup;
children = (
18AE8FAE18BBEDD000AE0FC3 /* PTYExample */,
18AE8FA718BBEDD000AE0FC3 /* Frameworks */,
18AE8FA618BBEDD000AE0FC3 /* Products */,
);
sourceTree = "<group>";
};
18AE8FA618BBEDD000AE0FC3 /* Products */ = {
isa = PBXGroup;
children = (
18AE8FA518BBEDD000AE0FC3 /* PTYExample.app */,
);
name = Products;
sourceTree = "<group>";
};
18AE8FA718BBEDD000AE0FC3 /* Frameworks */ = {
isa = PBXGroup;
children = (
18221C591EA9080300C489F4 /* NMSSH.framework */,
18AE8FDF18BBF0C100AE0FC3 /* libz.dylib */,
18AE8FE118BBF0C700AE0FC3 /* CFNetwork.framework */,
18AE8FA818BBEDD000AE0FC3 /* Foundation.framework */,
18AE8FAA18BBEDD000AE0FC3 /* CoreGraphics.framework */,
18AE8FAC18BBEDD000AE0FC3 /* UIKit.framework */,
18AE8FC718BBEDD100AE0FC3 /* XCTest.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
18AE8FAE18BBEDD000AE0FC3 /* PTYExample */ = {
isa = PBXGroup;
children = (
18AE8FB718BBEDD100AE0FC3 /* NMAppDelegate.h */,
18AE8FB818BBEDD100AE0FC3 /* NMAppDelegate.m */,
183E6A331B38510500727F97 /* Launch Screen.xib */,
18AE8FBA18BBEDD100AE0FC3 /* Main.storyboard */,
18AE8FBD18BBEDD100AE0FC3 /* NMViewController.h */,
18AE8FBE18BBEDD100AE0FC3 /* NMViewController.m */,
18AE8FE318BBF11B00AE0FC3 /* NMTerminalViewController.h */,
18AE8FE418BBF11B00AE0FC3 /* NMTerminalViewController.m */,
18AE8FC018BBEDD100AE0FC3 /* Images.xcassets */,
18AE8FAF18BBEDD000AE0FC3 /* Supporting Files */,
);
path = PTYExample;
sourceTree = "<group>";
};
18AE8FAF18BBEDD000AE0FC3 /* Supporting Files */ = {
isa = PBXGroup;
children = (
18AE8FB018BBEDD000AE0FC3 /* PTYExample-Info.plist */,
18AE8FB118BBEDD000AE0FC3 /* InfoPlist.strings */,
18AE8FB418BBEDD000AE0FC3 /* main.m */,
18AE8FB618BBEDD100AE0FC3 /* PTYExample-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
18AE8FA418BBEDD000AE0FC3 /* PTYExample */ = {
isa = PBXNativeTarget;
buildConfigurationList = 18AE8FD718BBEDD100AE0FC3 /* Build configuration list for PBXNativeTarget "PTYExample" */;
buildPhases = (
18AE8FA118BBEDD000AE0FC3 /* Sources */,
18AE8FA218BBEDD000AE0FC3 /* Frameworks */,
18AE8FA318BBEDD000AE0FC3 /* Resources */,
18221C5C1EA9080300C489F4 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = PTYExample;
productName = PTYExample;
productReference = 18AE8FA518BBEDD000AE0FC3 /* PTYExample.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
18AE8F9D18BBEDD000AE0FC3 /* Project object */ = {
isa = PBXProject;
attributes = {
CLASSPREFIX = NM;
LastUpgradeCheck = 0830;
ORGANIZATIONNAME = "Nine Muses";
};
buildConfigurationList = 18AE8FA018BBEDD000AE0FC3 /* Build configuration list for PBXProject "PTYExample" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 18AE8F9C18BBEDD000AE0FC3;
productRefGroup = 18AE8FA618BBEDD000AE0FC3 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
18AE8FA418BBEDD000AE0FC3 /* PTYExample */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
18AE8FA318BBEDD000AE0FC3 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
18AE8FC118BBEDD100AE0FC3 /* Images.xcassets in Resources */,
183E6A341B38510500727F97 /* Launch Screen.xib in Resources */,
18AE8FB318BBEDD000AE0FC3 /* InfoPlist.strings in Resources */,
18AE8FBC18BBEDD100AE0FC3 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
18AE8FA118BBEDD000AE0FC3 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
18AE8FBF18BBEDD100AE0FC3 /* NMViewController.m in Sources */,
18AE8FB518BBEDD000AE0FC3 /* main.m in Sources */,
18AE8FB918BBEDD100AE0FC3 /* NMAppDelegate.m in Sources */,
18AE8FE518BBF11B00AE0FC3 /* NMTerminalViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
18AE8FB118BBEDD000AE0FC3 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
18AE8FB218BBEDD000AE0FC3 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
18AE8FBA18BBEDD100AE0FC3 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
18AE8FBB18BBEDD100AE0FC3 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
18AE8FD518BBEDD100AE0FC3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
18AE8FD618BBEDD100AE0FC3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
18AE8FD818BBEDD100AE0FC3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
DEVELOPMENT_TEAM = "";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PTYExample/PTYExample-Prefix.pch";
INFOPLIST_FILE = "PTYExample/PTYExample-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "se.ninemuses.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
18AE8FD918BBEDD100AE0FC3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
DEVELOPMENT_TEAM = "";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PTYExample/PTYExample-Prefix.pch";
INFOPLIST_FILE = "PTYExample/PTYExample-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "se.ninemuses.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
18AE8FA018BBEDD000AE0FC3 /* Build configuration list for PBXProject "PTYExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
18AE8FD518BBEDD100AE0FC3 /* Debug */,
18AE8FD618BBEDD100AE0FC3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
18AE8FD718BBEDD100AE0FC3 /* Build configuration list for PBXNativeTarget "PTYExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
18AE8FD818BBEDD100AE0FC3 /* Debug */,
18AE8FD918BBEDD100AE0FC3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 18AE8F9D18BBEDD000AE0FC3 /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:PTYExample.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="FFG-Nw-qqH">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
<scene sceneID="IRZ-Nc-OdO">
<objects>
<navigationController definesPresentationContext="YES" id="FFG-Nw-qqH" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="7HS-aM-dfR">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="vXZ-lx-hvc" kind="relationship" relationship="rootViewController" id="nxf-jZ-FIf"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Imc-TS-SCT" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-689" y="-54"/>
</scene>
<!--NMSSH Example-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="NMViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="K8b-9K-nFW"/>
<viewControllerLayoutGuide type="bottom" id="Dac-hY-bze"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Host:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gHf-nl-Wxn">
<rect key="frame" x="20" y="77" width="280" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="7xk-ui-yFT"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="utH-V5-mhW">
<rect key="frame" x="20" y="106" width="280" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="hostend:" destination="vXZ-lx-hvc" eventType="editingDidEndOnExit" id="QfS-Gy-CNd"/>
<action selector="hostend:" destination="vXZ-lx-hvc" eventType="editingDidEnd" id="Xk0-Xs-aGB"/>
</connections>
</textField>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Username:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4QY-Xj-CSz">
<rect key="frame" x="20" y="144" width="280" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="k3O-Ty-hS8"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="ctE-X4-ljr">
<rect key="frame" x="20" y="173" width="280" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="usernameend:" destination="vXZ-lx-hvc" eventType="editingDidEndOnExit" id="MoF-zp-IEA"/>
</connections>
</textField>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Password:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kv4-jy-zIz">
<rect key="frame" x="20" y="211" width="280" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="eyf-eF-N9d"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="efG-PA-3AY">
<rect key="frame" x="20" y="240" width="280" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="passwordend:" destination="vXZ-lx-hvc" eventType="editingDidEndOnExit" id="dea-6b-Chs"/>
</connections>
</textField>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="dwy-YR-1OQ">
<rect key="frame" x="20" y="307" width="280" height="29"/>
<segments>
<segment title="Password"/>
<segment title="Keyboard-Interactive"/>
</segments>
<color key="tintColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<action selector="authentication:" destination="vXZ-lx-hvc" eventType="valueChanged" id="Q4U-S5-FDG"/>
</connections>
</segmentedControl>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Authentication:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZkA-Hc-las">
<rect key="frame" x="20" y="278" width="280" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="Y6t-uj-yAL"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="efG-PA-3AY" firstAttribute="trailing" secondItem="kv4-jy-zIz" secondAttribute="trailing" id="0EY-kj-kxh"/>
<constraint firstItem="4QY-Xj-CSz" firstAttribute="leading" secondItem="ctE-X4-ljr" secondAttribute="leading" id="1JK-7W-ft0"/>
<constraint firstItem="ZkA-Hc-las" firstAttribute="leading" secondItem="dwy-YR-1OQ" secondAttribute="leading" id="28g-fj-6Pc"/>
<constraint firstItem="ZkA-Hc-las" firstAttribute="trailing" secondItem="dwy-YR-1OQ" secondAttribute="trailing" id="6kb-Gx-WpQ"/>
<constraint firstItem="gHf-nl-Wxn" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leading" constant="20" id="ADk-OC-EJq"/>
<constraint firstItem="4QY-Xj-CSz" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leading" constant="20" id="BIf-qd-SmU"/>
<constraint firstItem="gHf-nl-Wxn" firstAttribute="leading" secondItem="utH-V5-mhW" secondAttribute="leading" id="Dkf-qW-vgb"/>
<constraint firstItem="efG-PA-3AY" firstAttribute="top" secondItem="kv4-jy-zIz" secondAttribute="bottom" constant="8" id="F8o-HB-LJA"/>
<constraint firstItem="ctE-X4-ljr" firstAttribute="top" secondItem="4QY-Xj-CSz" secondAttribute="bottom" constant="8" id="G1b-wh-Oey"/>
<constraint firstItem="kv4-jy-zIz" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leading" constant="20" id="GBG-x3-DL8"/>
<constraint firstItem="4QY-Xj-CSz" firstAttribute="top" secondItem="utH-V5-mhW" secondAttribute="bottom" constant="8" id="Kpu-6c-hsO"/>
<constraint firstAttribute="trailing" secondItem="ZkA-Hc-las" secondAttribute="trailing" constant="20" id="L7x-8G-CZt"/>
<constraint firstItem="ZkA-Hc-las" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leading" constant="20" id="Nga-ut-Vqs"/>
<constraint firstItem="utH-V5-mhW" firstAttribute="top" secondItem="gHf-nl-Wxn" secondAttribute="bottom" constant="8" id="Rb1-H8-n9X"/>
<constraint firstItem="efG-PA-3AY" firstAttribute="leading" secondItem="kv4-jy-zIz" secondAttribute="leading" id="SLu-DP-MVW"/>
<constraint firstItem="kv4-jy-zIz" firstAttribute="top" secondItem="ctE-X4-ljr" secondAttribute="bottom" constant="8" id="Wwh-jx-wYd"/>
<constraint firstItem="gHf-nl-Wxn" firstAttribute="trailing" secondItem="utH-V5-mhW" secondAttribute="trailing" id="YHf-2q-HLq"/>
<constraint firstItem="4QY-Xj-CSz" firstAttribute="trailing" secondItem="ctE-X4-ljr" secondAttribute="trailing" id="bSS-bu-9AC"/>
<constraint firstItem="ZkA-Hc-las" firstAttribute="top" secondItem="efG-PA-3AY" secondAttribute="bottom" constant="8" id="cef-pk-nHF"/>
<constraint firstAttribute="trailing" secondItem="4QY-Xj-CSz" secondAttribute="trailing" constant="20" id="gNO-Z1-fzq"/>
<constraint firstItem="gHf-nl-Wxn" firstAttribute="top" secondItem="K8b-9K-nFW" secondAttribute="bottom" constant="13" id="h0k-N3-2gZ"/>
<constraint firstItem="dwy-YR-1OQ" firstAttribute="top" secondItem="ZkA-Hc-las" secondAttribute="bottom" constant="8" id="qrX-Nh-H0r"/>
<constraint firstAttribute="trailing" secondItem="gHf-nl-Wxn" secondAttribute="trailing" constant="20" id="suc-4e-sZy"/>
<constraint firstAttribute="trailing" secondItem="kv4-jy-zIz" secondAttribute="trailing" constant="20" id="vZ3-E1-q9v"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="NMSSH Example" id="PC6-EQ-vMq">
<barButtonItem key="rightBarButtonItem" title="Login" id="tfx-Qe-Jrm">
<connections>
<action selector="login:" destination="vXZ-lx-hvc" id="t6x-he-Gg8"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="authenticationControl" destination="dwy-YR-1OQ" id="50B-sU-ewp"/>
<outlet property="hostField" destination="utH-V5-mhW" id="LYc-cV-lxM"/>
<outlet property="passwordField" destination="efG-PA-3AY" id="WB1-cE-8cB"/>
<outlet property="usernameField" destination="ctE-X4-ljr" id="A3s-fz-bZM"/>
<segue destination="PW5-B9-Jky" kind="push" identifier="loginSegue" id="Wz8-8w-Se2"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-162" y="-54"/>
</scene>
<!--Terminal View Controller-->
<scene sceneID="1Gj-GQ-1ed">
<objects>
<viewController id="PW5-B9-Jky" customClass="NMTerminalViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="nx7-Ow-OqW"/>
<viewControllerLayoutGuide type="bottom" id="r8D-UH-Rm6"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="p0y-g1-cTe">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Mx3-3h-dTj">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" name="Menlo-Regular" family="Menlo" pointSize="10"/>
<textInputTraits key="textInputTraits" autocorrectionType="no"/>
<connections>
<outlet property="delegate" destination="PW5-B9-Jky" id="NVw-Ar-T2s"/>
</connections>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="G5k-Sr-spF">
<barButtonItem key="leftBarButtonItem" title="Disconnect" id="UaD-oB-vbm">
<connections>
<action selector="disconnect:" destination="PW5-B9-Jky" id="wUc-Zq-UwC"/>
</connections>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" title="Connect" id="SwZ-yZ-J1g">
<connections>
<action selector="connect:" destination="PW5-B9-Jky" id="m1q-Cf-DXP"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="textView" destination="Mx3-3h-dTj" id="gYK-dG-IxF"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="b8S-y0-PxV" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="300" y="-54"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

View File

@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,23 @@
{
"images" : [
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"subtype" : "retina4",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 Nine Muses. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
<variation key="widthClass=compact">
<fontDescription key="fontDescription" type="system" pointSize="11"/>
</variation>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PTYExample" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="Kid-kn-2rF"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="404" y="445"/>
</view>
</objects>
</document>

View File

@@ -0,0 +1,7 @@
#import <UIKit/UIKit.h>
@interface NMAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

View File

@@ -0,0 +1,43 @@
#import "NMAppDelegate.h"
@implementation NMAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"host": @"",
@"username": @"",
@"auth": @(0) }];
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end

View File

@@ -0,0 +1,13 @@
#import <UIKit/UIKit.h>
@interface NMTerminalViewController : UIViewController <UITextViewDelegate>
@property (nonatomic, strong) NSString *host;
@property (nonatomic, strong) NSString *username;
@property (nonatomic, strong) NSString *password;
@property (nonatomic) IBOutlet UITextView *textView;
- (IBAction)connect:(id)sender;
- (IBAction)disconnect:(id)sender;
@end

View File

@@ -0,0 +1,218 @@
#import "NMTerminalViewController.h"
#import <NMSSH/NMSSH.h>
@interface NMTerminalViewController () <NMSSHSessionDelegate, NMSSHChannelDelegate>
@property (nonatomic, strong) dispatch_queue_t sshQueue;
@property (nonatomic, strong) NMSSHSession *session;
@property (nonatomic, assign) dispatch_once_t onceToken;
@property (nonatomic, strong) dispatch_semaphore_t semaphore;
@property (nonatomic, strong) NSMutableString *lastCommand;
@property (nonatomic, assign) BOOL keyboardInteractive;
@end
@implementation NMTerminalViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.keyboardInteractive = self.password == nil;
self.textView.editable = NO;
self.textView.selectable = NO;
self.lastCommand = [[NSMutableString alloc] init];
self.sshQueue = dispatch_queue_create("NMSSH.queue", DISPATCH_QUEUE_SERIAL);
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
dispatch_once(&_onceToken, ^{
[self connect:self];
});
}
- (IBAction)connect:(id)sender {
dispatch_async(self.sshQueue, ^{
self.session = [NMSSHSession connectToHost:self.host withUsername:self.username];
self.session.delegate = self;
if (!self.session.connected) {
dispatch_async(dispatch_get_main_queue(), ^{
[self appendToTextView:@"Connection error"];
});
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
[self appendToTextView:[NSString stringWithFormat:@"ssh %@@%@\n", self.session.username, self.host]];
});
if (self.keyboardInteractive) {
[self.session authenticateByKeyboardInteractive];
}
else {
[self.session authenticateByPassword:self.password];
}
if (!self.session.authorized) {
dispatch_async(dispatch_get_main_queue(), ^{
[self appendToTextView:@"Authentication error\n"];
self.textView.editable = NO;
});
}
else {
dispatch_async(dispatch_get_main_queue(), ^{
self.textView.editable = YES;
});
self.session.channel.delegate = self;
self.session.channel.requestPty = YES;
NSError *error;
[self.session.channel startShell:&error];
if (error) {
dispatch_async(dispatch_get_main_queue(), ^{
[self appendToTextView:error.localizedDescription];
self.textView.editable = NO;
});
}
}
});
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[self.textView resignFirstResponder];
}
- (IBAction)disconnect:(id)sender {
dispatch_async(self.sshQueue, ^{
[self.session disconnect];
});
}
- (void)appendToTextView:(NSString *)text {
self.textView.text = [NSString stringWithFormat:@"%@%@", self.textView.text, text];
[self.textView scrollRangeToVisible:NSMakeRange([self.textView.text length] - 1, 1)];
}
- (void)performCommand {
if (self.semaphore) {
self.password = [self.lastCommand substringToIndex:MAX(0, self.lastCommand.length - 1)];
dispatch_semaphore_signal(self.semaphore);
}
else {
NSString *command = [self.lastCommand copy];
dispatch_async(self.sshQueue, ^{
[[self.session channel] write:command error:nil timeout:@10];
});
}
[self.lastCommand setString:@""];
}
- (void)channel:(NMSSHChannel *)channel didReadData:(NSString *)message {
NSString *msg = [message copy];
dispatch_async(dispatch_get_main_queue(), ^{
[self appendToTextView:msg];
});
}
- (void)channel:(NMSSHChannel *)channel didReadError:(NSString *)error {
dispatch_async(dispatch_get_main_queue(), ^{
[self appendToTextView:[NSString stringWithFormat:@"[ERROR] %@", error]];
});
}
- (void)channelShellDidClose:(NMSSHChannel *)channel {
dispatch_async(dispatch_get_main_queue(), ^{
[self appendToTextView:@"\nShell closed\n"];
self.textView.editable = NO;
});
}
- (NSString *)session:(NMSSHSession *)session keyboardInteractiveRequest:(NSString *)request {
dispatch_async(dispatch_get_main_queue(), ^{
[self appendToTextView:request];
self.textView.editable = YES;
});
self.semaphore = dispatch_semaphore_create(0);
dispatch_semaphore_wait(self.semaphore, DISPATCH_TIME_FOREVER);
self.semaphore = nil;
return self.password;
}
- (void)session:(NMSSHSession *)session didDisconnectWithError:(NSError *)error {
dispatch_async(dispatch_get_main_queue(), ^{
[self appendToTextView:[NSString stringWithFormat:@"\nDisconnected with error: %@", error.localizedDescription]];
self.textView.editable = NO;
});
}
- (void)textViewDidChange:(UITextView *)textView {
[textView scrollRangeToVisible:NSMakeRange([textView.text length] - 1, 1)];
}
- (void)textViewDidChangeSelection:(UITextView *)textView {
if (textView.selectedRange.location < textView.text.length - self.lastCommand.length - 1) {
textView.selectedRange = NSMakeRange([textView.text length], 0);
}
}
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
if (text.length == 0) {
if ([self.lastCommand length] > 0) {
[self.lastCommand replaceCharactersInRange:NSMakeRange(self.lastCommand.length-1, 1) withString:@""];
return YES;
}
else {
return NO;
}
}
[self.lastCommand appendString:text];
if ([text isEqualToString:@"\n"]) {
[self performCommand];
}
return YES;
}
- (void)keyboardWillShow:(NSNotification *)notification {
NSDictionary *userInfo = [notification userInfo];
CGRect keyboardFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGRect ownFrame = [[[[UIApplication sharedApplication] delegate] window] convertRect:self.textView.frame fromView:self.textView.superview];
CGRect coveredFrame = CGRectIntersection(ownFrame, keyboardFrame);
coveredFrame = [[[[UIApplication sharedApplication] delegate] window] convertRect:coveredFrame toView:self.textView.superview];
self.textView.contentInset = UIEdgeInsetsMake(self.textView.contentInset.top, 0, coveredFrame.size.height, 0);
self.textView.scrollIndicatorInsets = self.textView.contentInset;
}
- (void)keyboardWillHide:(NSNotification *)notification {
self.textView.contentInset = UIEdgeInsetsMake(self.textView.contentInset.top, 0, 0, 0);
self.textView.scrollIndicatorInsets = self.textView.contentInset;
}
@end

View File

@@ -0,0 +1,13 @@
#import <UIKit/UIKit.h>
@interface NMViewController : UIViewController
@property (nonatomic) IBOutlet UITextField *hostField;
@property (nonatomic) IBOutlet UITextField *usernameField;
@property (nonatomic) IBOutlet UITextField *passwordField;
@property (nonatomic) IBOutlet UISegmentedControl *authenticationControl;
- (IBAction)login:(id)sender;
- (IBAction)authentication:(id)sender;
@end

View File

@@ -0,0 +1,74 @@
#import "NMViewController.h"
#import "NMTerminalViewController.h"
@interface NMViewController ()
@end
@implementation NMViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.hostField.text = [[NSUserDefaults standardUserDefaults] stringForKey:@"host"];
self.usernameField.text = [[NSUserDefaults standardUserDefaults] stringForKey:@"username"];
self.authenticationControl.selectedSegmentIndex = [[NSUserDefaults standardUserDefaults] integerForKey:@"auth"];
}
- (IBAction)hostend:(id)sender {
[self.hostField resignFirstResponder];
}
- (IBAction)usernameend:(id)sender {
[self.usernameField resignFirstResponder];
}
- (IBAction)passwordend:(id)sender {
[self.passwordField resignFirstResponder];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[self.hostField resignFirstResponder];
[self.usernameField resignFirstResponder];
[self.passwordField resignFirstResponder];
}
- (IBAction)authentication:(id)sender {
self.passwordField.enabled = self.authenticationControl.selectedSegmentIndex == 0;
}
- (IBAction)login:(id)sender {
if (self.hostField.text.length == 0 || self.usernameField.text.length == 0 || (self.authenticationControl.selectedSegmentIndex == 0 && self.passwordField.text.length == 0)) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"All fields are required!"
delegate:Nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
else {
[self performSegueWithIdentifier:@"loginSegue" sender:self];
}
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"loginSegue"]) {
[[NSUserDefaults standardUserDefaults] setObject:self.hostField.text forKey:@"host"];
[[NSUserDefaults standardUserDefaults] setObject:self.usernameField.text forKey:@"username"];
[[NSUserDefaults standardUserDefaults] setObject:@(self.authenticationControl.selectedSegmentIndex) forKey:@"auth"];
NMTerminalViewController *terminalController = [segue destinationViewController];
terminalController.host = self.hostField.text;
terminalController.username = self.usernameField.text;
if (self.authenticationControl.selectedSegmentIndex == 0) {
terminalController.password = self.passwordField.text;
}
else {
terminalController.password = nil;
}
}
}
@end

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>Launch Screen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,16 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

View File

@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

View File

@@ -0,0 +1,10 @@
#import <UIKit/UIKit.h>
#import "NMAppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([NMAppDelegate class]));
}
}