GithubHelp home page GithubHelp logo

suuhm / raspi_mpeg_license_patch.sh Goto Github PK

View Code? Open in Web Editor NEW
29.0 4.0 5.0 98 KB

Simple helper & proof of concept script to activate forgotten mpeg2 & and vc codec licenses on raspberry pi

License: GNU General Public License v3.0

Shell 100.00%
raspberry-pi patch license mpeg2 vc shell-script raspi kodi libreelec raspbian crack hack linux licensing htsp tvheadend osmc

raspi_mpeg_license_patch.sh's Introduction

raspi_mpeg_license_patch.sh

Simple hack & proof of concept script to activate (forgotten) mpeg2 and VC codec licenses on raspberry pi

BASED AS SHELL Proof of Concept and HELPER ON:

https://github.com/nucular/raspi-keygen


How to run the script:

Simply run this one-liner:

wget https://raw.githubusercontent.com/suuhm/raspi_mpeg_license_patch.sh/main/raspi_mpeg_license_patch.sh -qO- | bash -s -- --patch-now

You can also easily patch/check with the additional --os=<raspbian|libreelec|osmc|xbian> parameters if you want to specificate your Raspi-Enviroment.

For Example, if you want to patch libreElec:

raspi_mpeg_license_patch.sh --patch-now --os=libreelec
and reboot your Raspi.



Tested on libreelec 9x & raspbian and OSMC (Rpi1 -3)

Functions:

  • --check-only Only checking if yet patched
  • --patch-now To Patch the system
  • --reset-to-original Reset the start.elf to original state
  • Autodetect of start.elf file in your system

(On Raspbian and other OS you have to replace START_ELF=/flash/start.elf with START_ELF=/boot/start.elf or something else keep in mind some directories can be variable!)



!!!! IMPORTANT NOTE !!!!

PLEASE BUY THE LICENSES - THIS SCRIPT IS JUST FOR RECOVER CASES!!!

I don't take responsibility for any damages, you have to do your backup before!

SEE MORE:

https://codecs.raspberrypi.org/mpeg-2-license-key/

raspi_mpeg_license_patch.sh's People

Contributors

suuhm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

raspi_mpeg_license_patch.sh's Issues

Something went wrong, exit now..

     ____________________________________________________ 
    |><><><><><><><><><><><><><><><><><><><><><><><><><><|
    |  raspi_mpeg_license_patch v0.4b - (c)2022 suuhm    |
    |____________________________________________________|
                                                          

[*] First check mpeg2/vc activated?
MPG2=disabled
WVC1=disabled

[+] Getting Hexstring... May take some time...

[!] Not patched (0x) continue...

[*] set up patch now () ...
bash: line 172: [: -eq: unary operator expected
bash: line 183: [: -eq: unary operator expected
[!] Something went wrong, exit now..

Another new string maybe? I'm not sure how I would find that..

This is on a pi0 but I had the same error on a pi2 as well.

LibreELEC 9 and 10 - $HS empty

On both Raspi 3 B+ with libreELEC 9.x and current 10.x patching failed:
./raspi_mpeg_license_patch.sh --patch-now --os=libreelec

and following output:

  ____________________________________________________ 
  |><><><><><><><><><><><><><><><><><><><><><><><><><><|
  |  raspi_mpeg_license_patch v0.4b - (c)2022 suuhm    |
  |____________________________________________________|
                                                        
* Getting some necessary tools, maybe this take some time...

[*] First check mpeg2/vc activated?
MPG2=disabled
WVC1=disabled

[+] Getting Hexstring... May take some time...

Using hexdump (beta)
[!] Not patched (0x) continue...

[*] set up patch now () ...
bash: 3: unknown operand
bash: 4: unknown operand
[!] Something went wrong, exit now..

As you can see $HS is empty.

Maybe same issue like #5 on raspbian?

-- EDIT --
Since on libreelec your script uses hexdump, I investigated further and found the REGEX not matching due to a line break in the hexdump output. Maybe the start.elf Version changed?

REGEX2=".*47\ *e9\ *3(3|4)\ *36\ *32\ *48\ *(1d|3c)\ *(18|1f)\ .*"

but you can see between 32 and 48 there ist the linechange.

...
000b788f c0 02 e8 33 36 32 48 07 80 22 48 47 e9 34 36 32 |...362H.."HG.462|
000b789f
48 1d 18 47 e9 30 43 56 4d 19 18 47 e9 34 47 50 |H..G.0CVM..G.4GP|
...

REGEX of ".*48\ *(1d|3c)\ (18|1f)\ ." seems to be an unique hit in my start.elf version, so maybe the script can be changed.

Or use a Hex Editor (like Hex Fiend on Mac OS) and just replaced 47 E9 34 36 32 48 1D 18 by 47 E9 34 36 32 48 1D 1F manually - tested successfully.

vcgencmd codec_enabled MPG2 ==> MPG2=disabled

this is the output of the script --check-only


|><><><><><><><><><><><><><><><><><><><><><><><><><><|
| raspi_mpeg_license_patch v0.3b - (c)2021 suuhm |
|____________________________________________________|

START.ELF not found. Searching for possible files:

find: ‘/proc/8301/task/8301/net’: Invalid argument
find: ‘/proc/8301/net’: Invalid argument
/boot/start.elf.BACKUP
/boot/start.elf
/boot/start_cd.elf
/boot/start_db.elf
/boot/start_x.elf
/boot/start4.elf
/boot/start4cd.elf
/boot/start4db.elf
/boot/start4x.elf


Please enter the full Path to the START.ELF:
/boot/start.elf

  • Getting some necessary tools, maybe this take some time...
    Tools already just here, continue...

  • First check mpeg2/vc activated?
    MPG2=disabled
    WVC1=disabled

  • Getting Hexstring... May take some time...

  • Already Patched

whats wrong?

ko with Raspbian GNU/Linux 12 (bookworm)"

I get

root@raspberrypi:~# START_ELF=/boot/start.elf
root@raspberrypi:~# /home/matteo/raspi_mpeg_license_patch.sh --patch-now
     _________________________________________________________ 
    |><><><><><><><><><><><><><><><><><><><><><><><><><><><><>|
    |                                                         |
    |  raspi_mpeg_license_patch v0.4.2b - (c) 2023 suuhm      |
    |                                                         |
    |  !!! IMPORTANT NOTE !!!                                 |
    |  PLEASE BUY THE LICENSES!                               |
    |  THIS SCRIPT IS JUST FOR RECOVER CASES!                 |
    |_________________________________________________________|
                                                               
START.ELF not found. Searching for possible files:
---------------------------------------------

/boot.bak/start4cd.elf
/boot.bak/start4.elf
/boot.bak/start4db.elf
/boot.bak/start_cd.elf
/boot.bak/start_db.elf
/boot.bak/start.elf.BACKUP
/boot.bak/start_x.elf
/boot.bak/start.elf
/boot.bak/start4x.elf
/boot/start.elf.BACKUP
/boot/start.elf
/boot/start_cd.elf
/boot/start_db.elf
/boot/start_x.elf
/boot/start4.elf
/boot/start4cd.elf
/boot/start4db.elf
/boot/start4x.elf

---------------------------------------------

Please enter the full Path to the START.ELF: /boot/start.elf              
[*] Checking for necessary tools, maybe this take some time...

[*] Found tools, continue.

[*] First check mpeg2/vc activated?
MPG2=disabled
WVC1=disabled

[+] Getting Hexstring... May take some time...

[*] Using xxd
[!] Not patched (0x) continue...

[*] Start Patching () ...
/home/matteo/raspi_mpeg_license_patch.sh: line 219: [: -eq: unary operator expected
/home/matteo/raspi_mpeg_license_patch.sh: line 231: [: -eq: unary operator expected
[!] Something went wrong, exit now..
root@raspberrypi:~# uname -a
Linux raspberrypi 6.1.21-v7+ #1642 SMP Mon Apr  3 17:20:52 BST 2023 armv7l GNU/Linux
root@raspberrypi:~# cat /etc/os-release 
PRETTY_NAME="RaspbiaRaspbiann GNU/Linux 12 (bookworm)"
NAME="Raspbian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

codecs still disabled after patching

After I run the script (Raspberry pi 3B+, OSMC) the codecs are stil disabled, as indicated by the check:

   ____________________________________________________ 
  |><><><><><><><><><><><><><><><><><><><><><><><><><><|
  |  raspi_mpeg_license_patch v0.3b - (c)2021 suuhm    |
  |____________________________________________________|
                                                        
* Getting some necessary tools, maybe this take some time...
Tools already just here, continue...
* First check mpeg2/vc activated?
MPG2=disabled
WVC1=disabled


* Getting Hexstring... May take some time...

* Already Patched


* Check state xxd location +/- 1 line:
000b7440: 9a18 1060 009e 7f00 47e9 3247 504d 1018  ...`....G.2GPM..
000b7450: 02e8 3336 3248 47e9 3336 3248 091f 47e9  ..362HG.362H..G.
000b7460: 3447 504d 0518 47e9 3143 5657 c918 0060  4GPM..G.1CVW...`

* get GPUtemp every 5 secs... (STOP with Ctrl+C)

Am I doing something wrong?

Codecs disabled after patching on recent libreelec and raspbian

Not sure if a new regex is needed or if I can use an older start.elf?

pi@rpi ~> sudo bash raspi_mpeg_license_patch.sh --patch-now --os=raspbian
     _________________________________________________________
    |><><><><><><><><><><><><><><><><><><><><><><><><><><><><>|
    |                                                         |
    |  raspi_mpeg_license_patch v0.4.2b - (c) 2023 suuhm      |
    |                                                         |
    |  !!! IMPORTANT NOTE !!!                                 |
    |  PLEASE BUY THE LICENSES!                               |
    |  THIS SCRIPT IS JUST FOR RECOVER CASES!                 |
    |_________________________________________________________|


[*] First check mpeg2/vc activated?
MPG2=disabled
WVC1=disabled

[+] Getting Hexstring... May take some time...

[*] Using xxd
[!] Not patched (0x18) continue...

[*] Start Patching (1D) ...
[~] Using > 2022 patch (HS_MODE: 4)

*********************
[*] Finished. success

New md5sum: 0e8ddde49c47fb2cd6f7a229303f83cb  /boot/start.elf
Old md5sum: 66cb6612b87a371de4fd90adce8c68dd  /boot/start.elf.BACKUP


[!] Now, pls restart your device and check again.

Restart now? continue? (y/n) : y
Connection to rpi closed by remote host.
Connection to rpi closed.
pi@rpi ~/share> for codec in H264 MPG2 WVC1 MPG4 MJPG WMV9
                                                 vcgencmd codec_enabled $codec
                                             end
H264=enabled
MPG2=disabled
WVC1=disabled
MPG4=disabled
MJPG=enabled
WMV9=disabled
pi@rpi ~ [1]> sudo bash raspi_mpeg_license_patch.sh --patch-now --os=raspbian
     _________________________________________________________
    |><><><><><><><><><><><><><><><><><><><><><><><><><><><><>|
    |                                                         |
    |  raspi_mpeg_license_patch v0.4.2b - (c) 2023 suuhm      |
    |                                                         |
    |  !!! IMPORTANT NOTE !!!                                 |
    |  PLEASE BUY THE LICENSES!                               |
    |  THIS SCRIPT IS JUST FOR RECOVER CASES!                 |
    |_________________________________________________________|


[*] First check mpeg2/vc activated?
MPG2=disabled
WVC1=disabled

[+] Getting Hexstring... May take some time...

[*] Using xxd
[~] Already Patched (0x1f)`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.