h4ck-rOOt / Lynda-Decryptor

Decrypts all .lynda and .ldcw files from the video2brain desktop app.
MIT License
213 stars 73 forks source link

Can you decrypt caption file to srt subtitle #9

Open kimvuchannel opened 7 years ago

kimvuchannel commented 7 years ago

Please help me. I think you can do it :)

dungtd91 commented 7 years ago

Please help me. Decrypt caption file to srt

mdomnita commented 7 years ago

Maybe I will try to do it if nobody started to, shouldn't be very difficult. Studied the file structure a bit and does not seem to be a big issue. Just got to get used to the project a bit as I am not a VS developer.

h4ck-rOOt commented 7 years ago

@dungtd91 @kimvuchannel please take a look at this little app Lynsub. Maybe this will help you out. Personally i don't know what files needed to decrypt them to srt format.

So it's necessary to take a look at the original source code of the lynda.com app... but i have spare time left atm, so it would be nice if @mdomnita can solve this.

kimvuchannel commented 7 years ago

@h4ck-rOOt A few months ago, lynda subtitle creation is easy...but lynda have fixed. Free user can't view transcript of many course or view with text format. Lyndasub.ir is down. I have download lynsub app but it not working :(

mdomnita commented 7 years ago

@h4ck-rOOt , this is the main issue with the subtitles. They are there in the .caption files in the folder. I don't seem to be able to find a way to link the .caption file to the .lynda file. There is nothing in the DB and I did not notice any kind of connection. The only way I could do it is by ordering the files by date created (both the .lynda and the .caption and creating a Hash (dictionary, list, whatever) that links the .lynda file to the .caption. This is the biggest issue and I don't know if this approach is correct, it's actually a workaround that presumes the .caption files were downloaded in the same order as the videos. Other than this, the timestamps are in the .caption, the text is in the .caption. Seems to me everything that has to be done is cleaning the .caption file, removing the "useless" characters, create a list with timestamps and subtitle text and generate the .srt file according to the pretty clear and simple .srt specific format. As I said, I will try to do it. Those "useless" characters appear different in different viewers, I have no idea on what info is there and what the Lynda app does with it. However, all the subtitle text and timestamps are in plain text.

mdomnita commented 7 years ago

Well, I did it. I mean, sort of. I wrote the code to convert from .caption files to .srt files, I was not able to figure out the logic behind how the desktop app links the .lynda files to the .caption files, nothing in the database tables or in the .lynda file contents. Maybe it's stored directly in the binary movie file, I have no ideas. Also, not all the non-printable characters that remained there from the structure of the .caption file were removed. But it works and it's readable. Get and try the thing from here https://goo.gl/c0t4ic Just do LyndaCaptionToSrtConvertor.exe /D your_dirwith.caption_files and you will get the subtitles in the same dir. And the repository is here. https://github.com/mdomnita/LyndaCaptionToSrtConvertor with everything explained in the code comments. It's a very crude solution but it works and maybe someone who has C# skills can help me improve it. As I said, I usually develop Perl and JS but I did this in C# so that someone may probably improve it a bit and include it in this project.

KTsarlz commented 7 years ago

@mdomnita Appreciate it man! There are some extra letters, But they are readable. The only trouble I come across with is that the captions files does not have same filename to the .lynda files, hence testing each and everyone is kinda tedious Haha

mdomnita commented 7 years ago

Yeah, I know that. i will try to find a way to relate the .lynda files to the .caption but I did not find out how it works yet. I ll keep you notified if I do

h4ck-rOOt commented 7 years ago

It would ne nice to have some caption files to do this kind of magic and translate them depending on database entries.

Could someone provide these files, tests or even compare encrypted and decrypted files? There must be a hint in their code (try reverse engineering).

On 13 Nov 2016, at 14:39, Matei Domnita notifications@github.com wrote:

Yeah, I know that. i will ry to find a way to relate the .lynda files to the .caption but I did not find out how it works yet. Ițll keep you notified if I do

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

mdomnita commented 7 years ago

I further cleaned the .caption file and removed more or less all that is not actual subtitle text. The Program.cs is commited in the mentioned repo and every "move" is commented there. I updated link to executable in the previous comment. Related to link between .caption files and .lynda files, a friend (that used reverse engineering) gave me a hint: protected string GetCaptionFileName(Video video) { return (Hash.MD5(video.ID.ToString()) + ".caption"); } I obviously have files to test with but I don't know if/how I could post them here so that the guys at linkedin don't delete my account on github. (kidding, obviously, but wouldn't just post copyrighted lynda files around like that). Maybe there is something really free that anyone can try the app with on their site?

emon2196 commented 7 years ago

@mdomnita thanks u, i converted all sub file successful but I wonder how to know which sub is right for a video ? plz help <3

Dev-iL commented 7 years ago

@emon2196 the subtitle file name is the md5 hash of the video ID.

@h4ck-rOOt would you add subtitle file renaming (according to the hash logic) to your code as a first step before conversion is integrated?

emon2196 commented 7 years ago

@Dev-iL Thanks for reply but I don't get it. U mean sub file name = MD5 hash of video ? I checked with course: " Illustrator CC 2015 one vs one advance" but it not correct

Dev-iL commented 7 years ago

@emon2196 This is absolutely not what I meant.

Assuming the videoID is 513444 (you find this in the SQLite .db file), then the MD5 of this number is e6c00103ac221a34d8e78c93ece94daa and so the subtitle filename is that hash + .caption.

I hope it's clearer now.

mdomnita commented 7 years ago

I managed to get the subtitle filename. It wasn't just a line of code like I wrote above (obviously, that was just to give a suggestion on how the filename is obtained) but I got it right, anyway with something similar. I did the conversion for a single file and it works, will work on full directory conversion tomorrow. I still need to improve/rewrite the srt convertor I did, after doing some reverse engineering on the application code. For the moment I get most of the subtitles right, about 90% but it's still something created based on trial and error, not on study and logic (the conversion from .caption to .srt format). I will keep you updated if I manage to get some results and commit anything.

mdomnita commented 7 years ago

Ok, I did the file renaming and subtitle conversion. Added my own class that does subtitle conversion and created a pull request. Subtitle conversion (the actual .cption to .srt file conversion) still needs work but I will do it in the near future. Check out the binary from my gDrive https://goo.gl/UDfof7 If you need the code before the pull request is reviewed by @h4ck-rOOt you can get it from the fork in my account

emon2196 commented 7 years ago

@mdomnita I tested your version. All videos have right subtiles <3 But your version can't choose output folder, it decrypt direct to course folders. And the second is it didn't change name and put videos file into each folder like h4ck-rOOt's version.

Anyway, thank so much much much much ....<3

mdomnita commented 7 years ago

@emon2196 , for me it works. Just add the parameter /OUT when running from the console. Make sure you have the Lynda Desktop App from their website (not the windows store). Get the files from the link, unpack them somewhere. This is how my directory with the LyndaDecryptor application looks like: http://i64.tinypic.com/2vv1h5x.jpg

Run command like this (approx): .\LyndaDecryptor.exe /DB c:\Users\\AppData\Local\lynda.com\Lynda.com Desktop App\db .sqlite /D c:\\\ /OUT c:...\

This is about it. Just tested and it works. You need to specify at least /DB the right path for the sqlite.db file and the /D directory with your course, in which case the app will create the structure into a subdirectory named "decrypted" there (thanks @h4ck-rOOt for that)

emon2196 commented 7 years ago

@mdomnita http://imgur.com/a/iT7tQ Here my commend. My file decrypted did not go to E:lynda but go to courses folder

mdomnita commented 7 years ago

I think that the DB.sqlite path might not be good? DOes the same for me when I don't give a right path to the DB. Check it out in the command prompt, the command is something like this :

if exist "c:\Users\\AppData\Local\lynda.com\Lynda.com Desktop App\db.sqlite" echo OK, it exists

Otherwise maybe it cannot find the course in your database? (can you see it in the Lynda desktop app and confirm everything's ok?). Will test further if everything looks ok from your side and try to figure out where your problem might be

emon2196 commented 7 years ago

@mdomnita yah i think that the problem (Y) I deleted all my courses and db.sqlite then download again. Everything working like a charm now <3 Thank so much <3

JPGrefaldo commented 6 years ago

Thank you, for adding the sub.

dhiaelhak47 commented 6 years ago

thanks :dagger: