From 1ea2c2f84a3b1216ed27e69cef64c67e7a5eff45 Mon Sep 17 00:00:00 2001 From: Camilo Date: Mon, 28 Feb 2022 14:21:58 -0300 Subject: [PATCH 1/2] added shell cleaning trick --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index ca62320..e83e25d 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ Only main chapters: - **[Other Cheat Sheets](#other-cheat-sheets-toc)** - **[One-liners](#one-liners-toc)** - **[Shell functions](#shell-functions-toc)** +- **[Shell tricks](#shell-tricks-toc)** ## :trident:  The Book of Secret Knowledge (Chapters) @@ -4438,3 +4439,13 @@ shell> GetASN 1.1.1.1 shell> GetASN 0.0.0.0 Unsuccessful ASN gathering. ``` +#### Shell tricks  [[TOC]](#anger-table-of-contents) + When you get a shell, it is generally not very clean, but after following these steps, you will have a fairly clean and comfortable shell to work with. + + 1) ```script /dev/null -c bash``` + 2) Ctrl-Z (to send it to background) + 3) ```stty raw -echo; fg``` (returns the shell to foreground) + 4) ```reset``` (to reset terminal) + 5) ```xterm``` (when asked for terminal type) + 6) ```export TERM=xterm; export SHELL=bash``` + From db823f6b702da48986f6c87b82f7720d33280be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=BBy?= Date: Mon, 28 Feb 2022 21:33:52 +0100 Subject: [PATCH 2/2] Update README.md --- README.md | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index e83e25d..ab7c2d7 100644 --- a/README.md +++ b/README.md @@ -114,9 +114,9 @@ Only main chapters: - **[Hacking/Penetration Testing](#hackingpenetration-testing-toc)** - **[Your daily knowledge and news](#your-daily-knowledge-and-news-toc)** - **[Other Cheat Sheets](#other-cheat-sheets-toc)** -- **[One-liners](#one-liners-toc)** -- **[Shell functions](#shell-functions-toc)** -- **[Shell tricks](#shell-tricks-toc)** +- **[Shell One-liners](#shell-one-liners-toc)** +- **[Shell Tricks](#shell-tricks-toc)** +- **[Shell Functions](#shell-functions-toc)** ## :trident:  The Book of Secret Knowledge (Chapters) @@ -1670,7 +1670,7 @@ _Encoding_ text :arrow_right: encoded
text :arrow_left: encoded -#### One-liners  [[TOC]](#anger-table-of-contents) +#### Shell One-liners  [[TOC]](#anger-table-of-contents) ##### Table of Contents @@ -2328,6 +2328,7 @@ ___ ```bash vimdiff file1 file2 ``` + ###### Compare two JSON files ```bash @@ -2335,8 +2336,9 @@ vimdiff <(jq -S . A.json) <(jq -S . B.json) ``` ###### Compare Hex dump + ```bash -d(){ vimdiff <(f $1) <(f $2);};f(){ hexdump -C $1|cut -d' ' -f3-|tr -s ' ';}; d ~/bin1 ~/bin2 +d(){ vimdiff <(f $1) <(f $2);};f(){ hexdump -C $1 | cut -d' ' -f3- | tr -s ' ';}; d ~/bin1 ~/bin2 ``` ###### diffchar @@ -4353,6 +4355,17 @@ perl -p -i -e 's/\t/ /g' filename perl -lne '$i++; $in += length($_); END { print "$i lines, $in characters"; }' filename ``` +#### Shell Tricks  [[TOC]](#anger-table-of-contents) + +When you get a shell, it is generally not very clean, but after following these steps, you will have a fairly clean and comfortable shell to work with. + +1) `script /dev/null -c bash` +2) Ctrl-Z (to send it to background) +3) `stty raw -echo; fg` (returns the shell to foreground) +4) `reset` (to reset terminal) +5) `xterm` (when asked for terminal type) +6) `export TERM=xterm; export SHELL=bash` + #### Shell functions  [[TOC]](#anger-table-of-contents) ##### Table of Contents @@ -4439,13 +4452,3 @@ shell> GetASN 1.1.1.1 shell> GetASN 0.0.0.0 Unsuccessful ASN gathering. ``` -#### Shell tricks  [[TOC]](#anger-table-of-contents) - When you get a shell, it is generally not very clean, but after following these steps, you will have a fairly clean and comfortable shell to work with. - - 1) ```script /dev/null -c bash``` - 2) Ctrl-Z (to send it to background) - 3) ```stty raw -echo; fg``` (returns the shell to foreground) - 4) ```reset``` (to reset terminal) - 5) ```xterm``` (when asked for terminal type) - 6) ```export TERM=xterm; export SHELL=bash``` -