Crates.io | ctf-pwn |
lib.rs | ctf-pwn |
version | 0.3.8 |
source | src |
created_at | 2022-11-01 18:13:44.759968 |
updated_at | 2024-05-06 23:41:14.34877 |
description | Pwn utilities for Rust. |
homepage | https://github.com/rust-ctf/ctf-pwn |
repository | https://github.com/rust-ctf/ctf-pwn |
max_upload_size | |
id | 702970 |
size | 127,028 |
Pwn utilities for Rust.
let mut pipe = TcpPipe::connect("127.0.0.1:1337").await?;
let mut pipe = ProcessPipe::from_app("ls").await?;
let mut pipe = ProcessPipe::from_app_args("ls", ["-l", "-a"]).await?;
let mut pipe = Pipe::new(stdin(), stdout());
let data: Vec<u8> = pipe.recv().await?;
let data: Vec<u8> = pipe.recv_until("Name:", false).await?;
let data: Vec<u8> = pipe.recv_until([0x01, 0x02, 0x03], false).await?;
let data: String = pipe.recv_line_utf8().await?;
let data: AsciiString = pipe.recv_line_ascii().await?;
let data = pipe.recv_until(r"(Ok)|(Error)", true).await?;
let flag = pipe.recv_regex_utf8(r"HTB\{[^\}]+\}").await?;
pipe.interactive_shell().await?;
pipe.write_ansi_command(ansi::Down).await?;
pipe.write_ansi_command(ansi::Right).await?;
pipe.write_ansi_command(ansi::Enter).await?;
pipe.interactive_ansi().await?;
let payload = Payload::builder()
.recv_until("> ", false)
.push("1")
.push("\n")
.send()
.recv_until("Insert card's serial number: ", false)
.push_line("%4919x%7$hn")
.send()
.recv_regex_utf8(r"HTB\{[^\}]+\}")
.build();
let flag = pipe.payload(payload).await?;
println!("{flag}");
let elf = Elf::parse("app_path").await?;
let got: &HashMap<String, u64> = elf.got();
let plt: &HashMap<String, u64> = elf.plt();
let symbols: &HashMap<String, Symbol> = elf.symbols();
let dynamic_symbols: &HashMap<String, Symbol> = elf.dynamic_symbols();