Reworked the Recorded Samples test.
All checks were successful
🚀 Pack skyscraper8 / make-zip (push) Successful in 45s

This commit is contained in:
fey 2026-07-24 21:54:06 +02:00
parent 5a54552477
commit 4038e65c38
16 changed files with 490 additions and 92 deletions

View File

@ -19,6 +19,7 @@ These will have IP packets forwarded to.
|--|-----------| |--|-----------|
| 1|PCAP Writer| | 1|PCAP Writer|
| 2|Discard | | 2|Discard |
| 3|Blackhole |
#Network Types #Network Types
These identify sources from which a network packet may come from. These identify sources from which a network packet may come from.

View File

@ -1,5 +1,6 @@
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using log4net.Core;
using log4net.Repository.Hierarchy; using log4net.Repository.Hierarchy;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -122,7 +123,6 @@ public class SkyscrapersTestingFramework
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
Console.WriteLine("Setup");
if (_testTimes == null) if (_testTimes == null)
_testTimes = new Dictionary<string, DateTime>(); _testTimes = new Dictionary<string, DateTime>();
@ -136,8 +136,6 @@ public class SkyscrapersTestingFramework
[TearDown] [TearDown]
public void TearDown() public void TearDown()
{ {
Console.WriteLine("TearDown");
TestContext currentContext = TestContext.CurrentContext; TestContext currentContext = TestContext.CurrentContext;
VoileOnlineTestResult voileOnlineTestResult = new VoileOnlineTestResult(); VoileOnlineTestResult voileOnlineTestResult = new VoileOnlineTestResult();
@ -216,4 +214,11 @@ public class SkyscrapersTestingFramework
return logText; return logText;
} }
protected IReadOnlyList<LoggingEvent> GetCapturedLogEvents()
{
if (_testLogAppender == null)
return new List<LoggingEvent>();
return _testLogAppender.Events;
}
} }

View File

@ -0,0 +1,13 @@
using log4net.Core;
using skyscraper8.Skyscraper.Net;
using skyscraper8.Skyscraper.Scraper.Storage;
namespace skyscraper8.Tests.NUnit;
public class SkyscrapersTestingHarness
{
public DataStorage DataStorage { get; set; }
public ObjectStorage ObjectStorage { get; set; }
public IReadOnlyList<LoggingEvent> Events { get; set; }
public BlackholeIpTrafficHandler IpTrafficHandler { get; set; }
}

View File

@ -27,6 +27,6 @@ public class TestLog4NetAppender : AppenderSkeleton
public string GetText() public string GetText()
{ {
return String.Join("\n", Events.Select(e => e.RenderedMessage)); return String.Join("\n", Events.Select(e => String.Format("[{0}] {1}", e.LoggerName, e.RenderedMessage)));
} }
} }

View File

@ -1,6 +1,7 @@
using skyscraper5.Mpeg2; using skyscraper5.Mpeg2;
using skyscraper5.Skyscraper.Scraper; using skyscraper5.Skyscraper.Scraper;
using skyscraper5.Skyscraper.Scraper.Storage.InMemory; using skyscraper5.Skyscraper.Scraper.Storage.InMemory;
using skyscraper8.Skyscraper.Net;
using skyscraper8.Skyscraper.Scraper.Storage; using skyscraper8.Skyscraper.Scraper.Storage;
using skyscraper8.Tests.NUnit; using skyscraper8.Tests.NUnit;
@ -13,26 +14,30 @@ public class RecordedSamplesTests : SkyscrapersTestingFramework
public void RussianT2Mi() public void RussianT2Mi()
{ {
FileStream streamSample = GetStreamSample("express_3928L_t2mi.ts"); FileStream streamSample = GetStreamSample("express_3928L_t2mi.ts");
ProcessSample(streamSample); SkyscrapersTestingHarness result = ProcessSample(streamSample);
streamSample.Close(); streamSample.Close();
//42931 uncovered //42931 uncovered
Assert.True(result.DataStorage.TestForCaSystem(1, 1, 1453));
} }
[Test] [Test]
public void Simmin() public void Simmin()
{ {
FileStream streamSample = GetStreamSample("thor_11049v_simmin-radiomidun.ts"); FileStream streamSample = GetStreamSample("thor_11049v_simmin-radiomidun.ts");
ProcessSample(streamSample); SkyscrapersTestingHarness result = ProcessSample(streamSample);
streamSample.Close(); streamSample.Close();
//36611 uncovered //36611 uncovered
Assert.True(result.DataStorage.TestForTerminalBurstTimePlan2(1326, 1, 0));
Assert.True(result.DataStorage.TestForBroadcastConfiguration(1326, 2));
} }
[Test] [Test]
public void GseDab() public void GseDab()
{ {
FileStream streamSample = GetStreamSample("thor_10717v_gse-dab.ts"); FileStream streamSample = GetStreamSample("thor_10717v_gse-dab.ts");
ProcessSample(streamSample); SkyscrapersTestingHarness result = ProcessSample(streamSample);
streamSample.Close(); streamSample.Close();
Assert.IsTrue(result.IpTrafficHandler.TestForUdpTraffic("192.168.1.4", "239.199.2.4", 1234, 1234));
//36446 uncovered //36446 uncovered
} }
@ -40,17 +45,94 @@ public class RecordedSamplesTests : SkyscrapersTestingFramework
public void EarlyBrazilianNip() public void EarlyBrazilianNip()
{ {
FileStream streamSample = GetStreamSample("brazilian-dvb-nip-000000.ts"); FileStream streamSample = GetStreamSample("brazilian-dvb-nip-000000.ts");
ProcessSample(streamSample); SkyscrapersTestingHarness result = ProcessSample(streamSample);
streamSample.Close(); streamSample.Close();
//35222 //35222
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.24:8888/live/diskb/NIP_9/HLS_OUT/NIP_9-mp4a_140800=20000-begin=3403218160093331-dur=40106667-seq=85080456.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://usd.xxxoperatorxxx.com/fragments/envelope.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.24:8888/live/diskb/NIP_4/HLS_OUT/NIP_4-mp4a_140800=20000-begin=3403218170199998-dur=39893334-seq=85080456.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("envelope.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://www.enensys.com/usd_bid274499940_cid274499942.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.24:8888/live/diskb/NIP_6/HLS_OUT/NIP_6-hvc1_1761664=10000-p=335204011000000-init.mp4"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://www.enensys.com/usd_bid274499949_cid274499951.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.24:8888/live/diskb/NIP_9/HLS_OUT/NIP_9-hvc1_1761664=10000-p=330114634000000-init.mp4"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://www.enensys.com/usd_bid274499913_cid274499915.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.24:8888/live/diskb/NIP_1/HLS_OUT/NIP_1-hvc1_1761664=10000-p=330114493000000-init.mp4"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://www.enensys.com/usd_bid274499968_cid274499970.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.24:8888/live/diskb/NIP_4/HLS_OUT/NIP_4-hvc1_1761664=10000-p=330030655000000-init.mp4"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://www.enensys.com/usd_bid274499922_cid274499924.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.24:8888/live/diskb/NIP_2/HLS_OUT/NIP_2-hvc1_1761664=10000-p=330114509000000-init.mp4"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://www.enensys.com/usd_bid244303386_cid244303388.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.24:8888/live/diskb/NIP_0/HLS_OUT/NIP_0-hvc1_1761664=10000-p=330114463000000-init.mp4"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://www.enensys.com/usd_bid274499958_cid274499960.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.24:8888/live/diskb/NIP_6/HLS_OUT/NIP_6-mp4a_140800=20000-begin=3403218200093333-dur=40106667-seq=85080457.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("urn:dvb:metadata:nativeip:NetworkInformationFile"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.24:8888/live/diskb/NIP_4/HLS_OUT/NIP_4-mp4a_140800=20000-begin=3403218210093332-dur=40106667-seq=85080457.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.22:80/1/images.tar"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.24:8888/live/diskb/NIP_2/HLS_OUT/NIP_2-mp4a_140800=20000-begin=3403218240093332-dur=40106667-seq=85080458.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.22:80/pages.tar"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://10.10.10.24:8888/live/diskb/NIP_0/HLS_OUT/NIP_0-hvc1_1761664=10000-begin=3403218250000000-dur=40000000-seq=85080458.m4s"));
} }
[Test] [Test]
public void GseNip() public void GseNip()
{ {
FileStream streamSample = GetStreamSample("astra1_12441v_gse-nip.ts"); FileStream streamSample = GetStreamSample("astra1_12441v_gse-nip.ts");
ProcessSample(streamSample); SkyscrapersTestingHarness result = ProcessSample(streamSample);
streamSample.Close(); streamSample.Close();
Assert.True(result.ObjectStorage.DvbNipTestForFile("urn:dvb:metadata:cs:MulticastTransportObjectTypeCS:2021:gateway-configuration"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sgc/tva_schedule_20251123100000_PT3H15M_CoreSet.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s2/5G-EMERGE/Live/hls/RaiScuola/RaiScuola_v_1000.m3u8"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("urn:dvb:metadata:cs:NativeIPMulticastTransportObjectTypeCS:2023:bootstrap"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sge/MorningNews.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s2/5G-EMERGE/Live/hls/RaiScuola/RaiScuola_v_4500.m3u8"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sge/PoliticalInsight.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s2/5G-EMERGE/Live/hls/RaiScuola/RaiScuola.m3u8"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sge/ScienceFictionShowcase.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s1/5G-EMERGE/Live/hls/RaiStoria/RaiStoria_v_1000_6287140.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sge/SportsHighlights.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s2/5G-EMERGE/Live/hls/RaiScuola/RaiScuola_v_1000_6287143.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sge/TravelAdventures.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/vod2/5G-Emerge_v_1000_00006.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s2/5G-EMERGE/Live/hls/RaiScuola/RaiScuola_v_2000_6287143.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sge/ComedyHour.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s2/5G-EMERGE/Live/hls/RaiScuola/RaiScuola_v_4500_6287143.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/vod2/5G-Emerge_v_1000_00005.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sge/FitnessHour.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s0/5G-EMERGE/Live/hls/crits_linear/crits_linear_v_1000_556702.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("urn:dvb:metadata:nativeip:NetworkInformationFile"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/cg/manifest.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("urn:dvb:metadata:nativeip:ServiceGuide"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/vod1/5G-MAG_v_4500_00004.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sge/KidsFunTime.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/vod2/5G-Emerge_v_1000_00009.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s1/5G-EMERGE/Live/hls/RaiStoria/RaiStoria_v_1000_6287141.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sge/RomanticEvenings.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s2/5G-EMERGE/Live/hls/RaiScuola/RaiScuola_v_1000_6287144.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/data/IMG_1007.jpeg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/vod2/5G-Emerge_v_1000_00013.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/data/IMG_1009.jpeg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sge/TechTalk.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s1/5G-EMERGE/Live/hls/RaiStoria/RaiStoria_v_4500_6287141.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/data/IMG_1005.jpeg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s2/5G-EMERGE/Live/hls/RaiScuola/RaiScuola_v_2000_6287144.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sge/DocumentaryWorld.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/vod2/5G-Emerge_v_1000_00017.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/data/Astronomy-2e.pdf"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sge/MysteryTheater.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/vod2/5G-Emerge_v_1000_00021.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s0/5G-EMERGE/Live/hls/crits_linear/crits_linear_v_1000_556703.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/data/IMG_1006.jpeg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/sge/WildlifeWonders.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s1/5G-EMERGE/Live/hls/RaiStoria/RaiStoria_v_1000_6287142.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/vod1/5G-MAG_v_4500_00011.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s0/5G-EMERGE/Live/hls/crits_linear/crits_linear_v_2000_556703.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/data/IMG_1000.jpeg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s1/5G-EMERGE/Live/hls/RaiStoria/RaiStoria_v_4500_6287142.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/data/IMG_1011.jpeg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/s2/5G-EMERGE/Live/hls/RaiScuola/RaiScuola_v_4500_6287145.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/inverto.tv/data/IMG_1012.jpeg"));
//34545 //34545
} }
@ -58,76 +140,157 @@ public class RecordedSamplesTests : SkyscrapersTestingFramework
public void GseNip2() public void GseNip2()
{ {
FileStream streamSample = GetStreamSample("astra1_11141h_gse_nip.ts"); FileStream streamSample = GetStreamSample("astra1_11141h_gse_nip.ts");
ProcessSample(streamSample); SkyscrapersTestingHarness result = ProcessSample(streamSample);
streamSample.Close(); streamSample.Close();
//34462 //34462
Assert.True(result.ObjectStorage.DvbNipTestForFile("urn:dvb:metadata:cs:MulticastTransportObjectTypeCS:2021:gateway-configuration"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/hbbtv/xml.aitx"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/livesim2/C1/fr-sub/1763893122.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/hbbtv/main.js"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/livesim2/B2/playlist-audio.m3u8"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/live/channel1/manifest.mpd"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/livesim2/C1/audio/1763893122.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/hbbtv/img/dvbnip.png"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/livesim2/C1/playlist-audio2.m3u8"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/hbbtv/style.css"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/private/dvbi/service_list_ses_private.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/hbbtv/button.js"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("urn:dvb:metadata:cs:NativeIPMulticastTransportObjectTypeCS:2023:bootstrap"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/livesim2/B1/audio/881946560.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/hbbtv/index.html"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/private/vod_small/covers/A%20Better%20Super%20Bowl.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/dvbi/service_list_full.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/livesim2/C1/audio2/1763893123.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/dvbi/cg/CoreSetRelatedMaterials/programm-api.ard.de/images/MjAyNS0xMC0wMQ==/68ddba3f8ace97dd375c961b_1759361599632.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("urn:dvb:metadata:nativeip:dvb-i-slep"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/private/vod_small/covers/HDplus_ExtraScreen.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/hbbtv/img/WTqW6FTJ2.jpeg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/livesim2/B2/audio/881946561.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/live/channel1/1-2025940.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/livesim2/C1/audio/1763893124.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/materials/b1.png"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/private/vod_small/covers/2017_SES_4K_trailer_IBC.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/dvbi/service_list_tp1045.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/livesim2/B1/audio/881946561.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/dvbi/cg/manifest.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/private/vod_small/covers/SES_BS.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/materials/5G-EMERGE.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/private/vod_small/covers/AIT_VF-10-08-15_French.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/livesim2/C1/audio/1763893125.m4s"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/dvbi/sg/CoreSetRelatedMaterial/programm-api.ard.de/images/MjAyNS0wOS0xMA==/68c20b38bc0414230a56325d_1757547321028.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/materials/b2.png"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/private/vod_small/covers/Welcome%20to%20Luxembourg.jpg"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/ses.com/livesim2/B2/audio/881946562.m4s"));
} }
[Test] [Test]
public void TsNipIncludingLegacyChannel() public void TsNipIncludingLegacyChannel()
{ {
FileStream streamSample = GetStreamSample("hotbird_12380v_nip.ts"); FileStream streamSample = GetStreamSample("hotbird_12380v_nip.ts");
ProcessSample(streamSample); SkyscrapersTestingHarness result = ProcessSample(streamSample);
streamSample.Close(); streamSample.Close();
//33518 //33518
Assert.IsTrue(result.DataStorage.TestForCaSystem(318, 8400, 7104));
Assert.IsTrue(result.IpTrafficHandler.TestForUdpTraffic("0.0.0.0", "224.1.1.103", 0, 16301));
Assert.IsTrue(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/rai.it/s0/5G-EMERGE/Live/dash/crits_linear/crits_linear_v_4500_001114520.mp4"));
} }
[Test] [Test]
public void TsNip() public void TsNip()
{ {
FileStream streamSample = GetStreamSample("hotbird_12226v_nip.ts"); FileStream streamSample = GetStreamSample("hotbird_12226v_nip.ts");
ProcessSample(streamSample); SkyscrapersTestingHarness result = ProcessSample(streamSample);
streamSample.Close(); streamSample.Close();
//33518 //33518
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/ts_corp/73_tamazight_tccybxt/playlist.m3u8"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/corp/73_arryadia_k2tgcj0_480p/playlist.m3u8"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/bpk-tv/orp01-ten999-ch009/hls-sb/index.m3u8"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/ts_corp/73_arrabia_hthcj4p/playlist.m3u8"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/bpk-tv/orp01-ten999-ch008/hls-sb/index.m3u8"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/ts_corp/73_almaghribia_83tz85q/corp/73_almaghribia_83tz85q_240p/l_43709_87687000_23699.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/corp/73_aloula_w1dqfwm/playlist.m3u8"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/ts_corp/73_tamazight_tccybxt/corp/73_tamazight_tccybxt_480p/l_22569_7413000_17779.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("urn:dvb:metadata:cs:NativeIPMulticastTransportObjectTypeCS:2023:bootstrap"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/ts_corp/73_almaghribia_83tz85q/corp/73_almaghribia_83tz85q_240p/l_43709_87690000_23700.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("urn:dvb:metadata:cs:MulticastTransportObjectTypeCS:2021:gateway-configuration"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/bpk-tv/orp01-ten999-ch007/hls-sb/keyframes/orp01-ten999-ch007-video=2580000-440974019.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/ts_corp/73_almaghribia_83tz85q/corp/73_almaghribia_83tz85q_360p/l_43705_87690000_23700.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/bpk-tv/orp01-ten999-ch009/hls-sb/keyframes/orp01-ten999-ch009-video=2600000-440974020.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/ts_corp/73_arrabia_hthcj4p/corp/73_arrabia_hthcj4p_480p/l_43737_7398000_23696.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/corp/73_aloula_w1dqfwm/l_43669_7389881_23706.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/ts_corp/73_almaghribia_83tz85q/corp/73_almaghribia_83tz85q_480p/l_43701_87690000_23700.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/corp/73_arryadia_k2tgcj0_480p/l_22601_52377000_17770.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/ts_corp/73_almaghribia_83tz85q/corp/73_almaghribia_83tz85q_240p/l_43709_87693000_23701.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("envelope.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://www.enensys.com/usd_bid8331_cid8335.xml"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/ts_corp/73_almaghribia_83tz85q/corp/73_almaghribia_83tz85q_480p/l_43701_87693000_23701.ts"));
Assert.True(result.ObjectStorage.DvbNipTestForFile("http://dvb.gw/eutelsat/bpk-tv/orp01-ten999-ch009/hls-sb/orp01-ten999-ch009-audio_133600_eng=131600-video=2600000-440974020.ts"));
} }
[Test] [Test]
public void GseRcs2() public void GseRcs2()
{ {
FileStream streamSample = GetStreamSample("telstar12v-bfbs-000000.ts"); FileStream streamSample = GetStreamSample("telstar12v-bfbs-000000.ts");
ProcessSample(streamSample); SkyscrapersTestingHarness result = ProcessSample(streamSample);
streamSample.Close(); streamSample.Close();
//32559 //32559
Assert.True(result.DataStorage.TestForTerminalBurstTimePlan2(65281, 5, 0));
Assert.True(result.DataStorage.TestForBroadcastConfiguration(65281, 2));
Assert.True(result.IpTrafficHandler.TestForUdpTraffic("192.168.19.50", "238.1.1.1", 1024, 4000));
} }
[Test] [Test]
public void BadrDvbSis() public void BadrDvbSis()
{ {
FileStream streamSample = GetStreamSample("badr_12563v_dvb-sis.ts"); FileStream streamSample = GetStreamSample("badr_12563v_dvb-sis.ts");
ProcessSample(streamSample); SkyscrapersTestingHarness result = ProcessSample(streamSample);
streamSample.Close(); streamSample.Close();
Assert.True(result.ObjectStorage.TestForSisDsaci(136, 26, 1, 13));
} }
[Test] [Test]
public void Eutelsat5DvbSis() public void Eutelsat5DvbSis()
{ {
FileStream streamSample = GetStreamSample("eutelsat5_12522v_dvb-sis.ts"); FileStream streamSample = GetStreamSample("eutelsat5_12522v_dvb-sis.ts");
ProcessSample(streamSample); SkyscrapersTestingHarness result = ProcessSample(streamSample);
streamSample.Close(); streamSample.Close();
Assert.True(result.ObjectStorage.TestForSisDsaci(1375, 20700, 9, 17));
} }
[Test] [Test]
public void Kira7Patchday() public void Kira7Patchday()
{ {
FileStream streamSample = GetStreamSample("kira7.ts"); FileStream streamSample = GetStreamSample("kira7.ts");
ProcessSample(streamSample); SkyscrapersTestingHarness result = ProcessSample(streamSample);
streamSample.Close(); streamSample.Close();
Assert.IsTrue(result.IpTrafficHandler.TestForUdpTraffic("192.168.1.48", "224.0.0.252", 62983, 5355));
Assert.IsTrue(result.IpTrafficHandler.TestForLlcTraffic("ff:ff:ff:ff:ff:ff", 8, 0, 0));
} }
private void ProcessSample(Stream sample) private SkyscrapersTestingHarness ProcessSample(Stream sample)
{ {
TsContext ts = new TsContext(); TsContext ts = new TsContext();
InMemoryScraperStorageFactory inMemoryStorageFactory = new InMemoryScraperStorageFactory(); InMemoryScraperStorageFactory inMemoryStorageFactory = new InMemoryScraperStorageFactory();
DataStorage dataStorage = inMemoryStorageFactory.CreateDataStorage(); DataStorage dataStorage = inMemoryStorageFactory.CreateDataStorage();
NullObjectStorage nullObjectStorage = new NullObjectStorage(); ObjectStorage blackholeObjectStorage = new BlackholeObjectStorage();
SkyscraperContext context = new SkyscraperContext(ts, dataStorage, nullObjectStorage); BlackholeIpTrafficHandler ipTrafficHandler = new BlackholeIpTrafficHandler();
SkyscraperContext context = new SkyscraperContext(ts, dataStorage, blackholeObjectStorage);
context.InitalizeFilterChain(); context.InitalizeFilterChain();
context.OverrideIpTrafficHandler(ipTrafficHandler);
context.IngestFromStream(sample); context.IngestFromStream(sample);
}
SkyscrapersTestingHarness harness = new SkyscrapersTestingHarness();
harness.DataStorage = dataStorage;
harness.ObjectStorage = blackholeObjectStorage;
harness.Events = GetCapturedLogEvents();
harness.IpTrafficHandler = ipTrafficHandler;
return harness;
}
} }

View File

@ -24,7 +24,7 @@ public class SkyscraperResourceTests : SkyscrapersTestingFramework
{ {
TsContext mpeg2 = new TsContext(); TsContext mpeg2 = new TsContext();
DataStorage ds = new InMemoryScraperStorageFactory().CreateDataStorage(); DataStorage ds = new InMemoryScraperStorageFactory().CreateDataStorage();
ObjectStorage os = new NullObjectStorage(); ObjectStorage os = new BlackholeObjectStorage();
SkyscraperContext skyscraper = new SkyscraperContext(mpeg2, ds, os); SkyscraperContext skyscraper = new SkyscraperContext(mpeg2, ds, os);
MemoryStream ms = new MemoryStream(buffer, false); MemoryStream ms = new MemoryStream(buffer, false);

View File

@ -4,6 +4,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArgumentNullException_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F57d616db882b441b8c50720b4477e03db2e200_003Ff2_003F6872d84e_003FArgumentNullException_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArgumentNullException_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F57d616db882b441b8c50720b4477e03db2e200_003Ff2_003F6872d84e_003FArgumentNullException_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArray_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F57d616db882b441b8c50720b4477e03db2e200_003F6e_003Fd247db11_003FArray_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AArray_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F57d616db882b441b8c50720b4477e03db2e200_003F6e_003Fd247db11_003FArray_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2026_002E1_003Fresharper_002Dhost_003FSourcesCache_003F46a322d26154b982566e1817203e5452c91223f93b0e392d9c5b4806696fdc1_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2026_002E1_003Fresharper_002Dhost_003FSourcesCache_003F46a322d26154b982566e1817203e5452c91223f93b0e392d9c5b4806696fdc1_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2026_002E2_003Fresharper_002Dhost_003FSourcesCache_003F46a322d26154b982566e1817203e5452c91223f93b0e392d9c5b4806696fdc1_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F053cba69424c47858472194d509c3cdc12bb0_003F37_003F58cc70f4_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F053cba69424c47858472194d509c3cdc12bb0_003F37_003F58cc70f4_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa840692e98b74557bc005b38213a22c72dad0_003Fc8_003F58c2e0c9_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa840692e98b74557bc005b38213a22c72dad0_003Fc8_003F58c2e0c9_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F62bb4746d7d14dc1cd4274a28788572a7a4641bd3a7d5736479c9697bcb4794_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F62bb4746d7d14dc1cd4274a28788572a7a4641bd3a7d5736479c9697bcb4794_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

View File

@ -134,7 +134,7 @@ namespace skyscraper5.Dvb.DataBroadcasting
{ {
if (!announcedLlcTraffic) if (!announcedLlcTraffic)
{ {
//logger.InfoFormat("Detected LLC/SNAP traffic on PID {0:x4}", sourcePid); logger.InfoFormat("Detected LLC/SNAP traffic on PID {0:x4}", sourcePid);
announcedLlcTraffic = true; announcedLlcTraffic = true;
} }

View File

@ -46,7 +46,7 @@ public class Pts2Bbf
TsContext mpeg2 = new TsContext(); TsContext mpeg2 = new TsContext();
mpeg2.RegisterPacketProcessor(0x010e, new Stid135BbFrameReader(null, dumper)); mpeg2.RegisterPacketProcessor(0x010e, new Stid135BbFrameReader(null, dumper));
DataStorage dataStorage = new InMemoryScraperStorage(); DataStorage dataStorage = new InMemoryScraperStorage();
ObjectStorage objectStorage = new NullObjectStorage(); ObjectStorage objectStorage = new BlackholeObjectStorage();
SkyscraperContext skyscraper = new SkyscraperContext(mpeg2, dataStorage, objectStorage); SkyscraperContext skyscraper = new SkyscraperContext(mpeg2, dataStorage, objectStorage);
skyscraper.InitalizeFilterChain(); skyscraper.InitalizeFilterChain();
skyscraper.IngestFromStream(fileStream); skyscraper.IngestFromStream(fileStream);

View File

@ -28,7 +28,7 @@ public class Pts2Bbf2 : IBbframeDeencapsulator
Stid135BbFrameReader bbFrameReader = new Stid135BbFrameReader(null, this); Stid135BbFrameReader bbFrameReader = new Stid135BbFrameReader(null, this);
mpeg2.RegisterPacketProcessor(0x010e, bbFrameReader); mpeg2.RegisterPacketProcessor(0x010e, bbFrameReader);
SkyscraperContext context = new SkyscraperContext(mpeg2, new InMemoryScraperStorage(), new NullObjectStorage()); SkyscraperContext context = new SkyscraperContext(mpeg2, new InMemoryScraperStorage(), new BlackholeObjectStorage());
context.InitalizeFilterChain(); context.InitalizeFilterChain();
FileStream fileStream = _fi.OpenRead(); FileStream fileStream = _fi.OpenRead();

View File

@ -36,6 +36,8 @@ namespace skyscraper5.Ietf.Rfc2460
HopLimit = ms.ReadUInt8(); HopLimit = ms.ReadUInt8();
SourceAddress = new IPAddress(ms.ReadBytes(16)); SourceAddress = new IPAddress(ms.ReadBytes(16));
DestinationAddress = new IPAddress(ms.ReadBytes(16)); DestinationAddress = new IPAddress(ms.ReadBytes(16));
HeaderEndOffset = (int)ms.Position;
Valid = true; Valid = true;
} }
@ -54,5 +56,7 @@ namespace skyscraper5.Ietf.Rfc2460
public int TrafficClass { get; } public int TrafficClass { get; }
public int FlowLabel { get; } public int FlowLabel { get; }
public int HeaderEndOffset { get; }
} }
} }

View File

@ -130,7 +130,7 @@ namespace skyscraper5
FileStream fstream = fi.OpenRead(); FileStream fstream = fi.OpenRead();
TsContext mpeg2 = new TsContext(); TsContext mpeg2 = new TsContext();
SkyscraperContext skyscraper = new SkyscraperContext(mpeg2, new InMemoryScraperStorage(), new NullObjectStorage()); SkyscraperContext skyscraper = new SkyscraperContext(mpeg2, new InMemoryScraperStorage(), new BlackholeObjectStorage());
skyscraper.InitalizeFilterChain(); skyscraper.InitalizeFilterChain();
MultiprotocolEncapsulationDecoder mpeDecoder = new MultiprotocolEncapsulationDecoder(skyscraper); MultiprotocolEncapsulationDecoder mpeDecoder = new MultiprotocolEncapsulationDecoder(skyscraper);

View File

@ -0,0 +1,179 @@
using System.Net;
using System.Net.NetworkInformation;
using skyscraper5.Ietf.Rfc2460;
using skyscraper5.Ietf.Rfc768;
using skyscraper5.Ietf.Rfc971;
using skyscraper5.Skyscraper.Plugins;
using skyscraper8.Skyscraper.Net.VirtualNetworks;
using skyscraper8.Skyscraper.Scraper.Storage;
namespace skyscraper8.Skyscraper.Net;
[SkyscraperPlugin]
[StorageId(3)]
[StorageName("Packet Discarder")]
public class BlackholeIpTrafficHandler : IpTrafficHandler
{
public void Dispose()
{
// TODO release managed resources here
}
public void HandleIpPacket(VirtualNetworkIdentifier pid, byte[] payload)
{
if (payload == null || payload.Length == 0)
return;
int ipVersion = (payload[0] & 0xF0) >> 4;
bool isIpv4 = ipVersion == 4;
bool isUdp = false;
int udpOffset = -1;
byte proto;
IPAddress srcAddr;
IPAddress dstAddr;
if (isIpv4)
{
InternetHeader ipv4 = new InternetHeader(payload);
isUdp = ipv4.Protocol == 17;
udpOffset = ipv4.NextHeaderOffset;
srcAddr = ipv4.SourceAddress;
dstAddr = ipv4.DestinationAddress;
proto = ipv4.Protocol;
}
else
{
bool isIpv6 = ipVersion == 6;
if (isIpv6)
{
Ipv6Header ipv6 = new Ipv6Header(payload);
isUdp = ipv6.NextHeader == 17;
udpOffset = ipv6.HeaderEndOffset;
srcAddr = ipv6.SourceAddress;
dstAddr = ipv6.DestinationAddress;
proto = ipv6.NextHeader;
}
else
{
return;
}
}
if (isUdp)
{
UserDatagram userDatagram = new UserDatagram(new Span<byte>(payload).Slice(udpOffset).ToArray());
TrackUdpContent(srcAddr, dstAddr, userDatagram.SourcePort, userDatagram.DestinationPort, userDatagram.Payload);
}
TrackIpContent(srcAddr, dstAddr, proto, payload.Length - udpOffset);
}
private void TrackIpContent(IPAddress srcAddr, IPAddress dstAddr, byte proto, int payloadLength)
{
if (_ipContents == null)
_ipContents = new Dictionary<Tuple<IPAddress, IPAddress, byte>, TrafficTracking>();
Tuple<IPAddress,IPAddress,byte> coordinate = new Tuple<IPAddress, IPAddress, byte>(srcAddr, dstAddr, proto);
if (!_ipContents.ContainsKey(coordinate))
{
TrafficTracking tracking = new TrafficTracking();
tracking.Count(payloadLength);
_ipContents.Add(coordinate, tracking);
}
else
{
_ipContents[coordinate].Count(payloadLength);
}
}
public void HandleLlcFrame(VirtualNetworkIdentifier pid, PhysicalAddress source, PhysicalAddress destination,
ushort etherType, byte[] contents)
{
Tuple<PhysicalAddress, ushort, byte, byte> coordinate = new Tuple<PhysicalAddress, ushort, byte, byte>(destination, etherType, contents[0], contents[1]);
if (_llcContents == null)
_llcContents = new Dictionary<Tuple<PhysicalAddress, ushort, byte, byte>, TrafficTracking>();
if (!_llcContents.ContainsKey(coordinate))
{
TrafficTracking tracking = new TrafficTracking();
tracking.Count(contents.Length - 2);
_llcContents.Add(coordinate, tracking);
}
else
{
_llcContents[coordinate].Count(contents.Length - 2);
}
}
private void TrackUdpContent(IPAddress src, IPAddress dst, ushort srcPort, ushort dstPort, byte[] contents)
{
if (_udpContents == null)
{
_udpContents = new Dictionary<Tuple<IPAddress, IPAddress, ushort, ushort>, TrafficTracking>();
}
Tuple<IPAddress,IPAddress,ushort,ushort> coordinate = new Tuple<IPAddress, IPAddress, ushort, ushort>(src, dst, srcPort, dstPort);
if (!_udpContents.ContainsKey(coordinate))
{
TrafficTracking tracking = new TrafficTracking();
tracking.Count(contents.Length);
_udpContents.Add(coordinate, tracking);
}
else
{
_udpContents[coordinate].Count(contents.Length);
}
}
private Dictionary<Tuple<PhysicalAddress, ushort, byte, byte>, TrafficTracking> _llcContents;
private Dictionary<Tuple<IPAddress, IPAddress, byte>, TrafficTracking> _ipContents;
private Dictionary<Tuple<IPAddress, IPAddress, ushort, ushort>, TrafficTracking> _udpContents;
public class TrafficTracking
{
public void Count(int length)
{
NumPackets++;
NumBytes += length;
}
public int NumPackets { get; set; }
public int NumBytes { get; set; }
}
public bool? TestForUdpTraffic(string srcIp, string dstIp, int stcPort, int dstPort)
{
IPAddress ipL = IPAddress.Parse(srcIp);
IPAddress ipR = IPAddress.Parse(dstIp);
ushort portL = Convert.ToUInt16(stcPort);
ushort portR = Convert.ToUInt16(dstPort);
return TestForUdpTraffic(ipL, ipR, portL, portR);
}
private bool? TestForUdpTraffic(IPAddress srcIp, IPAddress dstIp, ushort stcPort, ushort dstPort)
{
Tuple<IPAddress, IPAddress, ushort, ushort> coordinate = new Tuple<IPAddress, IPAddress, ushort, ushort>(srcIp, dstIp, stcPort, dstPort);
return _udpContents.ContainsKey(coordinate);
}
public bool TestForLlcTraffic(string mac, int ethertype, int ssap, int dsap)
{
PhysicalAddress srcMac = PhysicalAddress.Parse(mac);
ushort etherType16 = Convert.ToUInt16(ethertype);
byte ssap8 = Convert.ToByte(ssap);
byte dsap8 = Convert.ToByte(dsap);
return TestForLlcTraffic(srcMac, etherType16, ssap8, dsap8);
}
private bool TestForLlcTraffic(PhysicalAddress srcMac, ushort etherType16, byte ssap8, byte dsap8)
{
if (_llcContents == null)
return false;
Tuple<PhysicalAddress, ushort, byte, byte> coordinate = new Tuple<PhysicalAddress, ushort, byte, byte>(srcMac, etherType16, ssap8, dsap8);
return _llcContents.ContainsKey(coordinate);
}
}

View File

@ -8,7 +8,7 @@ using skyscraper8.Skyscraper.Net.VirtualNetworks;
namespace skyscraper8.Skyscraper.Net namespace skyscraper8.Skyscraper.Net
{ {
internal interface IpTrafficHandler : IDisposable public interface IpTrafficHandler : IDisposable
{ {
void HandleIpPacket(VirtualNetworkIdentifier pid, byte[] payload); void HandleIpPacket(VirtualNetworkIdentifier pid, byte[] payload);
void HandleLlcFrame(VirtualNetworkIdentifier pid, PhysicalAddress source, PhysicalAddress destination, ushort etherType, byte[] contents); void HandleLlcFrame(VirtualNetworkIdentifier pid, PhysicalAddress source, PhysicalAddress destination, ushort etherType, byte[] contents);

View File

@ -3173,7 +3173,7 @@ namespace skyscraper5.Skyscraper.Scraper
return; return;
} }
//ipTrafficHandler.HandleLlcFrame(pid, source, destination, etherType, contents); ipTrafficHandler.HandleLlcFrame(pid, source, destination, etherType, contents);
MemoryStream llcStream = new MemoryStream(contents, true); MemoryStream llcStream = new MemoryStream(contents, true);
@ -3671,5 +3671,14 @@ namespace skyscraper5.Skyscraper.Scraper
ObjectStorage.StoreThreemediaSegment(tarHeader, entryStream); ObjectStorage.StoreThreemediaSegment(tarHeader, entryStream);
} }
} }
public void OverrideIpTrafficHandler(IpTrafficHandler sink)
{
if (ipTrafficHandler != null)
{
throw new ScraperException("Can not override IP Traffic handler when a handler is already set.");
}
ipTrafficHandler = sink;
}
} }
} }

View File

@ -15,23 +15,55 @@ using skyscraper8.Skyscraper.Scraper.Storage.Tar;
namespace skyscraper8.Skyscraper.Scraper.Storage namespace skyscraper8.Skyscraper.Scraper.Storage
{ {
public class NullObjectStorage : ObjectStorage public class BlackholeObjectStorage : ObjectStorage
{ {
public bool SsdpDeviceKnown(SsdpDevice ssdpDevice)
{
throw new NotImplementedException();
}
public void SsdpStoreMetadata(SsdpDevice ssdpDevice, byte[] ssdpMetadataByteArray)
{
throw new NotImplementedException();
}
public byte[] SsdpGetMetadata(SsdpDevice ssdpDevice)
{
throw new NotImplementedException();
}
public bool ObjectCarouselFileArrival(VfsFile vfsFile, int transportStreamId, int networkId) public bool ObjectCarouselFileArrival(VfsFile vfsFile, int transportStreamId, int networkId)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public bool TestForObjectCarouselFileArrival(string vfsFile, int transportStreamId, int pid, int networkId)
{
throw new NotImplementedException();
}
public byte[] GetObjectCarouselFileArrival(string vfsFile, int transportStreamId, int pid, int networkId)
{
throw new NotImplementedException();
}
public void DataCarouselModuleArrival(int currentNetworkId, int currentTransportStreamId, int elementaryPid, public void DataCarouselModuleArrival(int currentNetworkId, int currentTransportStreamId, int elementaryPid,
ushort moduleModuleId, byte moduleModuleVersion, Stream result) ushort moduleModuleId, byte moduleModuleVersion, Stream result)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
private HashSet<Tuple<int,int,int,ushort,byte>> knownDsmCcModules;
public bool IsDsmCcModuleWanted(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleId, public bool IsDsmCcModuleWanted(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleId,
byte moduleVersion) byte moduleVersion)
{ {
return false; if (knownDsmCcModules == null)
return true;
else
{
Tuple<int,int,int,ushort,byte> module = Tuple.Create(currentNetworkId, currentTransportStreamId, elementaryPid, moduleId, moduleVersion);
return !knownDsmCcModules.Contains(module);
}
} }
public bool TestForFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber, public bool TestForFramegrab(int currentNetworkId, int transportStreamId, ushort mappingProgramNumber,
@ -56,17 +88,19 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
throw new NotImplementedException(); throw new NotImplementedException();
} }
public class NullToken class BlackholeObjectStorageToken
{ {
} }
private object[] _token;
public object[] GetPluginConnector() public object[] GetPluginConnector()
{ {
return new object[1] if (_token == null)
{ {
new NullToken() _token = new object[] { new BlackholeObjectStorageToken() };
}; }
return _token;
} }
public void Ping() public void Ping()
@ -74,13 +108,19 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
throw new NotImplementedException(); throw new NotImplementedException();
} }
private HashSet<string> _nipFiles;
public bool DvbNipTestForFile(string announcedFileContentLocation) public bool DvbNipTestForFile(string announcedFileContentLocation)
{ {
return true; if (_nipFiles == null)
return false;
return _nipFiles.Contains(announcedFileContentLocation);
} }
public void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener) public void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener)
{ {
if (_nipFiles == null)
_nipFiles = new HashSet<string>();
_nipFiles.Add(listener.FileAssociation.ContentLocation);
} }
public void StoreIqGraph(Guid jobGuid, long frequency, char polarity, IqChartData plot) public void StoreIqGraph(Guid jobGuid, long frequency, char polarity, IqChartData plot)
@ -103,6 +143,11 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
throw new NotImplementedException(); throw new NotImplementedException();
} }
public RfSpectrumData GetRfSpectrum(Guid selectedGuid)
{
throw new NotImplementedException();
}
public bool OtvSsuTestFile(int? currentNetworkId, int? currentTransportStreamId, int sourcePid, ushort tableIdExtension, public bool OtvSsuTestFile(int? currentNetworkId, int? currentTransportStreamId, int sourcePid, ushort tableIdExtension,
uint fileId, uint unknown1, uint length) uint fileId, uint unknown1, uint length)
{ {
@ -118,87 +163,65 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
public void OnNdsSsuComplete(int? currentNetworkId, int? currentTransportStreamId, int pid, ushort tableIdExtension, public void OnNdsSsuComplete(int? currentNetworkId, int? currentTransportStreamId, int pid, ushort tableIdExtension,
NdsSsuDataMap dataMap) NdsSsuDataMap dataMap)
{ {
dataMap.Dispose(); throw new NotImplementedException();
} }
public bool NdsSsuTestFile(int? currentNetworkId, int? currentTransportStreamId, int pid, ushort tableIdExtension) public bool NdsSsuTestFile(int? currentNetworkId, int? currentTransportStreamId, int pid, ushort tableIdExtension)
{
return true;
}
public bool SsdpDeviceKnown(SsdpDevice ssdpDevice)
{
return false;
}
public void SsdpStoreMetadata(SsdpDevice ssdpDevice, byte[] ssdpMetadataByteArray)
{
}
public byte[] SsdpGetMetadata(SsdpDevice ssdpDevice)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public bool TestForSisDsaci(int value1, int value2, ushort groupId, int versionNumber) private HashSet<Tuple<int, int, ushort, int>> _sisDsaci;
{ public bool TestForSisDsaci(int value1, int value2, ushort groupId, int versionNumber)
return true;
}
public void StoreSisDsaci(int value1, int value2, ushort currentDsaGroupId, int versionNumber, Stream dsaci)
{
throw new NotImplementedException();
}
public bool TestForObjectCarouselFileArrival(string vfsFile, int transportStreamId, int pid, int networkId)
{ {
throw new NotImplementedException(); if (_sisDsaci == null)
return false;
else
{
return _sisDsaci.Contains(Tuple.Create(value1, value2, groupId, versionNumber));
}
} }
public byte[] GetObjectCarouselFileArrival(string vfsFile, int transportStreamId, int pid, int networkId) public void StoreSisDsaci(int value1, int value2, ushort currentDsaGroupId, int versionNumber, Stream dsaci)
{ {
throw new NotImplementedException(); if (_sisDsaci == null)
_sisDsaci = new HashSet<Tuple<int, int, ushort, int>>();
_sisDsaci.Add(Tuple.Create(value1, value2, currentDsaGroupId, versionNumber));
} }
public byte[] DvbNipGetFile(string path) public byte[] DvbNipGetFile(string path)
{ {
return new byte[0] { }; throw new NotImplementedException();
} }
public RfSpectrumData GetRfSpectrum(Guid selectedGuid) public bool TestForWneStory(uint sessionId, string filename)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public bool TestForWneStory(uint sessionId, string filename) public void StoreWneStory(uint sessionId, string filename, Stream value)
{ {
return true; throw new NotImplementedException();
} }
public void StoreWneStory(uint sessionId, string filename, Stream value) public bool TestForAtsc3Segment(IPEndPoint destination, string outFileName)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public bool TestForAtsc3Segment(IPEndPoint destination, string outFileName) public void StoreAtsc3Segment(IPEndPoint destination, string outFileName, Stream stream)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void StoreAtsc3Segment(IPEndPoint destination, string outFileName, Stream stream) public bool TestForThreemediaSegment(TarHeader tarHeader)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public bool TestForThreemediaSegment(TarHeader tarHeader) public void StoreThreemediaSegment(TarHeader tarHeader, MemoryStream memoryStream)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void StoreThreemediaSegment(TarHeader tarHeader, MemoryStream memoryStream)
{
throw new NotImplementedException();
}
} }
} }