mirror of
https://github.com/trimstray/the-book-of-secret-knowledge.git
synced 2024-12-20 02:16:13 +00:00
Forget cURL & wget calls with inline passwords in shell history
This commit is contained in:
parent
238ee5e5eb
commit
fd468bb05a
19
README.md
19
README.md
@ -1163,6 +1163,25 @@ column -c3 -s " " -t | \
|
|||||||
sort -nr | nl | head -n 20
|
sort -nr | nl | head -n 20
|
||||||
```
|
```
|
||||||
|
|
||||||
|
###### Sterilize bash history
|
||||||
|
|
||||||
|
```bash
|
||||||
|
function sterile() {
|
||||||
|
history | awk '$2 != "history" { $1=""; print $0 }' | egrep -vi "\
|
||||||
|
curl\b+.*(-E|--cert)\b+.*\b*|\
|
||||||
|
curl\b+.*--pass\b+.*\b*|\
|
||||||
|
curl\b+.*(-U|--proxy-user).*:.*\b*|\
|
||||||
|
curl\b+.*(-u|--user).*:.*\b*
|
||||||
|
.*(-H|--header).*(token|auth.*)\b+.*|\
|
||||||
|
wget\b+.*--.*password\b+.*\b*|\
|
||||||
|
http.?://.+:.+@.*\
|
||||||
|
" > $HOME/histbuff; history -r $HOME/histbuff;
|
||||||
|
}
|
||||||
|
|
||||||
|
export PROMPT_COMMAND="sterile"
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
###### Quickly backup a file
|
###### Quickly backup a file
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
Loading…
Reference in New Issue
Block a user