Decrypt binary in PBS plugin

Hello,



First of all, I’m new to Plex channel plugins. I’m also relatively new to Python but I’ve been learning it pretty quickly.



As a way to get my feet wet, I installed the PBS plugin and looked at the underlying code. At a certain point in the code, it calls a “decrypt” binary executable given encrypted ReleaseUrl information from the PBS website. An example ReleaseUrl is:



aes$A6888BC5982221365D2A7AFCC83F6D2C$fweW+rvXTuZo+7n8Yq9m+rywi3DS85kIIB9I/cXhhckE0F72wIYbajqVEYGblVuRCBTVYCQf+6pN5xhLJTUsdTXK/ck/J7eNdNzIQ7nu/7ScrcvQ+nzV1weeeKsxx47iDzb6+wisoCpmDuglibllRw==



Now I am assuming that “aes” refers to AES encryption/decryption. I am assuming that “A6888BC5982221365D2A7AFCC83F6D2C” is the AES key. And I am assuming that “fweW+rvXTuZo+7n8Yq9m+rywi3DS85kIIB9I/cXhhckE0F72wIYbajqVEYGblVuRCBTVYCQf+6pN5xhLJTUsdTXK/ck/J7eNdNzIQ7nu/7ScrcvQ+nzV1weeeKsxx47iDzb6+wisoCpmDuglibllRw==” is some sort of encrypted string that needs to be decrypted. For the standard AES algorithm, the encrypted string is always hexadecimal. What format is this string in and how is it converted to hexadecimal so that AES can decrypt it?



Also, while I was playing around I tried to use the Python function “map” but Plex Python claimed that it was not defined. Is Plex Python a subset of Python?



Thanks for any help you can give me!


The channel includes the compiled decrypter because the details of the encryption scheme are not intended to be public knowledge. Unfortunately, that means we need to track down the source for that "helper" in order to compile it for more platforms so the plugin will work for more than just OSX installs of PMS.

The Plex plugin framework provides a customized python environment that excludes a number of the "normal" built-in python methods but also takes care of a lot of the background stuff so plugin developers don't need to sooty about it. If you really need functions/methods that aren't available in the framework, you can include them with an import statement in your __init__.py.


If "map" is a built-in Python function, what library would I import to gain access to it?

One other thing that has troubled me while I've been messing around is that if I try to modify a standard channel (one that is part of the channels you can install directly from the Plex Client, such as PBS), about every half day my tweaks to the code disappear and are reverted back to the default plugin. I tried sticking this:



in my plist, but it didn't seem to work.

Right now I've just been starting a new project and copying over the guts of another channel and then working on that copy.

You should just be able to use “import map”. I’m not familiar with map but, if that doesn’t work you could check the python doc pages to see ufnit’s actually contained in a larger built-in library that you could reference as “from blah import map”.



For development purposes, its generally better to grab the code for a plugin directly from GitHub “Github.com/plexinc-plugins”. If you don’t already have a github account, it’d be worth your while to sign up for one. Then, onv you’ve made and tested tour changes you can send a pull request for trm to be merged into the official version. Adding the DevMode key to the plist should work to prevent it being overwritten but, generally it’s recommended to keep your working copy outside of the plugins folder (desktop, or wherever) and just symlink it into the plugins folder. PMS will then run it as though its present but it won’t replac it with the store copy.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.