Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/TerminalStudio/dartssh2 i…
Browse files Browse the repository at this point in the history
  • Loading branch information
obemu committed Nov 5, 2024
2 parents ae443a5 + 104910b commit e989fff
Show file tree
Hide file tree
Showing 70 changed files with 1,454 additions and 300 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "pub"
directory: "/"
schedule:
interval: "weekly"
time: "09:00"
timezone: Europe/Madrid
20 changes: 11 additions & 9 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Dart

on:
push:
branches: [master]
pull_request:
branches: [master]
on: push

jobs:
test:
Expand All @@ -13,11 +9,10 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
# sdk: [stable, beta, dev, 2.10.3, 2.12.0-29.10.beta]
sdk: [stable, dev]
sdk: [stable]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}
Expand All @@ -43,4 +38,11 @@ jobs:
run: dart pub global run coverage:test_with_coverage

- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true # optional (default = false)
files: ./coverage1.xml,./coverage2.xml # optional
flags: unittests # optional
name: codecov-umbrella # optional
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [3.0.1] - 2024-11-05
- Merged with 104910b1bde52ea304bffaa97d6f2487353c974d from https://github.com/TerminalStudio/dartssh2.git

## [3.0.0] - 2024-08-13

- Changed version constraints for package `pinenacl` from `^0.5.0` to `">=0.5.0 <1.0.0"` to support Dart SDK `>= 3.5.0`. See Dart SDK [Changelog](https://github.com/dart-lang/sdk/blob/3ccadc5c277a6c70f207d14600524578f4c527ad/CHANGELOG.md?plain=1#L106).
Expand Down Expand Up @@ -168,6 +171,11 @@

- Initial release.

[#101]: https://github.com/TerminalStudio/dartssh2/pull/101
[#100]: https://github.com/TerminalStudio/dartssh2/issues/100
[#80]: https://github.com/TerminalStudio/dartssh2/issues/80
[#71]: https://github.com/TerminalStudio/dartssh2/issues/71
[#50]: https://github.com/TerminalStudio/dartssh2/issues/50
[#24]: https://github.com/TerminalStudio/dartssh2/issues/24
[#21]: https://github.com/TerminalStudio/dartssh2/issues/21
[#18]: https://github.com/TerminalStudio/dartssh2/issues/18
Expand All @@ -177,4 +185,4 @@

[@linhanyu]: https://github.com/linhanyu
[@Migarl]: https://github.com/Migarl
[@PIDAMI]: https://github.com/PIDAMI
[@PIDAMI]: https://github.com/PIDAMI
118 changes: 63 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
<!-- Title-->
<p align="center">
<h1 align="center">DartSSH 3</h1>
</p>
<h1 style="text-align: center;">DartSSH 3</h1>

<!-- Badges-->
<p align="center">
<p style="text-align: center;">
<a href="https://pub.dartlang.org/packages/dartssh3">
<img src="https://img.shields.io/pub/v/dartssh3.svg">
<img src="https://img.shields.io/pub/v/dartssh3.svg" alt="">
</a>
<a href="https://pub.dev/packages/dartssh3">
<img src="https://img.shields.io/pub/popularity/dartssh3?logo=dart">
<img src="https://img.shields.io/pub/popularity/dartssh3?logo=dart" alt="">
</a>
<a href="https://pub.dev/documentation/dartssh3/latest/">
<img src="https://img.shields.io/badge/Docs-dartssh3-blue.svg">
<a href="https://www.dartdocs.org/documentation/dartssh3/latest/">
<img src="https://img.shields.io/badge/Docs-dartssh3-blue.svg" alt="">
</a>
<!-- <a href="https://github.com/TerminalStudio/dartssh2/actions/workflows/dart.yml">
<img src="https://github.com/TerminalStudio/dartssh2/actions/workflows/dart.yml/badge.svg">
</a> -->
<!--<a href="https://github.com/TerminalStudio/dartssh2/actions/workflows/dart.yml">-->
<!--<img src="https://github.com/TerminalStudio/dartssh2/actions/workflows/dart.yml/badge.svg" alt="">-->
<!--</a>-->
</p>

<p align="center">
<p style="text-align: center;">
SSH and SFTP client written in pure Dart, aiming to be feature-rich as well as easy to use.
</p>

Expand All @@ -38,29 +36,39 @@ SSH and SFTP client written in pure Dart, aiming to be feature-rich as well as e
<table>
<tr>
<!-- ServerBox -->
<td align="center">
<td style="text-align: center;">
<b><a href="https://github.com/LollipopKit/flutter_server_box">ServerBox</a></b>
</td>
<!-- Ssh! No Ports -->
<td align="center">
<td style="text-align: center;">
<b><a href="https://github.com/atsign-foundation/sshnoports">Ssh! No Ports</a></b>
</td>
<!-- dartShell -->
<td style="text-align: center;">
<b><a href="https://github.com/hsduren/dartshell">DartShell</a></b>
</td>
</tr>

<tr>
<!-- ServerBox -->
<td>
<img src="https://raw.githubusercontent.com/TerminalStudio/dartssh2/master/media/showcase-1-serverbox.1.jpg" width="150px">
<img src="https://raw.githubusercontent.com/TerminalStudio/dartssh2/master/media/showcase-1-serverbox.2.png" width="150px">
<img src="https://raw.githubusercontent.com/obemu/dartssh3/master/media/showcase-1-serverbox.1.jpg" width="150px" alt="ServerBox interface displaying connection management options">
<img src="https://raw.githubusercontent.com/obemu/dartssh3/master/media/showcase-1-serverbox.2.png" width="150px" alt="ServerBox user interface for server control and monitoring">
</td>
<!-- Ssh! No Ports -->
<td>
<a href="https://asciinema.org/a/496148">
<img src="https://user-images.githubusercontent.com/6131216/185263634-07e8dba7-b5a8-44fc-ac44-8703e247143f.png" width="300px">
<img src="https://user-images.githubusercontent.com/6131216/185263634-07e8dba7-b5a8-44fc-ac44-8703e247143f.png" width="300px" alt="Ssh! No Ports demo showcasing SSH connectivity without open ports">
</a>
</td>
<!-- dartShell -->
<td>
<img src="https://github.com/hsduren/dartshell/blob/main/info1.png" width="300px" alt="dartShell displaying terminal and session information for SSH operations">
</td>
</tr>
</table>


> Feel free to add your own app here by opening a pull request.

Expand Down Expand Up @@ -341,20 +349,20 @@ print('free: ${statvfs.blockSize * statvfs.freeBlocks}');

### SSH client:

- [example/example.dart](https://github.com/TerminalStudio/dartssh2/blob/master/example/example.dart)
- [example/execute.dart](https://github.com/TerminalStudio/dartssh2/blob/master/example/execute.dart)
- [example/forward_local.dart](https://github.com/TerminalStudio/dartssh2/blob/master/example/forward_local.dart)
- [example/forward_remote.dart](https://github.com/TerminalStudio/dartssh2/blob/master/example/forward_remote.dart)
- [example/pubkey.dart](https://github.com/TerminalStudio/dartssh2/blob/master/example/pubkey.dart)
- [example/shell.dart](https://github.com/TerminalStudio/dartssh2/blob/master/example/shell.dart)
- [example/ssh_jump.dart](https://github.com/TerminalStudio/dartssh2/blob/master/example/ssh_jump.dart)
- [example/example.dart](https://github.com/obemu/dartssh3/blob/master/example/example.dart)
- [example/execute.dart](https://github.com/obemu/dartssh3/blob/master/example/execute.dart)
- [example/forward_local.dart](https://github.com/obemu/dartssh3/blob/master/example/forward_local.dart)
- [example/forward_remote.dart](https://github.com/obemu/dartssh3/blob/master/example/forward_remote.dart)
- [example/pubkey.dart](https://github.com/obemu/dartssh3/blob/master/example/pubkey.dart)
- [example/shell.dart](https://github.com/obemu/dartssh3/blob/master/example/shell.dart)
- [example/ssh_jump.dart](https://github.com/obemu/dartssh3/blob/master/example/ssh_jump.dart)

### SFTP:
- [example/sftp_read.dart](https://github.com/TerminalStudio/dartssh2/blob/master/example/sftp_read.dart)
- [example/sftp_list.dart](https://github.com/TerminalStudio/dartssh2/blob/master/example/sftp_list.dart)
- [example/sftp_stat.dart](https://github.com/TerminalStudio/dartssh2/blob/master/example/sftp_stat.dart)
- [example/sftp_upload.dart](https://github.com/TerminalStudio/dartssh2/blob/master/example/sftp_upload.dart)
- [example/sftp_filetype.dart](https://github.com/TerminalStudio/dartssh2/blob/master/example/sftp_filetype.dart)
- [example/sftp_read.dart](https://github.com/obemu/dartssh3/blob/master/example/sftp_read.dart)
- [example/sftp_list.dart](https://github.com/obemu/dartssh3/blob/master/example/sftp_list.dart)
- [example/sftp_stat.dart](https://github.com/obemu/dartssh3/blob/master/example/sftp_stat.dart)
- [example/sftp_upload.dart](https://github.com/obemu/dartssh3/blob/master/example/sftp_upload.dart)
- [example/sftp_filetype.dart](https://github.com/obemu/dartssh3/blob/master/example/sftp_filetype.dart)



Expand Down Expand Up @@ -385,45 +393,45 @@ print('free: ${statvfs.blockSize * statvfs.freeBlocks}');
**Private key**:

| **Type** | **Decode** | **Decrypt** | **Encode** | **Encrypt** |
| ------------------- | ---------- | ----------- | ---------- | ----------- |
| **RSA** | ✔️ | ✔️ | ✔️ | WIP |
| **OpenSSH RSA** | ✔️ | ✔️ | ✔️ | WIP |
| **OpenSSH ECDSA** | ✔️ | ✔️ | ✔️ | WIP |
| **OpenSSH Ed25519** | ✔️ | ✔️ | ✔️ | WIP |
|---------------------|------------|-------------|------------|-------------|
| **RSA** | ✔️ | ✔️ | ✔️ | WIP |
| **OpenSSH RSA** | ✔️ | ✔️ | ✔️ | WIP |
| **OpenSSH ECDSA** | ✔️ | ✔️ | ✔️ | WIP |
| **OpenSSH Ed25519** | ✔️ | ✔️ | ✔️ | WIP |



## ⏳ Roadmap

- [x] Fix broken tests
- [x] Sound null safety
- [x] Fix broken tests.
- [x] Sound null safety.
- [x] Redesign API to allow starting multiple sessions.
- [x] Full SFTP
- [ ] Server
- [x] Full SFTP.
- [ ] Server.

## References

- [`RFC 4250`](https://datatracker.ietf.org/doc/html/rfc4250) The Secure Shell (SSH) Protocol Assigned Numbers
- [`RFC 4251`](https://datatracker.ietf.org/doc/html/rfc4251) The Secure Shell (SSH) Protocol Architecture
- [`RFC 4252`](https://datatracker.ietf.org/doc/html/rfc4252) The Secure Shell (SSH) Authentication Protocol
- [`RFC 4253`](https://datatracker.ietf.org/doc/html/rfc4253) The Secure Shell (SSH) Transport Layer Protocol
- [`RFC 4254`](https://datatracker.ietf.org/doc/html/rfc4254) The Secure Shell (SSH) Connection Protocol
- [`RFC 4255`](https://datatracker.ietf.org/doc/html/rfc4255) Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints
- [`RFC 4256`](https://datatracker.ietf.org/doc/html/rfc4256) Generic Message Exchange Authentication for the Secure Shell Protocol (SSH)
- [`RFC 4419`](https://datatracker.ietf.org/doc/html/rfc4419) Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol
- [`RFC 4716`](https://datatracker.ietf.org/doc/html/rfc4716) The Secure Shell (SSH) Public Key File Format
- [`RFC 5656`](https://datatracker.ietf.org/doc/html/rfc5656) Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer
- [`RFC 8332`](https://datatracker.ietf.org/doc/html/rfc8332) Use of RSA Keys with SHA-256 and SHA-512 in the Secure Shell (SSH) Protocol
- [`RFC 8731`](https://datatracker.ietf.org/doc/html/rfc8731) Secure Shell (SSH) Key Exchange Method Using Curve25519 and Curve448
- [`draft-miller-ssh-agent-03`](https://datatracker.ietf.org/doc/html/draft-miller-ssh-agent-03) SSH Agent Protocol
- [`draft-ietf-secsh-filexfer-02`](https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-02) SSH File Transfer Protocol
- [`draft-dbider-sha2-mac-for-ssh-06`](https://datatracker.ietf.org/doc/html/draft-dbider-sha2-mac-for-ssh-06) SHA-2 Data Integrity Verification for the Secure Shell (SSH) Transport Layer Protocol
- [`RFC 4250`](https://datatracker.ietf.org/doc/html/rfc4250) The Secure Shell (SSH) Protocol Assigned Numbers.
- [`RFC 4251`](https://datatracker.ietf.org/doc/html/rfc4251) The Secure Shell (SSH) Protocol Architecture.
- [`RFC 4252`](https://datatracker.ietf.org/doc/html/rfc4252) The Secure Shell (SSH) Authentication Protocol.
- [`RFC 4253`](https://datatracker.ietf.org/doc/html/rfc4253) The Secure Shell (SSH) Transport Layer Protocol.
- [`RFC 4254`](https://datatracker.ietf.org/doc/html/rfc4254) The Secure Shell (SSH) Connection Protocol.
- [`RFC 4255`](https://datatracker.ietf.org/doc/html/rfc4255) Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints.
- [`RFC 4256`](https://datatracker.ietf.org/doc/html/rfc4256) Generic Message Exchange Authentication for the Secure Shell Protocol (SSH).
- [`RFC 4419`](https://datatracker.ietf.org/doc/html/rfc4419) Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol.
- [`RFC 4716`](https://datatracker.ietf.org/doc/html/rfc4716) The Secure Shell (SSH) Public Key File Format.
- [`RFC 5656`](https://datatracker.ietf.org/doc/html/rfc5656) Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer.
- [`RFC 8332`](https://datatracker.ietf.org/doc/html/rfc8332) Use of RSA Keys with SHA-256 and SHA-512 in the Secure Shell (SSH) Protocol.
- [`RFC 8731`](https://datatracker.ietf.org/doc/html/rfc8731) Secure Shell (SSH) Key Exchange Method Using Curve25519 and Curve448.
- [`draft-miller-ssh-agent-03`](https://datatracker.ietf.org/doc/html/draft-miller-ssh-agent-03) SSH Agent Protocol.
- [`draft-ietf-secsh-filexfer-02`](https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-02) SSH File Transfer Protocol.
- [`draft-dbider-sha2-mac-for-ssh-06`](https://datatracker.ietf.org/doc/html/draft-dbider-sha2-mac-for-ssh-06) SHA-2 Data Integrity Verification for the Secure Shell (SSH) Transport Layer Protocol.

## Credits

https://github.com/GreenAppers/dartssh by GreenAppers
- [https://github.com/GreenAppers/dartssh](https://github.com/GreenAppers/dartssh) by GreenAppers.

https://github.com/TerminalStudio/dartssh2 by TerminalStudio
- [https://github.com/TerminalStudio/dartssh2](https://github.com/TerminalStudio/dartssh2) by TerminalStudio

## License

Expand Down
21 changes: 2 additions & 19 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,8 @@ include: package:lints/recommended.yaml
linter:
rules:
prefer_function_declarations_over_variables: false
prefer_relative_imports: true

analyzer:
plugins:
- dart_code_metrics

dart_code_metrics:
anti-patterns:
# - long-method
# - long-parameter-list
metrics:
cyclomatic-complexity: 20
maximum-nesting-level: 5
number-of-parameters: 4
source-lines-of-code: 50
metrics-exclude:
- test/**
rules:
# - no-boolean-literal-compare
# - no-empty-block
- prefer-trailing-comma
- prefer-conditional-expressions
- no-equal-then-else
- dart_code_metrics_presets
2 changes: 1 addition & 1 deletion lib/src/algorithm/ssh_cipher_type.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:typed_data';

import 'package:dartssh3/src/ssh_algorithm.dart';
import '../ssh_algorithm.dart';
import 'package:pointycastle/export.dart';

class SSHCipherType with SSHAlgorithm {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/algorithm/ssh_hostkey_type.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:dartssh3/src/ssh_algorithm.dart';
import '../ssh_algorithm.dart';

class SSHHostkeyType with SSHAlgorithm {
static const rsaSha1 = SSHHostkeyType._('ssh-rsa');
Expand Down
2 changes: 1 addition & 1 deletion lib/src/algorithm/ssh_kex_type.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:dartssh3/src/ssh_algorithm.dart';
import '../ssh_algorithm.dart';
import 'package:pointycastle/export.dart';

class SSHKexType with SSHAlgorithm {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/algorithm/ssh_mac_type.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:typed_data';

import 'package:dartssh3/src/ssh_algorithm.dart';
import '../ssh_algorithm.dart';
import 'package:pointycastle/export.dart';

class SSHMacType with SSHAlgorithm {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/hostkey/hostkey_ecdsa.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:typed_data';

import 'package:convert/convert.dart';
import 'package:dartssh3/src/ssh_hostkey.dart';
import 'package:dartssh3/src/ssh_message.dart';
import '../ssh_hostkey.dart';
import '../ssh_message.dart';
import 'package:pointycastle/export.dart';

class SSHEcdsaPublicKey implements SSHHostKey {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/hostkey/hostkey_ed25519.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:convert/convert.dart';
import 'package:dartssh3/src/ssh_hostkey.dart';
import 'package:dartssh3/src/ssh_message.dart';
import '../ssh_hostkey.dart';
import '../ssh_message.dart';
import 'package:pinenacl/ed25519.dart';

class SSHEd25519PublicKey implements SSHHostKey {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/hostkey/hostkey_rsa.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:typed_data';

import 'package:convert/convert.dart';
import 'package:dartssh3/src/ssh_hostkey.dart';
import 'package:dartssh3/src/ssh_message.dart';
import '../ssh_hostkey.dart';
import '../ssh_message.dart';

import 'package:pinenacl/ed25519.dart';
import 'package:pointycastle/api.dart' hide Signature;
Expand Down
12 changes: 6 additions & 6 deletions lib/src/http/http_client.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'dart:convert';
import 'dart:typed_data';

import 'package:dartssh3/src/http/http_exception.dart';
import 'package:dartssh3/src/http/line_decoder.dart';
import 'package:dartssh3/src/http/http_content_type.dart';
import 'package:dartssh3/src/http/http_headers.dart';
import 'package:dartssh3/src/socket/ssh_socket.dart';
import 'package:dartssh3/src/ssh_client.dart';
import 'http_exception.dart';
import 'line_decoder.dart';
import 'http_content_type.dart';
import 'http_headers.dart';
import '../socket/ssh_socket.dart';
import '../ssh_client.dart';

/// A HTTP client that works over SSH port forwarding.
///
Expand Down
4 changes: 2 additions & 2 deletions lib/src/http/http_content_type.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:collection';

import 'package:dartssh3/src/http/http_exception.dart';
import 'package:dartssh3/src/http/http_headers.dart';
import 'http_exception.dart';
import 'http_headers.dart';

/// A MIME/IANA media type used as the value of the
/// [SSHHttpHeaders.contentTypeHeader] header.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/http/http_headers.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:dartssh3/src/http/http_content_type.dart';
import 'http_content_type.dart';

/// Headers for HTTP requests and responses.
///
Expand Down
6 changes: 3 additions & 3 deletions lib/src/kex/kex_dh.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:typed_data';

import 'package:dartssh3/src/ssh_kex.dart';
import 'package:dartssh3/src/utils/bigint.dart';
import 'package:dartssh3/src/utils/list.dart';
import '../ssh_kex.dart';
import '../utils/bigint.dart';
import '../utils/list.dart';

/// The Diffie-Hellman (DH) key exchange provides a shared secret that
/// cannot be determined by either party alone.
Expand Down
Loading

0 comments on commit e989fff

Please sign in to comment.