{"id":30948242,"url":"https://github.com/sshterm/ssh","last_synced_at":"2026-01-17T17:28:12.710Z","repository":{"id":253806377,"uuid":"844581859","full_name":"sshterm/ssh","owner":"sshterm","description":"libssh2 + OpenSSL + wolfSSL 的swift实现","archived":false,"fork":false,"pushed_at":"2025-01-21T03:27:56.000Z","size":64347,"stargazers_count":99,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-11T03:58:41.107Z","etag":null,"topics":["libssh2","openssl","wolfssl"],"latest_commit_sha":null,"homepage":"https://ssh2.app/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sshterm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-19T14:49:26.000Z","updated_at":"2025-09-03T08:06:03.000Z","dependencies_parsed_at":"2025-01-09T18:37:48.660Z","dependency_job_id":"da0159a7-6f5d-4b87-bd4c-7ed0768332b5","html_url":"https://github.com/sshterm/ssh","commit_stats":null,"previous_names":["sshterm/ssh"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/sshterm/ssh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshterm%2Fssh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshterm%2Fssh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshterm%2Fssh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshterm%2Fssh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sshterm","download_url":"https://codeload.github.com/sshterm/ssh/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshterm%2Fssh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28512905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["libssh2","openssl","wolfssl"],"created_at":"2025-09-11T02:02:19.770Z","updated_at":"2026-01-17T17:28:12.693Z","avatar_url":"https://github.com/sshterm.png","language":"Swift","readme":"SSH Term APP will adopt a refactored core from version 7.0 onwards.\n\n[https://github.com/sshterm/ssh2](https://github.com/sshterm/ssh2)\n\n# ssh2\nSwift + libssh2 + OpenSSL\n\n\n# Swift Package Manager\n\nThe Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. Once you have your Swift package set up, adding SSH as a dependency is as easy as adding it to the dependencies value of your Package.swift.\n\n```swift\n.package(url: \"https://github.com/sshterm/ssh2.git\", branch: \"main\")\n```\n\n```swift\n.product(name: \"SSH2\", package: \"SSH2\"),\n.product(name: \"GeoLite2\", package: \"SSH2\"),\n.product(name: \"DNS\", package: \"SSH2\")\n```\n\n# Demo\n```swift\nimport SSH\nimport GeoLite2\nimport Crypto\nimport DNS\n\nDNS.shared.requireEncrypted(PubDNS.alidns.dohConfiguration)\n\nprint(SSH.version,SSH.libssh2_version)\n\nlet ssh = SSH(host: \"openwrt.local\", port: \"22\", user: \"root\")\nssh.trace = [.auth]\nprint(await ssh.checkActive())\nprint(await ssh.connect())\nprint(await ssh.handshake())\nprint(await ssh.authenticate(password: \"openwrt\"))\nprint(ssh.clientbanner)\nprint(ssh.serverbanner)\nprint(ssh.fingerprint(.md5))\n\nlet max = MaxMind.shared\nDNS.shared.resolveDomainName(\"ssh2.app\").forEach{print($0,$0.isLanIP,max.lookupIsoCode($0))}\n\nlet key = Crypto.shared.generateED25519()\nprint(key?.pubKeySSH)\nprint(key?.privKeyPEM)\nprint(key?.pubKeyPEM)\n```\n\n# ssh\nlibssh2 + OpenSSL + wolfSSL 的swift实现\n\nSSH Term APP [ssh2.app](https://ssh2.app/) 的 SSH2连接核心\n\n全中文注释\n\n# 使用 OpenSSL 版\n协议全，推荐\n\n### 不包括libssl，占用空间小\n```\npod 'CSSH/OpenSSL', :git =\u003e 'https://github.com/sshterm/cssh.git'\npod 'SSH/OpenSSL', :git =\u003e 'https://github.com/sshterm/ssh.git'\n```\n\n### 使用完整的OpenSSL包括libssl\n```\npod 'CSSH/OpenSSLFull', :git =\u003e 'https://github.com/sshterm/cssh.git'\npod 'SSH/OpenSSLFull', :git =\u003e 'https://github.com/sshterm/ssh.git'\n```\n\n# 使用 wolfSSL 版\n协议少，不支持ED25519等，适合轻量级应用\n```\npod 'CSSH/wolfSSL', :git =\u003e 'https://github.com/sshterm/cssh.git'\npod 'SSH/wolfSSL', :git =\u003e 'https://github.com/sshterm/ssh.git'\n```\n\n# 关于libssh2\n\nhttps://github.com/libssh2/libssh2\n\n# 关于OpenSSL\n\nhttps://github.com/openssl/openssl\n\n# 关于wolfSSL\n\nhttps://github.com/wolfSSL/wolfssl\n\n# 业务说明\n    src/ SSH2业务\n    src/DNS/ DNS加密业务\n    src/Crypto/ 哈希加密业务，包括证书生存等\n    src/Machine/ Linux服务器状态查询业务\n\n\n# Demo\n\n### 加密DNS\n```swift\n//启动DNS 会自动加密APP的所有DNS请求\nDNS.shared.requireEncrypted(.alidns, type: .doh)\n```\n\n### SSH2连接\n```swift\n//创建SSH\n let ssh = SSH(host:  \"10.0.0.1\", port: 22, user: \"root\", timeout: 5)\n//设置插座\n ssh.sessionDelegate = delegate\n //连接\n await ssh.connect()\n //握手\n await sh.handshake()\n //认证 更多方式 请参考 Auth.swift 的函数注释\n await ssh.authenticate(password: \"\u003cPASSWORD\u003e\")\n```\n\n具体函数用法请参考 代码注释","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshterm%2Fssh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsshterm%2Fssh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshterm%2Fssh/lists"}