Prospect Feed

  IPTV 频道的抓包教程其实有很多,但是在看过这个多的教程之后还是踩了一个很无语的坑。真实诠释了:听过了这么多道理,还是过不好这一生。
  因为引用的教程都有很详细的配图,我的教程就不配图了。偷下懒,见谅一下。
  • Redmi AC2100 router (flashed OPENWRT system), you can connect to the router through SSH tool on PC.
  • Telecom IPTV box + remote control (if there is no replacement, you can use a mobile phone with infrared function)
  • One monitor connected to the box to play TV
  • pc (win11 system)
  • One Telecom IPTV dedicated line

Packet capture process

  1. Connect the dedicated line to the box to enter the setting interface and obtain the IPTV account and password. This step is very simple, but it is quite difficult for me because I don’t have a remote control. Because the TV box belongs to the company, the previous colleague did not hand over the remote control when he resigned. Then, did my phone have infrared? Finally, I borrowed another colleague’s phone to install the universal remote control before entering the setting interface.
  2. After getting the account and password, we switch the networking mode of the box to the DHCP automatic acquisition mode. This step is very important. I didn’t set up this step, which caused me to take detours later. Because if you are dialing in the box, then no matter you are using a router, a packet capture tool, or even the port mirroring function of the switch, there is no way to capture the channel.
  3. Log in to the router backend, set up lan1 (connect to IPTV dedicated line), lan2 (use network cable to connect to iptv box) bridge (named iptv, will be used later), lan3 connect to pc (used for SSH login); and dial iptv on PPPOE on the secondary bridge network card (use the account and password obtained previously). Open the box and check the TV channels. If you can watch TV normally now, then you are only one step away from grabbing the TV channel information.
  4. Log in to the router through SSH on the PC, and install the tcpdump tool on the router. It is actually the same tool as wireshark, but it is a command line version.
  5. Turn off the TV box first, then execute tcpdump -i iptv -w /tmp/iptv.cap, then open the TV box, select a channel from the live broadcast list to play at will. After discovering data appearing in the command line interface, ctrl+c cancels the tcpdump command.
  6. Now move the iptv.cap file to PC, open it using wireshark, and export the HTTP object. Find getchannellistHWCTC.jsp and choose to save it as a file.
  7. Open the getchannellistHWCTC.jsp file and add the following code to the header of the file (and comment the goServicesEntry method):
  <script>
  const goServicesEntry = function () { };
  var Authentication = {};
  var m3u8Channels = "";
  Authentication['CTCSetConfig'] = function () {
    const regex = /,?(.+?)="(.*?)"/gm;
    if (arguments[0] == 'Channel') {
      var info = {};
      while ((m = regex.exec(arguments[1])) !== null) {
        if (m.index === regex.lastIndex) {
          regex.lastIndex++;
        }
        if (m[1] == "ChannelName") {
          m3u8Channels += "#EXTINF:-1 tvg-name=\"" + m[2] + "\"," + m[2] + "\n"
        }
        if (m[1] == "ChannelURL") {
          const channelURL = m[2].split("|");
          if (channelURL.length == 2) {
            m3u8Channels += channelURL[1] + "\n"
          }
        }

      }
    }
  }
  setTimeout(function () {
    var a = window.document.createElement('a');
    a.href = window.URL.createObjectURL(new Blob([m3u8Channels], { type: 'application/x-mpegURL' }));
    a.download = 'IPTV.m3u8';
    document.body.appendChild(a);
    a.click();
    document.body.removeChild(a);
  }, 1000);
</script>
  1. Modify the getchannellistHWCTC.jsp file name to getchannellistHWCTC.html and open it in the browser, you can download the source file with the suffix .m3u8.

You need to search for the router flashing tutorial according to your needs. Attached is the flashing tutorial for Redmi AC2100.