h4ck-rOOt / Lynda-Decryptor

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

Lynda now have ldcw files. Seems like this tool could not decrypt them. Could you be #12

Open anujsethi12 opened 7 years ago

anujsethi12 commented 7 years ago

Hi @h4ck-rOOt Lynda offline files now have .ldcw file extension. Seems like this tool could not decrypt them. I did try to change .ldcw file extension to .lynda extension so that this tool can read the files but the output file produced is either corrupted or some times the tool throws the error "Length of the data to decrypt is invalid." at line 354 - decryptionStream.Read(buffer, 0, buffer.Length);

Could you please try to see if there is a way to decrypt ldcw files as well.

Thank you very much for the awesome work :+1:

KTsarlz commented 7 years ago

Just downloaded a course, and still it has .lynda extension. Maybe it's depends on when the course was released?

mdomnita commented 7 years ago

For me they still have .lynda extension. Just downloaded one. Maybe the app on Windows 10 or Mac OS (if it exists) downloads them in another format or the new ones are encrypted in another way?

Fluto commented 7 years ago

Use the desktop application, it cannot be found normally via their website as Lynda redirects you to the Windows Store if you're not on Win7.

Try this

anujsethi12 commented 7 years ago

Hi @h4ck-rOOt - I had a windows store app on Windows 10 and I downloaded these videos around 2 months ago and they were in .ldcw file format. I do not have a active subscription any more and want to decrypt these files. This application is no able to decrypt .ldcw files even if I change the format to .lynda so that the application could read the files. Thanks everyone else for your insights but none of them is an option or solution for me :(

jeetkml commented 7 years ago

@anujsethi12 guys, .ldcw extension is only on, if you download from mobile apps, like store app, Windows or Android or may iOS, but, .Lynda extension avail on Desktop PC or MAC.

https://www.lynda.com/apps/desktop-app

Download last one , Windows 7+

I used Release Lynda 1.2 source, It's works for me, Command working for me: open_LyndaDecryptor.exe_location_in_CMD LyndaDecryptor /D "C:\Users\jeetk\Downloads\lynda\ldc_dl_courses\427440" /OUT "C:\Users\jeetk\Documents\Drive D\NEW FOLDER"

Dev-iL commented 7 years ago

If anyone wants to give .ldcw decryption a try, see below code pulled from the Android app:

package com.lynda.infra.encryption;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.support.annotation.NonNull;
import android.util.Base64;
import com.lynda.App;
import com.lynda.infra.storage.StorageHelper;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.security.Key;
import java.security.KeyStore;
import java.security.SecureRandom;
import javax.crypto.KeyGenerator;

public final class KeyHandler {
    private static Key a;
    private static byte[] b;

    private KeyHandler() {
    }

    public static Key a(@NonNull Context context) {
        FileOutputStream fileOutputStream;
        Throwable th;
        if (a != null) {
            return a;
        }
        Key c = c(context);
        a = c;
        if (c != null) {
            return a;
        }
        try {
            a = KeyGenerator.getInstance("AES").generateKey();
            c = a;
            try {
                KeyStore instance = KeyStore.getInstance(KeyStore.getDefaultType());
                instance.load(null, null);
                instance.setKeyEntry("lynda.comSecretKey", c, "!klsdfjo430sodfk!&".toCharArray(), null);
                try {
                    fileOutputStream = new FileOutputStream(d(context));
                    try {
                        instance.store(fileOutputStream, "!klsdfjo430sodfk!&".toCharArray());
                        fileOutputStream.close();
                        return a;
                    } catch (Throwable th2) {
                        th = th2;
                        if (fileOutputStream != null) {
                            fileOutputStream.close();
                        }
                        throw th;
                    }
                } catch (Throwable th3) {
                    th = th3;
                    fileOutputStream = null;
                    if (fileOutputStream != null) {
                        fileOutputStream.close();
                    }
                    throw th;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    private static Key c(@NonNull Context context) {
        FileInputStream fileInputStream;
        Throwable th;
        try {
            KeyStore instance = KeyStore.getInstance(KeyStore.getDefaultType());
            try {
                fileInputStream = new FileInputStream(d(context));
                try {
                    instance.load(fileInputStream, "!klsdfjo430sodfk!&".toCharArray());
                    fileInputStream.close();
                    return instance.getKey("lynda.comSecretKey", "!klsdfjo430sodfk!&".toCharArray());
                } catch (Throwable th2) {
                    th = th2;
                    if (fileInputStream != null) {
                        fileInputStream.close();
                    }
                    throw th;
                }
            } catch (Throwable th3) {
                th = th3;
                fileInputStream = null;
                if (fileInputStream != null) {
                    fileInputStream.close();
                }
                throw th;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    private static String d(@NonNull Context context) {
        return StorageHelper.a(App.a(context)) + "lyndakeystore";
    }

    public static byte[] b(@NonNull Context context) {
        if (b == null) {
            byte[] bArr;
            String string = e(context).getString("initial_vector", "");
            if (string.length() == 0) {
                bArr = null;
            } else {
                bArr = Base64.decode(string, 0);
            }
            b = bArr;
            if (bArr == null) {
                if (b == null) {
                    b = new byte[16];
                    new SecureRandom().nextBytes(b);
                }
                bArr = b;
                Editor edit = e(context).edit();
                edit.putString("initial_vector", Base64.encodeToString(bArr, 0));
                edit.apply();
            }
        }
        return b;
    }

    private static SharedPreferences e(@NonNull Context context) {
        return App.a(context).a.D();
    }
}

and also

package com.lynda.infra.encryption;

import android.content.Context;
import android.support.annotation.NonNull;
import java.io.FileOutputStream;
import java.io.OutputStream;
import javax.crypto.Cipher;
import javax.crypto.CipherOutputStream;
import javax.crypto.spec.IvParameterSpec;

public final class EncryptionHandler {
    private EncryptionHandler() {
    }

    public static OutputStream a(@NonNull Context context, @NonNull FileOutputStream fileOutputStream) {
        try {
            Cipher instance = Cipher.getInstance("AES/CTR/NoPadding", "BC");
            instance.init(1, KeyHandler.a(context), new IvParameterSpec(KeyHandler.b(context)));
            return new CipherOutputStream(fileOutputStream, instance);
        } catch (Exception e) {
            e.printStackTrace();
            return fileOutputStream;
        }
    }

    public static Cipher a(@NonNull Context context, byte[] bArr) {
        Cipher instance = Cipher.getInstance("AES/CTR/NoPadding", "BC");
        instance.init(2, KeyHandler.a(context), new IvParameterSpec(bArr));
        return instance;
    }
}
iMansoorAliKhan commented 7 years ago

Whe you are going to add support for the mobile downloads? I have 10gb downloaded on mobile I really need them to be decrypted please

Graham-Phillips commented 7 years ago

If I try this I get [ARGS] Changing mode to Folder decryption! [START] Init Decryptor... [START] Decryptor succesful initialized!

Decryption completed!

But there are no files converted in the output folder. Am trying to convert .ldcw files

BravoSlo commented 7 years ago

After playing around with ldcw files, i found that on windows with the store app, only the file headers (63 bytes) are bitwise complement-ed. When you reverse these 63 bytes the files play normaly in vlc.

    private async Task ModifyFileHeader(StorageFile file)
    {
        using (Stream stream = WindowsRuntimeStreamExtensions.AsStream(await file.OpenAsync(1), 63))
        {
            byte[] array = new byte[63];
            int num = await stream.ReadAsync(array, 0, 63);
            byte[] array2 = new byte[63];
            for (int i = 0; i < num; i++)
            {
                array2[i] = ~array[i];
            }
            stream.Seek(0L, SeekOrigin.Begin);
            await stream.WriteAsync(array2, 0, array2.Length);
        }
    }
Dev-iL commented 7 years ago

@BravoSlo Would you submit a PR with this change (including identification of the extension and application of appropriate decryption)? It would put a stop to many repeating questions....

Krishna1408 commented 6 years ago

Hi @BravoSlo & @Dev-iL can you please provide steps to run this fix manually till we get the solution?

iMansoorAliKhan commented 6 years ago

still waiting for the mobile files to be decrypted

DmytroSokhach commented 6 years ago

Pull request for LDCW files added: https://github.com/h4ck-rOOt/Lynda-Decryptor/pull/42 UPD: Syntax is not touched. Looks the same: ./LyndaDecryptor.exe /D "<path to your course>" /DB "<path to db.sqlite>" /OUT "<path to save directory>"

sarab007 commented 6 years ago

@BravoSlo where to write the code and what are the arguments to be passed

Dev-iL commented 6 years ago

@sarab007 until PR #42 is merged, you can find the code in DmitriySokhach's fork. You might have to compile it yourself though. Regarding the arguments/syntax - I didn't try it myself, but I assume you could use it exactly the same way you would with .lynda files, and it will just know what to do according to the extension it encounters.

eletricaraquete commented 6 years ago

what is wrong??

image

I'm using @DmitriySokhach fork, and still nothing =\ ... any lights on?

DmytroSokhach commented 6 years ago

Hi @eletricaraquete

what is wrong??

I lack extrasensory abilities. Let's try figure out what exactly you have: 1) I assume you have "D:\lynda" folder with LyndaDecryptor.exe 2) I assume that also in "D:\lynda" folder you have copy from your %LOCALAPPDATA%/packages/lynda.com.lynda.com/LocalState/offline/633869 with *.ldcw files 3) commands on screenshot look OK to me

If assumptions 1 and 2 above are correct, would you please share what is the result of executing each command from the screenshot?

ghost commented 6 years ago

Any instructions on how to compile @DmitriySokhach's fork. Or if anyone has already compiled it, please share a link. Thanks :)

DmytroSokhach commented 6 years ago

@sarthakthakur24 I've zipped binaries of the branch and put here.

oopsliu commented 6 years ago

@DmytroSokhach Thanks!Works like a charm for .ldcw

sbhhdp commented 5 years ago

I downloaded the Lynda app from store . Followed the steps . It says ..

[ARGS] Changing mode to file decryption ! [DB ] Creating DB connection... [DB] DB successfully connected and opened! [START] Init Decryptor... [START] Decryptor successful initialized !

Decryption completed ! Press any key to exit ...

But nothing really happens . @DmytroSokhach

Bojo31fs commented 5 years ago

@eletricaraquete All locations need to be exact. The problem I had was I was using the Microsoft Store app instead of the lynda.com app. Try installing this. It worked for me. https://www.lynda.com/downloadfallback

Bojo31fs commented 5 years ago

@eletricaraquete All locations need to be exact. The problem I had was I was using the Microsoft Store app instead of the lynda.com app. Try installing this. It worked for me. https://www.lynda.com/downloadfallback

deepakgupta7403 commented 5 years ago

@sarthakthakur24 I've zipped binaries of the branch and put here.

Hey buddy Thank you its working

Sbmkumar commented 4 years ago

@sarthakthakur24 I've zipped binaries of the branch and put here.

This version zip doesn't contain .exe file how to use it Please help

Sbmkumar commented 4 years ago

@sarthakthakur24 I've zipped binaries of the branch and put here.

Hey buddy Thank you its working

Can you please explain me how it would work?

DmytroSokhach commented 4 years ago

@sarthakthakur24 I've zipped binaries of the branch and put here.

This version zip doesn't contain .exe file how to use it Please help

It does contain LyndaDecryptor.exe, see contents of zip file (just downloaded _LyndaDecryptor1.3.1.zip it on link above) image

Sbmkumar commented 4 years ago

@sarthakthakur24 I've zipped binaries of the branch and put here.

This version zip doesn't contain .exe file how to use it Please help

It does contain LyndaDecryptor.exe, see contents of zip file (just downloaded _LyndaDecryptor1.3.1.zip it on link above) image

I downloaded zip from tags. I might have downloaded something else. Can you please provide me a direct download link.

Sbmkumar commented 4 years ago

@sarthakthakur24 I've zipped binaries of the branch and put here.

This version zip doesn't contain .exe file how to use it Please help

It does contain LyndaDecryptor.exe, see contents of zip file (just downloaded _LyndaDecryptor1.3.1.zip it on link above) image

a b

DmytroSokhach commented 4 years ago

@sarthakthakur24 I've zipped binaries of the branch and put here.

This version zip doesn't contain .exe file how to use it Please help

It does contain LyndaDecryptor.exe, see contents of zip file (just downloaded _LyndaDecryptor1.3.1.zip it on link above) image

I downloaded zip from tags. I might have downloaded something else. Can you please provide me a direct download link.

@Sbmkumar, Sure, here is the direct link: https://github.com/DmytroSokhach/Lynda-Decryptor/releases/download/1.3.1/LyndaDecryptor_1.3.1.zip

Taken from here: https://github.com/DmytroSokhach/Lynda-Decryptor/releases/tag/1.3.1 image

Sbmkumar commented 4 years ago

@sarthakthakur24 I've zipped binaries of the branch and put here.

This version zip doesn't contain .exe file how to use it Please help

It does contain LyndaDecryptor.exe, see contents of zip file (just downloaded _LyndaDecryptor1.3.1.zip it on link above) image

I downloaded zip from tags. I might have downloaded something else. Can you please provide me a direct download link.

@Sbmkumar, Sure, here is the direct link: https://github.com/DmytroSokhach/Lynda-Decryptor/releases/download/1.3.1/LyndaDecryptor_1.3.1.zip

Taken from here: https://github.com/DmytroSokhach/Lynda-Decryptor/releases/tag/1.3.1 image

Thank you