-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bash_logout
More file actions
38 lines (33 loc) · 1.18 KB
/
.bash_logout
File metadata and controls
38 lines (33 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
# --- 1. Wipe Shell History (Critical for Security) ---
# This clears the current session history and truncates the history file
history -c
rm -f ~/.bash_history ~/.zsh_history ~/.python_history
# --- 2. Define the "Burn List" ---
# Added: .ssh/known_hosts (privacy), .cache (massive leak), and .wget-hsts
DEATH_ROW=(
"$HOME/.pm2"
"$HOME/.node_repl_history"
"$HOME/.yarnrc"
"$HOME/.lesshst"
"$HOME/.viminfo"
"$HOME/.wget-hsts"
"$HOME/.local/share/recently-used.xbel" # GNOME "Recent Files" leak
"$HOME/.cache/thumbnails" # Image previews
"$HOME/.DS_Store" # macOS leftovers
)
# --- 3. Securely Delete ---
for item in "${DEATH_ROW[@]}"; do
if [ -e "$item" ]; then
# -u: truncate and remove, -z: add a final overwrite with zeros
find "$item" -type f -exec shred -u -z {} + 2>/dev/null
rm -rf "$item"
fi
done
# --- 4. Clear System Temp & Clipboard ---
# Only works if you have 'xclip' or 'wl-copy' installed on Desktop
if command -v xclip &>/dev/null; then
echo -n "" | xclip -selection clipboard
echo -n "" | xclip -selection primary
fi
echo "Session cleaned securely."