Commit Graph

5 Commits

Author SHA1 Message Date
Developer 297377b7c6 FIX: Critical startup flow issues - terminal crashes, inefficiency, inconsistency
CRITICAL FIXES:
- TERMINAL CRASH: Changed 'exit 1' to 'return 1' in library sourcing (lines 21-25)
  Cause: When launcher.sh sourced from run.sh, 'exit' terminated the parent shell
  Impact: Terminal no longer crashes when libraries fail to load

- CLEANUP FILE PATH: Simplified cleanup file creation to use consistent path
  Old: Created random temp file with mktemp (never checked by run.sh)
  New: Direct creation of /tmp/.cleanup_requested (checked by run.sh)
  Impact: Cleanup now works correctly on exit

HIGH PRIORITY:
- DATABASE QUERY OPTIMIZATION: Replaced 4 separate grep -c calls with single awk pass
  Old: 4 separate grep calls on same file (lines 666-669)
  New: Single awk pass with field counting (line 671)
  Impact: ~75% faster startup detection summary display

MEDIUM PRIORITY:
- CONSISTENT ERROR HANDLING: Standardized all read commands to use explicit failure checks
  Pattern: if ! read ... </dev/tty 2>/dev/null; then ... fi
  Applied to: startup detection prompt (line 681), main menu (line 705), cleanup prompt (line 720)
  Impact: Clearer error handling throughout launcher

- DIRECTORY INITIALIZATION: Moved init_directories out of main loop
  Old: Called on every main() invocation
  New: Called once at startup with error handling
  Impact: Fewer redundant directory creation attempts

- RUN.SH ERROR HANDLING: Added error handling for launcher.sh sourcing
  Added: Check for successful launcher.sh load with helpful error message
  Impact: Better failure diagnostics if launcher fails to load

VERIFICATION:
- Tested startup flow: Launcher initializes without crashes
- Verified menu displays correctly
- Confirmed cleanup file path consistency
- All error handling patterns standardized
2026-03-19 22:44:39 -04:00
Developer ac6c0b5c12 FIX: Improve startup flow error handling and correctness
CRITICAL: Library sourcing error handling
- launcher.sh lines 21-25: Added error checks for all source commands
- Each library now reports if it fails to load
- Script exits with message instead of silent failure

MEDIUM: init_directories error checking
- launcher.sh lines 630-631: Added error handling for mkdir -p
- Script now reports if directory creation fails
- Better user feedback on initialization errors

HIGH: Stderr redirect cleanup
- run.sh line 14: Removed misplaced 2>/dev/null after closing bracket
- launcher.sh lines 678, 694: Reordered redirects for clarity
  (read ... </dev/tty 2>/dev/null instead of 2>/dev/null </dev/tty)

REASON: Improves startup robustness by catching initialization failures
early and providing helpful error messages instead of silent failures.
2026-03-19 22:37:46 -04:00
Developer 9048066a49 fix: Source launcher in current shell instead of subshell - keeps menu interactive 2026-03-19 20:22:01 -04:00
cschantz b7417a6bfa Fix live-attack-monitor auto-blocking and bot-analyzer compression
- live-attack-monitor.sh:
  * Remove snapshot loading (start fresh each session)
  * Fix Apache log monitoring to use tail -n 0 -F (only new entries)
  * Add IP file sync to main loop for auto-blocking to work
  * Fix IP_DATA consolidation for cross-process communication

- bot-analyzer.sh:
  * Implement gzip compression for large temp files (10-20x space savings)
  * Update all read/write operations to use compressed files
  * Fix for servers with 200+ domains and millions of log entries

- run.sh:
  * Add HISTFILE fallback to prevent crashes when sourced
2025-11-17 22:28:38 -05:00
cschantz fae334384e Add wrapper script for automatic cleanup with zero manual steps
New workflow:
1. User runs: source run.sh (instead of bash launcher.sh)
2. Launcher runs normally
3. On exit with cleanup=yes, launcher sets flag file
4. Wrapper detects flag and does ALL cleanup automatically:
   - Cleans ~/.bash_history file
   - Clears current shell's in-memory history
   - Removes toolkit directory
   - No manual commands needed

The key: wrapper is SOURCED so it runs in parent shell and can modify history.

User experience: answer "yes" and cleanup happens instantly, automatically.
2025-11-11 18:22:10 -05:00