From 9bac306503863870f1b0516890fc06c6d2724d51 Mon Sep 17 00:00:00 2001 From: Roman Mueller Date: Thu, 13 Sep 2018 18:49:09 +0200 Subject: [PATCH] Add history file read/write to bash Close #21. --- _gtfobins/bash.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/_gtfobins/bash.md b/_gtfobins/bash.md index e39d79d..bff48d9 100644 --- a/_gtfobins/bash.md +++ b/_gtfobins/bash.md @@ -40,11 +40,24 @@ functions: - code: | export LFILE=file_to_write bash -c 'echo DATA > $LFILE' + - description: This adds timestamps to the output file. + code: | + LFILE=file_to_write + HISTIGNORE='history *' + history -c + DATA + history -w $LFILE file-read: - description: It trims trailing newlines and it's not binary-safe. code: | export LFILE=file_to_read bash -c 'echo "$(<$LFILE)"' + - description: The read file content is surrounded by the current history content. + code: | + LFILE=file_to_read + HISTTIMEFORMAT=$'\r\e[K' + history -r $LFILE + history suid-enabled: - code: "./bash -p" sudo-enabled: