Skip to content

Instantly share code, notes, and snippets.

@gdkchan gdkchan/OLDownload
Last active Jun 21, 2019

Embed
What would you like to do?
OpenLoad Stream URL Extraction
/*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
* In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the
* software to the public domain. We make this dedication for the benefit
* of the public at large and to the detriment of our heirs and
* successors. We intend this dedication to be an overt act of
* relinquishment in perpetuity of all present and future rights to this
* software under copyright law.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* For more information, please refer to <http://unlicense.org/>
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
namespace OLDownload
{
class Program
{
const string UserAgent = "Mozilla / 5.0(Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1";
const string NumbersJs = "https://openload.co/assets/js/obfuscator/n.js";
static void Main(string[] args)
{
Console.WriteLine("OpenLoad Stream URL Extractor by gdkchan");
Console.WriteLine("This is basically just a small test and not guaranteed to work");
Console.Write(Environment.NewLine);
Console.WriteLine("Type or paste the URL of the file below:");
string URL = Console.ReadLine();
URL = GetStreamURL(URL);
Console.Write(Environment.NewLine);
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("Download URL:");
Console.ResetColor();
Console.WriteLine(URL);
Console.Write(Environment.NewLine);
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
private static string GetStreamURL(string URL)
{
string HTML = HttpGet(URL);
string NJs = HttpGet(NumbersJs);
string LinkImg = Regex.Match(HTML, "src=\"data:image/png;base64,([A-Za-z0-9+/=]+?)\"").Groups[1].Value;
string SigNums = Regex.Match(NJs, "window\\.signatureNumbers='([a-z]+?)'").Groups[1].Value;
byte[] ImgData = Convert.FromBase64String(LinkImg);
string ImgNums = string.Empty;
using (MemoryStream MS = new MemoryStream(ImgData))
{
using (Bitmap Img = new Bitmap(MS))
{
for (int Y = 0; Y < Img.Height; Y++)
{
for (int X = 0; X < Img.Width; X++)
{
Color Col = Img.GetPixel(X, Y);
if (Col == Color.FromArgb(0, 0, 0))
{
//Black color = end of data
Y = Img.Height;
break;
}
ImgNums += (char)Col.R;
ImgNums += (char)Col.G;
ImgNums += (char)Col.B;
}
}
}
}
string[,] ImgStr = new string[10, ImgNums.Length / 200];
string[,] SigStr = new string[10, SigNums.Length / 260];
for (int i = 0; i < 10; i++)
{
//Fill Array of Image String
for (int j = 0; j < ImgStr.GetLength(1); j++)
{
ImgStr[i, j] = ImgNums.Substring(i * ImgStr.GetLength(1) * 20 + j * 20, 20);
}
//Fill Array of Signature Numbers
for (int j = 0; j < SigStr.GetLength(1); j++)
{
SigStr[i, j] = SigNums.Substring(i * SigStr.GetLength(1) * 26 + j * 26, 26);
}
}
List<string> Parts = new List<string>();
int[] Primes = { 2, 3, 5, 7 };
foreach (int i in Primes)
{
string Str = string.Empty;
float Sum = 99f; //c
for (int j = 0; j < SigStr.GetLength(1); j++)
{
for (int ChrIdx = 0; ChrIdx < ImgStr[i, j].Length; ChrIdx++)
{
if (Sum > 122f) Sum = 98f; //b
char Chr = (char)((int)Math.Floor(Sum));
if (SigStr[i, j][ChrIdx] == Chr && j >= Str.Length)
{
Str += ImgStr[i, j][ChrIdx];
Sum += 2.5f;
}
}
}
Parts.Add(Str.Replace(",", string.Empty));
}
string StreamURL = "https://openload.co/stream/";
StreamURL += Parts[3] + "~";
StreamURL += Parts[1] + "~";
StreamURL += Parts[2] + "~";
StreamURL += Parts[0];
return StreamURL;
}
private static string HttpGet(string URL)
{
WebRequest Request = WebRequest.Create(URL);
((HttpWebRequest)Request).UserAgent = UserAgent;
WebResponse Response = Request.GetResponse();
StreamReader Reader = new StreamReader(Response.GetResponseStream());
return Reader.ReadToEnd();
}
}
}
@DarbyCrash

This comment has been minimized.

Copy link

DarbyCrash commented Jun 25, 2017

How can i compile it on Linux Debian?

@alec-chan

This comment has been minimized.

Copy link

alec-chan commented Jun 28, 2017

@DarbyCrash you can install mono from here and build it using the mono compiler mcs like mcs OLDownload.cs /out:OLDownload.exe I'm not sure, but you might need to reference some DLL's which you would need to find the location of on your system but you would reference them like so mcs OLDownload.cs /out:OLDownload.exe /reference:example.dll /reference:example1.dll and then run your compiled exe with mono OLDownload.exe

@SheppeR

This comment has been minimized.

Copy link

SheppeR commented Sep 2, 2017

Hello, Openload changed their html code ? the regex patern "data:image/png;base64' return null.

@starlordgg

This comment has been minimized.

Copy link

starlordgg commented Sep 18, 2017

            using (Bitmap Img = new Bitmap(MS))

This gives error "invalid parameter"

@ignorant22

This comment has been minimized.

Copy link

ignorant22 commented Nov 26, 2017

Please excuse me for the huge stupid question. I'm not a developer.
I tried to compile it with several programs including forlan getting errors. Can you please add some instructions on how to compile it?.
Again, sorry for my question, I spent few hours trying before deciding to bother you with it.

@aaronzolla

This comment has been minimized.

Copy link

aaronzolla commented Aug 25, 2018

Amazing work. I would appreciate if you did a write up on each part so I can learn how this works. Thank you.

@Growik

This comment has been minimized.

Copy link

Growik commented Dec 19, 2018

It is not working anymore. It won't find LinkImgs

@bato3

This comment has been minimized.

Copy link

bato3 commented Jan 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.