Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We need a sane approach to encrypted signatures #948

Closed
FiloSottile opened this issue Jun 27, 2013 · 7 comments
Closed

We need a sane approach to encrypted signatures #948

FiloSottile opened this issue Jun 27, 2013 · 7 comments

Comments

@FiloSottile
Copy link
Collaborator

@FiloSottile FiloSottile commented Jun 27, 2013

We need a good way to handle:

  • automatic tests to look for new algos
  • the errors when new algos come up or when they change (UnavailableVideoError sucks), making it easy for the user to report useful info
  • the process of reversing on our side
  • the way to add and distribute them (should we make a fastlane for these? download the algos automatically?)
FiloSottile added a commit that referenced this issue Jun 27, 2013
@FiloSottile
Copy link
Collaborator Author

@FiloSottile FiloSottile commented Jun 27, 2013

The UnavailableVideoError are caused by 403 HTTP errors...

@plfort
Copy link

@plfort plfort commented Sep 20, 2013

I am using the "_decrypt_signature" function from youtube extractor in an Android app, but since it changes all the time I needed a different approach (to avoid to push a new release on every change).
I decided to use JSON to describe the algorithm then to "compile" it to decrypt the signature.
Here is the JSON file : https://github.com/plfort/ytdecrypt/blob/master/json/youtube-dl.json
And the repo : https://github.com/plfort/ytdecrypt
With this approach, it is pretty simple to describe and update the algorithm for all languages.

In addition, I wrote a simple class "YoutubeSelenium.java" for test automation, you need to provide videos id through "addYoutubeId" and start testing with "execute". It produces a simple HTML page with test results in "testResult" folder.

Do you have any videos to test all signatures length ?

This is rather a draft, the code can be greatly improved.

@np1
Copy link

@np1 np1 commented Sep 21, 2013

Hi, previously I also copied the _decrypt_signature function to use in my project, pafy (python api for youtube). It resulted in too many updates, so recently I wrote some python code to use regexp's to extract and parse the javascript decryption functions and process the signatures in python. This way does not use eval/exec (which I prefer not to use) and has worked for the last few signature changes. Feel free to take a look for ideas in using with your Android app. https://github.com/np1/pafy/blob/master/pafy.py#L41-L119

@plfort
Copy link

@plfort plfort commented Sep 21, 2013

Hello !
I saw this approach here #1208, it is an very interesting solution !
Thank you, I will take a look !

@np1
Copy link

@np1 np1 commented Sep 21, 2013

Yes I have seen that too. It's somewhat different, it generates python code from the javascript code. It could potentially facilitate an arbitrary code execution type attack but it is more versatile and requires less processing of the original javascript. Both approaches have their advantages/disadvantages.

@phihag
Copy link
Contributor

@phihag phihag commented Oct 11, 2013

@dentex Thanks, but we just forgot to close this issue. We have automatic signature extraction for quite a while.

@phihag phihag closed this Oct 11, 2013
@dentex
Copy link

@dentex dentex commented Oct 11, 2013

Oh! Great.
Bye.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.