Skip to content

Commit

Permalink
- added detection for unsupported .SDX with encrypted/compressed content
Browse files Browse the repository at this point in the history
  • Loading branch information
PredatH0r committed Jan 15, 2023
1 parent c6b2f9c commit 4556d94
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
12 changes: 11 additions & 1 deletion source/ChanSort.Loader.SatcoDX/SatcoDxPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using ChanSort.Api;
using System.IO;
using System.Text;
using ChanSort.Api;

namespace ChanSort.Loader.SatcoDX
{
Expand All @@ -10,6 +12,14 @@ public class SatcoDxPlugin : ISerializerPlugin

public SerializerBase CreateSerializer(string inputFile)
{
var buffer = new byte[7];
using (var strm = new FileStream(inputFile, FileMode.Open))
{
var len = strm.Read(buffer, 0, buffer.Length);
if (len != buffer.Length || Encoding.ASCII.GetString(buffer, 0, len) != "SATCODX")
return null;
}

return new Serializer(inputFile);
}
}
Expand Down
24 changes: 23 additions & 1 deletion source/ChanSort.Loader.Unsupported/UnsupportedPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.IO;
using System.CodeDom;
using System.IO;
using System.Linq;
using System.Text;
using ChanSort.Api;

namespace ChanSort.Loader.Unsupported
Expand All @@ -12,18 +14,21 @@ public class UnsupportedPlugin : ISerializerPlugin
public string PluginName => "Unsupported";
public string FileFilter => "*";

private string path;
private string dir;
private string name;
private string ext;

public SerializerBase CreateSerializer(string inputFile)
{
path = inputFile;
dir = Path.GetDirectoryName(inputFile);
name = Path.GetFileName(inputFile).ToLowerInvariant();
ext = Path.GetExtension(name);

CheckForMediaTekAndroidBin();
CheckForVestelEncryptedDb();
CheckForSdxEncrypted();

throw LoaderException.TryNext("File is not on the list of explicitly unsupported formats");
}
Expand Down Expand Up @@ -68,5 +73,22 @@ private void CheckForVestelEncryptedDb()
}
#endregion

#region CheckForSdxEncrypted()
/// <summary>
/// Not sure if these .sdx files are also from SatcoDX, but they seem to have a 64 byte file header and then either encrypted or
/// compressed data that can't be analyzed. One such file came from a Xoro
/// </summary>
private void CheckForSdxEncrypted()
{
using var strm = new FileStream(this.path, FileMode.Open);
var buffer = new byte[24];
var len = strm.Read(buffer, 0, buffer.Length);
if (len < buffer.Length)
return;
var str = Encoding.ASCII.GetString(buffer, 0, buffer.Length);
if (str.StartsWith("CDX\0MSTDatabaseV"))
throw LoaderException.Fail("Encrypted SDX channel lists (used by Xoro and others) can't be read/modified with ChanSort.");
}
#endregion
}
}
3 changes: 2 additions & 1 deletion source/changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
ChanSort Change Log
===================

2023-01-14
2023-01-15
- added support for Vision EDGE 4K set-top-box (DVB-S only)
- TCL: separate lists for DVB-C/T/S, each starting at 1
- TCL: cleaned up "Hide" vs "Skip"
- SDX: showing message when an unsupported, encrypted .sdx file is opened (e.g. from Xoro STB)

2023-01-12
- TCL: fixed upload failure due to incorrect checksum when DtvData.db was larger than 307200 bytes
Expand Down

0 comments on commit 4556d94

Please sign in to comment.