refactor: redid the bindshell example

Made it use a single UDP client as well as proper randomized ports to go
through network firewalls, requiring stdin, status, stderr, and stdout
all go over a single UDP socket

Updated the client to have a prompt
This commit is contained in:
Andrew Rioux
2023-05-09 21:02:46 -04:00
parent 8ad7127d4d
commit f1e5b2d979
7 changed files with 263 additions and 90 deletions

View File

@@ -14,7 +14,7 @@ pub trait Protocol<I, T> {
/// Allows for composing multiple protocols on top of each other, for instance to use
/// TCP fragmenting to work with HTTP to form a complete packet, and then take the HTTP
/// conversation and encode Sparse messages into it
fn compose<P, U>(self, other: P) -> ProtocolCompose<Self, P, I, J, T, U>
fn compose<P, J, U>(self, other: P) -> ProtocolCompose<Self, P, I, J, T, U>
where
J: From<T>,
P: Protocol<J, U> + Sized,
@@ -43,14 +43,14 @@ pub struct ProtocolCompose<P1: Protocol<I, T>, P2: Protocol<J, U>, I, J: From<T>
generic_u: PhantomData<U>,
}
impl<P1: Protocol<I, T>, P2: Protocol<J, U>, I, J: From<T>, T, U> Protocol<I, U>
/*impl<P1: Protocol<I, T>, P2: Protocol<J, U>, I, J: From<T>, T, U> Protocol<I, U>
for ProtocolCompose<P1, P2, I, J, T, U>
{
fn handle_event(&mut self, packet: I) -> U {
let elem1 = self.protocol1.handle_event(packet);
self.protocol2.handle_event(elem1)
}
}
}*/
/// High level protocol that used for the overall application
///