瀏覽代碼

Forget cURL & wget calls with inline passwords in shell history

pull/85/head
Luke Bonanomi 5 年之前
父節點
當前提交
fd468bb05a
共有 1 個檔案被更改,包括 19 行新增0 行删除
  1. +19
    -0
      README.md

+ 19
- 0
README.md 查看文件

@@ -1163,6 +1163,25 @@ column -c3 -s " " -t | \
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

```bash


Loading…
取消
儲存