From b3fc5b3a00d895b05578caca3148a2fd860911b8 Mon Sep 17 00:00:00 2001 From: feyris-tan <4116042+feyris-tan@users.noreply.github.com> Date: Mon, 29 Jun 2026 22:18:07 +0200 Subject: [PATCH] Windows port. --- pcap2mpe/HOW_TO_USE.md | 8 ++++---- pcap2mpe/Program.cs | 22 +++++++++++++++++++--- pcap2mpe/Properties/launchSettings.json | 8 ++++++++ 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 pcap2mpe/Properties/launchSettings.json diff --git a/pcap2mpe/HOW_TO_USE.md b/pcap2mpe/HOW_TO_USE.md index 16d20db..2e404a2 100644 --- a/pcap2mpe/HOW_TO_USE.md +++ b/pcap2mpe/HOW_TO_USE.md @@ -36,16 +36,16 @@ tsp -v --bitrate 230400 \ -P pcradjust --pid 0x0098 \ -P merge --transparent "tsp -I ip -l 127.0.0.2 6969" \ -P pmt --pmt-pid 0x0099 --add-stream-identifier \ - -P sdt -c --service-id 1 --name "pc-203" --type 0x0C \ + -P sdt -c --service-id 1 --name "alpha" --type 0x0C \ -P merge "tsp -v -I ip -l 192.168.1.197 6969 -P zap 1 -P svrename --id 2 1 -P remap 0x0098-0x0106=0x0198" \ -P pmt --pmt-pid 0x0199 --remove-pid 0x0198 --pcr-pid 0x0098 --add-stream-identifier \ - -P sdt -c --service-id 2 --name "fsoca" --type 0x0C \ + -P sdt -c --service-id 2 --name "beta" --type 0x0C \ -P merge "tsp -v -I ip -l 192.168.1.197 6970 -P zap 1 -P svrename --id 3 1 -P remap 0x0098-0x0106=0x0298" \ -P pmt --pmt-pid 0x0299 --remove-pid 0x0298 --pcr-pid 0x0098 --add-stream-identifier \ - -P sdt -c --service-id 3 --name "fsaca" --type 0x0C \ + -P sdt -c --service-id 3 --name "gamma" --type 0x0C \ -P merge "tsp -v -I ip -l 192.168.1.197 6971 -P zap 1 -P svrename --id 4 1 -P remap 0x0098-0x0106=0x0398" \ -P pmt --pmt-pid 0x0399 --remove-pid 0x0398 --pcr-pid 0x0098 --add-stream-identifier \ - -P sdt -c --service-id 4 --name "rwwgw1" --type 0x0C \ + -P sdt -c --service-id 4 --name "delta" --type 0x0C \ -P inject "" --pid 0x14 --bitrate 2000 --stuffing \ -P timeref --system-synchronous \ -P cat -c \ diff --git a/pcap2mpe/Program.cs b/pcap2mpe/Program.cs index 9a7cd68..213c207 100644 --- a/pcap2mpe/Program.cs +++ b/pcap2mpe/Program.cs @@ -9,9 +9,12 @@ class Program if (args.Length == 0) { Console.WriteLine("specify interface as first argument"); - return; + Console.WriteLine(); + Console.WriteLine("Available interfaces are:"); + ListDevices(); + return; } - + if (args[0].Equals("lo")) { Console.WriteLine("can't use the loopback interface"); @@ -33,7 +36,7 @@ class Program if (targetDevice == null) { - Console.WriteLine("No target device found"); + Console.WriteLine("target device not found"); return; } @@ -43,4 +46,17 @@ class Program targetDevice.Open(DeviceModes.Promiscuous, 9001); targetDevice.Capture(); } + + private static void ListDevices() + { + var captureDeviceList = CaptureDeviceList.New(); + captureDeviceList.Refresh(); + + ILiveDevice targetDevice = null; + foreach (ILiveDevice liveDevice in captureDeviceList) + { + Console.WriteLine("Specifiy \"{0}\" for \"{1}\"", liveDevice.Name, liveDevice.Description); + + } +} } \ No newline at end of file diff --git a/pcap2mpe/Properties/launchSettings.json b/pcap2mpe/Properties/launchSettings.json new file mode 100644 index 0000000..1bb37c8 --- /dev/null +++ b/pcap2mpe/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "pcap2mpe": { + "commandName": "Project", + "commandLineArgs": "\\Device\\NPF_{D9858E17-7D85-4F8B-8FA5-ED3F630A9AC1}" + } + } +} \ No newline at end of file