ctf_pwn/io/pipe/convert/
conv_macro.rs1#[macro_export]
2macro_rules! pipe {
3 ($stream:expr) => {{
4 let pipe: Pipe<_, _> = $stream.into();
5 pipe
6 }};
7}
8
9#[macro_export]
10macro_rules! tcp_pipe {
11 ($input:expr) => {{
12 let stream = TcpStream::connect($input).await.unwrap();
13 let pipe: TcpStreamPipe = stream.into();
14 pipe
15 }};
16}
17
18#[macro_export]
19macro_rules! shell_pipe {
20 ($program:expr $(, $arg:expr)*) => {{
21 let mut command = Command::new($program);
22 $(
23 command.arg($arg);
24 )*
25
26 ProcessPipe::spawn_command(command).unwrap()
27 }};
28}
29
30#[macro_export]
31macro_rules! tcp_shell_pipe {
32 (true, $input:expr, $(, $arg:expr)*) => {{
33 tcp_pipe!($input)
34 }};
35 (false, $program:expr, $(, $arg:expr)*) => {{
36 file_pipe!($program $(, $arg)*)
37 }};
38}