Add !!Con 2021 content
This commit is contained in:
parent
6ff7b698d8
commit
c7b1af832e
21 changed files with 11551 additions and 0 deletions
1
content/pages/bangbangcon2021/demo/.gitignore
vendored
Normal file
1
content/pages/bangbangcon2021/demo/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/target
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"suggest.floatEnable": false,
|
||||
"signature.enable": false,
|
||||
"suggest.enablePreview": false,
|
||||
"suggest.autoTrigger": "none",
|
||||
}
|
||||
129
content/pages/bangbangcon2021/demo/Cargo.lock
generated
Normal file
129
content/pages/bangbangcon2021/demo/Cargo.lock
generated
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "demo"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"owoify",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
|
||||
|
||||
[[package]]
|
||||
name = "owoify"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f5d5373685d13f2b6080231760ae4e1ca37161f129e1eb2393ea9028ffa49339"
|
||||
dependencies = [
|
||||
"rand",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"rand_hc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce5f1ceb7f74abbce32601642fcf8e8508a8a8991e0621c7d750295b9095702b"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.9.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
||||
14
content/pages/bangbangcon2021/demo/Cargo.toml
Normal file
14
content/pages/bangbangcon2021/demo/Cargo.toml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[package]
|
||||
name = "demo"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2.94"
|
||||
owoify = "0.1.5"
|
||||
|
||||
[profile.dev]
|
||||
opt-level = 3
|
||||
debug = true
|
||||
35
content/pages/bangbangcon2021/demo/src/main.rs
Normal file
35
content/pages/bangbangcon2021/demo/src/main.rs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
use crate::things::*;
|
||||
use libc::*;
|
||||
use std::{mem, slice, str};
|
||||
mod things;
|
||||
|
||||
use owoify::OwOifiable;
|
||||
static mut REAL_WRITE: Option<LibcWrite> = None;
|
||||
|
||||
unsafe extern "C" fn write_owo(fd: i32, ptr: *const c_void, len: usize) -> isize {
|
||||
let s = slice::from_raw_parts(ptr as *const _, len);
|
||||
let s = str::from_utf8(s).unwrap();
|
||||
let owoified = s.to_string().owoify();
|
||||
|
||||
REAL_WRITE.unwrap()(fd, owoified.as_ptr() as *const _, owoified.len());
|
||||
len as isize
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let addr = get_hex_from_cmdline();
|
||||
let addr = (addr + 0x555555554000) as *mut usize;
|
||||
|
||||
unsafe {
|
||||
REAL_WRITE = Some(mem::transmute(*addr));
|
||||
mprotect(
|
||||
(addr as usize & !(0x1000 - 1)) as *mut _,
|
||||
0x1000,
|
||||
PROT_READ | PROT_WRITE,
|
||||
);
|
||||
*addr = write_owo as usize;
|
||||
}
|
||||
let s = "hello !!con!!\n";
|
||||
unsafe { write(1, s.as_ptr() as *const _, s.len()) };
|
||||
|
||||
println!("hello !!con!! from println");
|
||||
}
|
||||
4
content/pages/bangbangcon2021/demo/src/things.rs
Normal file
4
content/pages/bangbangcon2021/demo/src/things.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
pub type LibcWrite = unsafe extern "C" fn(fd: i32, ptr: *const libc::c_void, len: usize) -> isize;
|
||||
pub fn get_hex_from_cmdline() -> usize {
|
||||
usize::from_str_radix(&std::env::args().skip(1).next().unwrap(), 16).unwrap()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue