Skip to content

Commit

Permalink
Add: support nasl SSH functions (#1368)
Browse files Browse the repository at this point in the history
* Add: Basic structure of nasl SSH functions

Also, implement a draft for nasl_ssh_connect and session handler structures

* Use Diagnostic instead of the logger

* Add:session handlers

* Change session handler.
Implement disconnect() in nasl_ssh.rs, login() and partially userauth()
Solve conflicts with the return error in nasl functions (Return an FunctionErrorKind)
Adjust format

* Fix: session share and create a structure for holding connection options

* Code rework and implement another authentication methods.

* Fix: test in README

* Add: authentication method via public key

Also, uses a personal cargo version, until contributions are merged in the libssh-rs cargo project and released

* Add: login interactive

* Add: ssh_request_exec()

* Add: get_issue_banner()

* Add: get_server_banner()

* Add: nasl_ssh_get_auth_methods()

* Add: get_host_key()

* Add: sftp_enabled_check()

* Add: channel member to the SshSession structure

* Add: request_shell

* Add: shell_close()

* Add: ssh_shell_write()

* Add: ssh_shell_read()

* Fix: disconnect_ssh_session().

Use the right index and avoid panic

* Change: move functions to ssh.rs.

Ssh functions are not implemented methods for a session object anymore.

* Add: example for ssh nasl functions

* Change: replace println!() with logger().info()

* Add: implement next_session_id()

get the next available ID for a new session.

* Fix: solve unwrap() when locking the sessions

* Fix: dependencies for CI

* Change: Apply requested changes.

- Use if let Err(err) where possible.
- Reduce duplicated code.

* Add: From<&ContextType> implementations for different NaslValue types

* Add: comment
  • Loading branch information
jjnicola committed Apr 27, 2023
1 parent a45bc29 commit 2783f53
Show file tree
Hide file tree
Showing 18 changed files with 2,604 additions and 117 deletions.
1 change: 1 addition & 0 deletions .docker/build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN apt-get update && apt-get install --no-install-recommends --no-install-sugge
libksba-dev \
libpaho-mqtt-dev \
libpcap-dev \
zlib1g-dev \
libssh-gcrypt-dev \
libbsd-dev \
# for linking openvas-smb (libopenvas_wmiclient)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
~/.cargo/git/db/
rust/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: sudo apt update && sudo apt-get install -y libpcap-dev
- run: sudo apt update && sudo apt-get install -y libpcap-dev libssl-dev
- run: rustup update stable && rustup default stable
- run: cargo install cross
- run: CROSS_CONFIG=Cross.toml cross -v build --release --target aarch64-unknown-linux-gnu
Expand Down

0 comments on commit 2783f53

Please sign in to comment.