-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathinstaller.sh
More file actions
436 lines (360 loc) · 12.7 KB
/
Copy pathinstaller.sh
File metadata and controls
436 lines (360 loc) · 12.7 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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
#!/bin/bash
# FluxER - Fluxion Easy Runner for Termux
# Created by MrBlackX/TheMasterCH
# Maintainer: 0n1cOn3
# Version: 1.0 (Termux Optimized)
set -euo pipefail
# ========================
# Configuration
# ========================
readonly SCRIPT_VERSION="1.0"
readonly SCRIPT_NAME="FluxER"
readonly FLUXION_REPO="https://github.com/FluxionNetwork/fluxion.git"
readonly DISTRO_NAME="ubuntu" # Can be changed to debian, kali-nethunter, etc.
# FluxER metadata
readonly FLUXER_DESCRIPTION="Fluxion Easy Runner - Automated Fluxion installer for Termux"
readonly USE_PROOT_DISTRO=true # Use official proot-distro instead of legacy scripts
# Termux-specific paths
readonly TERMUX_PREFIX="${PREFIX:-/data/data/com.termux/files/usr}"
readonly TERMUX_HOME="${HOME:-/data/data/com.termux/files/home}"
# Colors
readonly RED='\e[1;31m'
readonly GREEN='\e[1;32m'
readonly BLUE='\e[1;34m'
readonly PURPLE='\e[1;35m'
readonly YELLOW='\e[1;33m'
readonly NC='\e[0m'
# ========================
# Helper Functions
# ========================
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
log_success() {
echo -e "${GREEN}[✓]${NC} $1"
}
log_error() {
echo -e "${RED}[✗]${NC} $1" >&2
}
log_warning() {
echo -e "${YELLOW}[!]${NC} $1"
}
print_banner() {
clear
if command -v figlet &>/dev/null; then
figlet -f small "FluxER"
else
echo "╔════════════════════════════╗"
echo "║ FluxER ║"
echo "║ Fluxion Installer ║"
echo "╚════════════════════════════╝"
fi
echo -e "${BLUE}Created by: MrBlackX/TheMasterCH${NC}"
echo -e "${PURPLE}Modified by: 0n1cOn3${NC}"
echo -e "${GREEN}Version: ${SCRIPT_VERSION}${NC}"
echo ""
}
check_termux() {
if [[ ! -d "$TERMUX_PREFIX" ]]; then
log_error "This script must be run in Termux!"
exit 1
fi
# Check Android version
local android_ver
android_ver=$(getprop ro.build.version.release 2>/dev/null || echo "unknown")
log_info "Android version: $android_ver"
}
check_storage_permission() {
if [[ ! -d "$HOME/storage" ]]; then
log_warning "Storage permission not granted"
return 1
fi
return 0
}
is_package_installed() {
dpkg -s "$1" &>/dev/null
}
install_package() {
local package="$1"
local skip_recommends="${2:-false}"
if is_package_installed "$package"; then
log_success "$package already installed"
return 0
fi
log_info "Installing $package..."
local apt_opts="-y -qq"
[[ "$skip_recommends" == "true" ]] && apt_opts="$apt_opts --no-install-recommends"
if apt install $apt_opts "$package" 2>&1 | grep -v "^debconf:"; then
log_success "$package installed"
return 0
else
log_error "Failed to install $package"
return 1
fi
}
confirm_action() {
local prompt="$1"
local default="${2:-n}"
local response
if [[ "$default" == "y" ]]; then
echo -ne "${YELLOW}${prompt} [Y/n]:${NC} "
else
echo -ne "${YELLOW}${prompt} [y/N]:${NC} "
fi
read -r response
response="${response:-$default}"
[[ "$response" =~ ^[Yy]$ ]]
}
update_package_lists() {
log_info "Updating package lists..."
if apt update -qq 2>&1 | grep -E "(Err:|E:)"; then
log_error "Failed to update package lists"
return 1
fi
log_success "Package lists updated"
}
check_free_space() {
local required_mb="$1"
local available_mb
available_mb=$(df -m "$TERMUX_HOME" | awk 'NR==2 {print $4}')
if [[ "$available_mb" -lt "$required_mb" ]]; then
log_error "Insufficient space: ${available_mb}MB available, ${required_mb}MB required"
return 1
fi
log_info "Available space: ${available_mb}MB"
}
# ========================
# Main Functions
# ========================
prepare_termux_environment() {
print_banner
echo -e "${PURPLE}════════════════════════════════════════${NC}"
echo -e "${BLUE}Stage 1: Preparing Termux Environment${NC}"
echo -e "${PURPLE}════════════════════════════════════════${NC}"
echo ""
# Check free space (at least 500MB)
check_free_space 500 || exit 1
# Setup storage permissions
if ! check_storage_permission; then
log_info "Requesting storage permissions..."
termux-setup-storage
sleep 2
if ! check_storage_permission; then
log_error "Storage permission denied. Please grant permission and retry."
exit 1
fi
fi
log_success "Storage access granted"
# Update repositories
update_package_lists || exit 1
# Install core packages (minimal set)
local core_packages=(
"figlet"
"wget"
"curl"
"git"
"proot"
"tar"
)
log_info "Installing core packages..."
local failed_packages=()
for pkg in "${core_packages[@]}"; do
install_package "$pkg" true || failed_packages+=("$pkg")
done
if [[ ${#failed_packages[@]} -gt 0 ]]; then
log_warning "Failed to install: ${failed_packages[*]}"
if ! confirm_action "Continue anyway?"; then
exit 1
fi
fi
# Optional: Install Python (can be large)
if confirm_action "Install Python 2 and 3? (may take time)"; then
install_package "python" true
install_package "python2" true || log_warning "Python2 may not be available in your repository"
fi
log_success "Termux environment ready!"
sleep 2
}
download_ubuntu_script() {
print_banner
echo -e "${PURPLE}════════════════════════════════════════${NC}"
echo -e "${BLUE}Stage 2: Installing proot-distro${NC}"
echo -e "${PURPLE}════════════════════════════════════════${NC}"
echo ""
cd "$TERMUX_HOME" || exit 1
if command -v proot-distro &>/dev/null; then
log_success "proot-distro already installed"
return 0
fi
log_info "Installing official proot-distro..."
if install_package "proot-distro"; then
log_success "proot-distro installed successfully"
else
log_error "Failed to install proot-distro"
exit 1
fi
# Show available distributions
log_info "Available distributions:"
proot-distro list | head -10
sleep 2
}
install_ubuntu_environment() {
print_banner
echo -e "${PURPLE}════════════════════════════════════════${NC}"
echo -e "${BLUE}Stage 3: Installing Ubuntu (proot-distro)${NC}"
echo -e "${PURPLE}════════════════════════════════════════${NC}"
echo ""
cd "$TERMUX_HOME" || exit 1
# Check if already installed
if proot-distro list 2>/dev/null | grep -q "installed.*$DISTRO_NAME"; then
log_warning "Ubuntu is already installed"
if ! confirm_action "Reinstall Ubuntu?"; then
log_info "Using existing Ubuntu installation"
return 0
fi
log_info "Removing existing installation..."
proot-distro remove "$DISTRO_NAME"
fi
log_info "Installing Ubuntu via proot-distro (5-10 minutes)..."
log_warning "Do not close Termux during installation!"
echo ""
# Install with progress
if proot-distro install "$DISTRO_NAME"; then
log_success "Ubuntu installation completed!"
else
log_error "Ubuntu installation failed (exit code: $?)"
exit 1
fi
log_success "Ubuntu environment ready"
sleep 2
}
setup_fluxion() {
print_banner
echo -e "${PURPLE}════════════════════════════════════════${NC}"
echo -e "${BLUE}Stage 4: Installing Fluxion Tools${NC}"
echo -e "${PURPLE}════════════════════════════════════════${NC}"
echo ""
cd "$TERMUX_HOME" || exit 1
# Verify proot-distro installation
if ! proot-distro list 2>/dev/null | grep -q "installed.*$DISTRO_NAME"; then
log_error "$DISTRO_NAME is not installed!"
exit 1
fi
log_info "Preparing Fluxion installation script..."
# Create optimized installation script for proot-distro
cat > install_fluxion.sh << 'INSTALL_SCRIPT'
#!/bin/bash
set -e
echo "[INFO] Updating package lists..."
apt-get update -qq
echo "[INFO] Upgrading existing packages..."
apt-get upgrade -y -qq 2>&1 | grep -v "^debconf:"
echo "[INFO] Installing wireless tools and dependencies..."
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \
git \
net-tools \
wireless-tools \
aircrack-ng \
isc-dhcp-server \
hostapd \
iptables \
dnsmasq \
lighttpd \
php-cgi \
curl \
wget \
unzip \
2>&1 | grep -v "^debconf:"
echo "[INFO] Installing optional penetration testing tools..."
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \
reaver \
bully \
pixiewps \
hashcat \
ettercap-text-only \
sslstrip \
macchanger \
2>&1 | grep -v "^debconf:" || echo "[WARN] Some optional tools failed"
cd /root
if [ -d "fluxion" ]; then
echo "[INFO] Updating existing Fluxion..."
cd fluxion
git pull -q
else
echo "[INFO] Cloning Fluxion repository..."
git clone -q https://github.com/FluxionNetwork/fluxion.git
cd fluxion
fi
chmod +x fluxion.sh
echo "[SUCCESS] Fluxion installation complete!"
INSTALL_SCRIPT
chmod +x install_fluxion.sh
log_info "Installing tools in Ubuntu environment..."
log_warning "This will take 10-20 minutes depending on connection"
echo ""
# Run installation in proot-distro
if proot-distro login "$DISTRO_NAME" --shared-tmp -- bash -c "cd $TERMUX_HOME && bash install_fluxion.sh"; then
log_success "All tools installed successfully!"
else
log_error "Tool installation failed"
exit 1
fi
# Cleanup
rm -f install_fluxion.sh
echo ""
echo -e "${GREEN}╔════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ INSTALLATION COMPLETE! ✓ ║${NC}"
echo -e "${GREEN}║ Fluxion Ready! ║${NC}"
echo -e "${GREEN}╚════════════════════════════════════════╝${NC}"
echo ""
echo -e "${BLUE}To start Fluxion:${NC}"
echo -e " ${YELLOW}1.${NC} proot-distro login $DISTRO_NAME"
echo -e " ${YELLOW}2.${NC} cd fluxion"
echo -e " ${YELLOW}3.${NC} ./fluxion.sh"
echo ""
echo -e "${PURPLE}Quick start (one command):${NC}"
echo -e " ${YELLOW}proot-distro login $DISTRO_NAME --shared-tmp -- bash -c 'cd fluxion && ./fluxion.sh'${NC}"
echo ""
echo -e "${BLUE}Or create an alias in ~/.bashrc:${NC}"
echo -e " ${YELLOW}alias fluxion='proot-distro login $DISTRO_NAME -- bash -c \"cd fluxion && ./fluxion.sh\"'${NC}"
echo ""
}
show_system_info() {
log_info "System Information:"
echo " • Termux Prefix: $TERMUX_PREFIX"
echo " • Home Directory: $TERMUX_HOME"
echo " • Free Space: $(df -h "$TERMUX_HOME" | awk 'NR==2 {print $4}')"
echo " • Architecture: $(uname -m)"
echo ""
}
# ========================
# Main Execution
# ========================
main() {
check_termux
print_banner
show_system_info
echo -e "${YELLOW}⚠ WARNING ⚠${NC}"
echo "This script will:"
echo " • Install Ubuntu (proot) in Termux (~200-500MB)"
echo " • Install wireless pentesting tools"
echo " • Require storage permissions"
echo " • Take 15-30 minutes to complete"
echo ""
echo -e "${RED}Note: Root access is NOT required${NC}"
echo -e "${RED}Note: Some tools may not work without proper hardware${NC}"
echo ""
if ! confirm_action "Do you want to proceed with installation?"; then
log_info "Installation cancelled by user"
exit 0
fi
echo ""
prepare_termux_environment
download_ubuntu_script
install_ubuntu_environment
setup_fluxion
}
# Handle script interruption
trap 'echo -e "\n${RED}Installation interrupted!${NC}"; exit 130' INT TERM
# Run main function
main "$@"