hyugogirubato / KeyDive

Extract Widevine L3 keys from Android devices effortlessly, spanning multiple Android versions for DRM research and education.
https://pypi.org/project/keydive/
MIT License
400 stars 73 forks source link

Batch script #4

Closed Pipixel closed 7 months ago

Pipixel commented 7 months ago

Hi, I used the scripts from https://github.com/sim0n00ps/L3-Dumping and change few things for being automatic with a single batch file, what do you think? The setup is that same from the repository I shared. I'm not used to do this so it's the best I can do. It happens the script can block itself to the Frida Server starting, just restarting the script solve the issue.

@echo off

::Script source: https://github.com/sim0n00ps/L3-Dumping

echo.
echo.
echo ####################################################
echo #                                                  #
echo #                KeyDive script                    #
echo #       Widevine L3 Extractor for Android          #
echo #                                                  #
echo #                                                  #
echo #          PHONE MUST BE ROOTED TO WORK.           #
echo #                                                  #
echo ####################################################
echo.
echo.

set /P c=Do you want to install requirements.txt[Y/N]?
if /I "%c%" EQU "Y" goto :install_python_requirements
if /I "%c%" EQU "N" goto :keydive

:install_python_requirements
echo.
echo #################################
echo #                               #
echo #  Installing requirements.txt  #
echo #                               #
echo #################################
echo.
echo A new window will open for requirements.txt in 5 sec. Once everything installs, you can close the window.
timeout /t 5 > nul
start cmd /k pip install -r requirements.txt
pause

:KeyDive

::Frida Server initialization
echo.
echo.
echo ###########################
echo #                         #
echo #  Starting Frida Server  #
echo #                         #
echo ###########################
echo.
echo.

set adb_path="YOUR PATH TO adb.exe HERE"
set frida_server_name=YOUR FRIDA SERVER VERSION HERE

cd /d "C:\platform-tools"

%adb_path% push %frida_server_name% /sdcard

echo su > commands.txt
echo mv /sdcard/%frida_server_name% /data/local/tmp >> commands.txt
echo chmod +x /data/local/tmp/%frida_server_name% >> commands.txt
echo /data/local/tmp/%frida_server_name% >> commands.txt
%adb_path% shell < commands.txt
del commands.txt

::KeyDive start
echo.
echo.
echo ####################
echo #                  #
echo #     KeyDive      #
echo #                  #
echo ####################
echo.
echo.

set "folder_path=YOUR PATH HERE"

set "python_script=keydive.py"

cd /d "%folder_path%"

python "%python_script%"

pause
endlocal
hyugogirubato commented 7 months ago

@Pipixel I cannot validate the use of a batch script because it is something where there are too many parameters that vary. The user is also required to modify the script by hand. The idea of ​​KeyDive is to automate everything, not to create files by hand. Additionally, usage/installation of frida varies depending on users using Magisk or not.

But the idea was interesting, thank you for sharing it!