-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall_script.sh
More file actions
executable file
·236 lines (199 loc) · 7.97 KB
/
uninstall_script.sh
File metadata and controls
executable file
·236 lines (199 loc) · 7.97 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
#!/bin/bash
# ╔══════════════════════════════════════════════════════════╗
# ║ NeuroRift Uninstall Script ║
# ║ Designed and developed by demonking369 🧠 ║
# ║ GitHub: https://github.com/demonking369/NeuroRift ║
# ╚══════════════════════════════════════════════════════════╝
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${RED}╔══════════════════════════════════════════════════════════╗${NC}"
echo -e "${RED}║ NeuroRift Uninstall Utility ║${NC}"
echo -e "${RED}╚══════════════════════════════════════════════════════════╝${NC}"
echo ""
echo -e "${YELLOW}This will help you remove NeuroRift components from your system.${NC}"
echo ""
# Function to ask yes/no question
ask_yes_no() {
local prompt=$1
local default=${2:-N}
if [ "$default" = "Y" ]; then
read -p "$prompt [Y/n]: " response
response=${response:-Y}
else
read -p "$prompt [y/N]: " response
response=${response:-N}
fi
[[ "$response" =~ ^[Yy]$ ]]
}
# Display what will be uninstalled
echo -e "${BLUE}Select components to uninstall:${NC}"
echo ""
# Ask about each component
UNINSTALL_APP=false
UNINSTALL_MODELS=false
UNINSTALL_TOOLS=false
UNINSTALL_CONFIG=false
UNINSTALL_SESSIONS=false
if ask_yes_no "Remove NeuroRift application (Python package)?"; then
UNINSTALL_APP=true
fi
if command -v ollama &> /dev/null; then
if ask_yes_no "Remove AI models (llama.cpp models)?"; then
UNINSTALL_MODELS=true
fi
fi
if ask_yes_no "Remove security tools (subfinder, httpx, nuclei, etc.)?"; then
UNINSTALL_TOOLS=true
fi
if ask_yes_no "Remove configuration files (~/.neurorift/configs)?"; then
UNINSTALL_CONFIG=true
fi
if ask_yes_no "Remove session data (~/.neurorift/sessions)?"; then
UNINSTALL_SESSIONS=true
fi
# Confirm before proceeding
echo ""
echo -e "${YELLOW}Summary of what will be removed:${NC}"
[ "$UNINSTALL_APP" = true ] && echo -e " ${RED}✗${NC} NeuroRift application"
[ "$UNINSTALL_MODELS" = true ] && echo -e " ${RED}✗${NC} AI models"
[ "$UNINSTALL_TOOLS" = true ] && echo -e " ${RED}✗${NC} Security tools"
[ "$UNINSTALL_CONFIG" = true ] && echo -e " ${RED}✗${NC} Configuration files"
[ "$UNINSTALL_SESSIONS" = true ] && echo -e " ${RED}✗${NC} Session data (.nrs files)"
echo ""
if ! ask_yes_no "${RED}Proceed with uninstallation?${NC}"; then
echo -e "${GREEN}Uninstallation cancelled.${NC}"
exit 0
fi
echo ""
echo -e "${BLUE}Starting uninstallation...${NC}"
echo ""
# Uninstall NeuroRift application
if [ "$UNINSTALL_APP" = true ]; then
echo -e "${YELLOW}Removing NeuroRift application...${NC}"
# Try pipx first
if command -v pipx &> /dev/null; then
if pipx list | grep -q neurorift; then
pipx uninstall neurorift
echo -e "${GREEN}[✓] Removed via pipx${NC}"
fi
fi
# Try pip user install
if pip list --user 2>/dev/null | grep -q neurorift; then
pip uninstall -y neurorift
echo -e "${GREEN}[✓] Removed via pip (user)${NC}"
fi
# Try system pip
if command -v sudo &> /dev/null; then
if pip list 2>/dev/null | grep -q neurorift; then
sudo pip uninstall -y neurorift
echo -e "${GREEN}[✓] Removed via pip (system)${NC}"
fi
fi
# Remove from /usr/local/bin if exists
if [ -f "/usr/local/bin/neurorift" ]; then
if command -v sudo &> /dev/null; then
sudo rm -f /usr/local/bin/neurorift
echo -e "${GREEN}[✓] Removed /usr/local/bin/neurorift${NC}"
else
rm -f /usr/local/bin/neurorift 2>/dev/null || echo -e "${YELLOW}[!] Could not remove /usr/local/bin/neurorift (permission denied)${NC}"
fi
fi
fi
# Uninstall AI models
if [ "$UNINSTALL_MODELS" = true ]; then
echo -e "${YELLOW}Removing AI models...${NC}"
if command -v ollama &> /dev/null; then
# List models and remove them
MODELS=$(ollama list | tail -n +2 | awk '{print $1}')
if [ -n "$MODELS" ]; then
echo "Found models:"
echo "$MODELS"
echo ""
if ask_yes_no "Remove ALL llama.cpp models?"; then
for model in $MODELS; do
echo "Removing $model..."
ollama rm "$model"
done
echo -e "${GREEN}[✓] Removed all AI models${NC}"
else
echo "Skipping model removal"
fi
else
echo -e "${YELLOW}[!] No models found${NC}"
fi
fi
fi
# Uninstall security tools
if [ "$UNINSTALL_TOOLS" = true ]; then
echo -e "${YELLOW}Removing security tools...${NC}"
GOBIN="${GOBIN:-$HOME/go/bin}"
TOOLS=(
"subfinder"
"httpx"
"nuclei"
"ffuf"
"gobuster"
)
for tool in "${TOOLS[@]}"; do
if [ -f "$GOBIN/$tool" ]; then
rm -f "$GOBIN/$tool"
echo -e "${GREEN}[✓] Removed $tool${NC}"
fi
done
fi
# Remove session data
if [ "$UNINSTALL_SESSIONS" = true ]; then
echo -e "${YELLOW}Removing session data...${NC}"
if [ -d "$HOME/.neurorift/sessions" ]; then
# Count sessions
SESSION_COUNT=$(find "$HOME/.neurorift/sessions" -name "*.nrs" 2>/dev/null | wc -l)
if [ "$SESSION_COUNT" -gt 0 ]; then
echo -e "${YELLOW}Found $SESSION_COUNT session(s)${NC}"
if ask_yes_no "Delete all sessions? (This cannot be undone)" "N"; then
rm -rf "$HOME/.neurorift/sessions"
rm -rf "$HOME/.neurorift/session_data"
echo -e "${GREEN}[✓] Removed all sessions${NC}"
else
echo -e "${YELLOW}[!] Keeping session data${NC}"
fi
else
rm -rf "$HOME/.neurorift/sessions"
rm -rf "$HOME/.neurorift/session_data"
echo -e "${GREEN}[✓] Removed session directories${NC}"
fi
fi
fi
# Remove configuration files
if [ "$UNINSTALL_CONFIG" = true ]; then
echo -e "${YELLOW}Removing configuration files...${NC}"
if [ -d "$HOME/.neurorift/configs" ]; then
rm -rf "$HOME/.neurorift/configs"
echo -e "${GREEN}[✓] Removed ~/.neurorift/configs${NC}"
fi
# Remove .env file from project directory if it exists
if [ -f ".env" ]; then
rm -f .env
echo -e "${GREEN}[✓] Removed .env${NC}"
fi
# Remove entire .neurorift directory if empty
if [ -d "$HOME/.neurorift" ]; then
if [ -z "$(ls -A $HOME/.neurorift)" ]; then
rm -rf "$HOME/.neurorift"
echo -e "${GREEN}[✓] Removed ~/.neurorift (empty)${NC}"
else
echo -e "${YELLOW}[!] ~/.neurorift not empty, keeping directory${NC}"
fi
fi
fi
echo ""
echo -e "${GREEN}╔══════════════════════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ Uninstallation Complete! ║${NC}"
echo -e "${GREEN}╚══════════════════════════════════════════════════════════╝${NC}"
echo ""
echo -e "${BLUE}Thank you for using NeuroRift!${NC}"
echo -e "${BLUE}Designed and developed by demonking369${NC}"
echo -e "${BLUE}To reinstall, run: ./install_script.sh${NC}"