Guest User

mosylesniper.sh

a guest
Sep 10th, 2025
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # === FUNCTIONS ===
  4.  
  5. # Function to show a notification
  6. show_notification() {
  7. local title="$1"
  8. local message="$2"
  9. osascript <<EOF
  10. display notification "$message" with title "$title" subtitle "Script completed successfully"
  11. beep
  12. EOF
  13. }
  14.  
  15. # Function to crash an app or process and check if it was killed
  16. crash_process() {
  17. local process_name="$1"
  18. local process_path="$2"
  19.  
  20. # Check if the process exists
  21. if pgrep -f "$process_path" > /dev/null; then
  22. echo "Attempting to kill process $process_name..."
  23. pkill -f "$process_path" 2>/dev/null || true
  24. sleep 2 # Wait for the process to terminate
  25.  
  26. # Check if the process is still running
  27. if pgrep -f "$process_path" > /dev/null; then
  28. echo "❌ Failed to kill $process_name. It is still running."
  29. else
  30. echo "✅ Successfully killed $process_name."
  31. fi
  32. else
  33. echo "⚠️ Process $process_name not found. It may not be running."
  34. fi
  35. }
  36.  
  37. # === MAIN EXECUTION ===
  38.  
  39. # Show initial notification
  40. show_notification "Mosyle App Crashing" "Starting to crash Mosyle apps and processes to unblock your apps..."
  41.  
  42. # List of Mosyle processes and paths to kill
  43. MOSYLE_PROCESSES=(
  44. "/Library/Application Support/Mosyle/MosyleAuth.app/Contents/MacOS/MosyleAuth"
  45. "/Library/Application Support/Mosyle/Mosyle.app/Contents/MacOS/Mosyle"
  46. "/Library/Application Support/Mosyle/Mosyle MDM Agent.app/Contents/MacOS/Mosyle MDM Agent"
  47. "/Library/Application Support/Mosyle/Notification Center.app/Contents/MacOS/Notification Center"
  48. "/Library/Application Support/Mosyle/MosyleMonitor.app/Contents/MacOS/MosyleMonitor"
  49. "/Library/Application Support/Mosyle/MosyleMDM.app/Contents/MacOS/MosyleMDM"
  50. "/Library/Application Support/Mosyle/Mosyle.app/Contents/MacOS/msnotificationd"
  51. )
  52.  
  53. # Loop through each process and try to kill it
  54. for process_path in "${MOSYLE_PROCESSES[@]}"; do
  55. process_name=$(basename "$process_path")
  56. crash_process "$process_name" "$process_path"
  57. done
  58.  
  59. # Final notification
  60. show_notification "Process Check Complete" "All Mosyle processes have been checked. See the terminal for details."
  61.  
  62. # Optional: Add a message in the console
  63. echo "✅ Script completed. All Mosyle processes have been checked. See above for details."
  64.  
  65. # Optional: Wait a bit so user sees the popup
  66. sleep 3
  67.  
  68. # Exit cleanly
  69. exit 0
Advertisement
Add Comment
Please, Sign In to add comment