Skip to content

Commit

Permalink
CDRM Project fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sim0n00ps committed May 29, 2024
1 parent 38fcf68 commit 480dd0c
Showing 1 changed file with 42 additions and 45 deletions.
87 changes: 42 additions & 45 deletions OF DL/Helpers/APIHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2348,62 +2348,59 @@ public async Task<string> GetDecryptionKey(Dictionary<string, string> drmHeaders
try
{
string dcValue = string.Empty;
string buildInfo = "";
string proxy = "";
bool cache = true;

StringBuilder sb = new();
sb.Append("{\n");
sb.AppendFormat(" \"License URL\": \"{0}\",\n", licenceURL);
sb.Append(" \"Headers\": \"{");
foreach (KeyValuePair<string, string> header in drmHeaders)
{
if (header.Key == "time" || header.Key == "user-id")

StringBuilder sb = new();
sb.Append("{\n");
sb.AppendFormat(" \"License URL\": \"{0}\",\n", licenceURL);
sb.Append(" \"Headers\": \"{");
foreach (KeyValuePair<string, string> header in drmHeaders)
{
sb.AppendFormat("\\\"{0}\\\": \\\"{1}\\\",", header.Key, header.Value);
if (header.Key == "time" || header.Key == "user-id")
{
sb.AppendFormat("\\\"{0}\\\": \\\"{1}\\\",", header.Key, header.Value);
}
else
{
sb.AppendFormat("\\\"{0}\\\": \\\"{1}\\\",", header.Key, header.Value);
}
}
else
sb.Remove(sb.Length - 1, 1);
sb.Append("}\",\n");
sb.AppendFormat(" \"PSSH\": \"{0}\"\n", pssh);
sb.Append(",\"JSON\":\"\",\"Cookies\":\"\",\"Data\":\"\",\"Proxy\":\"\"");
sb.Append('}');
string json = sb.ToString();
HttpClient client = new();

HttpRequestMessage request = new(HttpMethod.Post, "https://cdrm-project.com/")
{
sb.AppendFormat("\\\"{0}\\\": \\\"{1}\\\",", header.Key, header.Value);
}
}
sb.Remove(sb.Length - 1, 1);
sb.Append("}\",\n");
sb.AppendFormat(" \"PSSH\": \"{0}\"\n", pssh);
sb.Append(",\"JSON\":\"\",\"Cookies\":\"\",\"Data\":\"\"");
sb.Append('}');
string json = sb.ToString();
HttpClient client = new();

HttpRequestMessage request = new(HttpMethod.Post, "https://cdrm-project.com/")
{
Content = new StringContent(json, Encoding.UTF8, "application/json")
};
Content = new StringContent(json, Encoding.UTF8, "application/json")
};

using var response = await client.SendAsync(request);
using var response = await client.SendAsync(request);

response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();

var doc = JsonDocument.Parse(body);
var doc = JsonDocument.Parse(body);

dcValue = doc.RootElement.GetProperty("Message").GetString().Trim();
dcValue = doc.RootElement.GetProperty("Message").GetString().Trim();

return dcValue;
}
catch (Exception ex)
{
Console.WriteLine("Exception caught: {0}\n\nStackTrace: {1}", ex.Message, ex.StackTrace);
Log.Error("Exception caught: {0}\n\nStackTrace: {1}", ex.Message, ex.StackTrace);
if (ex.InnerException != null)
return dcValue;
}
catch (Exception ex)
{
Console.WriteLine("\nInner Exception:");
Console.WriteLine("Exception caught: {0}\n\nStackTrace: {1}", ex.InnerException.Message, ex.InnerException.StackTrace);
Log.Error("Inner Exception: {0}\n\nStackTrace: {1}", ex.InnerException.Message, ex.InnerException.StackTrace);
Console.WriteLine("Exception caught: {0}\n\nStackTrace: {1}", ex.Message, ex.StackTrace);
Log.Error("Exception caught: {0}\n\nStackTrace: {1}", ex.Message, ex.StackTrace);
if (ex.InnerException != null)
{
Console.WriteLine("\nInner Exception:");
Console.WriteLine("Exception caught: {0}\n\nStackTrace: {1}", ex.InnerException.Message, ex.InnerException.StackTrace);
Log.Error("Inner Exception: {0}\n\nStackTrace: {1}", ex.InnerException.Message, ex.InnerException.StackTrace);
}
}
return null;
}
return null;
}

public async Task<string> GetDecryptionKeyNew(Dictionary<string, string> drmHeaders, string licenceURL, string pssh, Auth auth)
{
Expand Down

0 comments on commit 480dd0c

Please sign in to comment.