-
Notifications
You must be signed in to change notification settings - Fork 613
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
126 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
mod error; | ||
|
||
#[cfg(feature = "nasl-builtin-libssh")] | ||
mod libssh; | ||
#[cfg(feature = "nasl-builtin-libssh")] | ||
pub use self::libssh::Ssh; | ||
|
||
#[cfg(not(feature = "nasl-builtin-libssh"))] | ||
mod russh; | ||
#[cfg(not(feature = "nasl-builtin-libssh"))] | ||
pub use self::russh::Ssh; | ||
|
||
#[cfg(test)] | ||
mod tests; | ||
|
||
type SessionId = i32; | ||
pub use self::libssh::Ssh; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use russh::client::Session; | ||
use tokio::sync::Mutex; | ||
|
||
use crate::nasl::{ | ||
prelude::*, | ||
utils::{IntoFunctionSet, StoredFunctionSet}, | ||
}; | ||
|
||
#[derive(Default)] | ||
pub struct Ssh { | ||
sessions: Vec<Mutex<Session>>, | ||
} | ||
|
||
impl Ssh { | ||
#[nasl_function] | ||
async fn ssh_connect(&mut self) { | ||
todo!() | ||
} | ||
} | ||
|
||
impl IntoFunctionSet for Ssh { | ||
type State = Ssh; | ||
|
||
fn into_function_set(self) -> StoredFunctionSet<Self::State> { | ||
let mut set = StoredFunctionSet::new(self); | ||
|
||
set.async_stateful_mut("ssh_connect", Ssh::ssh_connect); | ||
set | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters