Prospect Feed
IPTV 频道的抓包教程其实有很多,但是在看过这个多的教程之后还是踩了一个很无语的坑。真实诠释了:听过了这么多道理,还是过不好这一生。
因为引用的教程都有很详细的配图,我的教程就不配图了。偷下懒,见谅一下。Related tutorials
- https://www.cnblogs.com/leokale-zz/p/13272694.html
- https://www.right.com.cn/forum/thread-308436-1-1.html
- https://www.right.com.cn/forum/thread-4389926-1-2.html
- https://mozz.ie/posts/extracting-iptv-live-streams
- https://wp.gxnas.com/1189.html
- https://guihet.com/iptvstudy-diyzbsq.html
Flash related tools
- Redmi
AC2100router (flashed OPENWRT system), you can connect to the router throughSSHtool onPC. - Telecom I
PTVbox + 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(win11system)- One Telecom
IPTVdedicated line
Packet capture process
- Connect the dedicated line to the box to enter the setting interface and obtain the
IPTVaccount 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. - After getting the account and password, we switch the networking mode of the box to the
DHCPautomatic 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. - Log in to the router backend, set up
lan1(connect toIPTVdedicated line),lan2(use network cable to connect toiptvbox) bridge (namediptv, will be used later),lan3connect topc(used forSSHlogin); and dialiptvonPPPOEon 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. - Log in to the router through
SSHon thePC, and install the tcpdump tool on the router. It is actually the same tool aswireshark, but it is a command line version. - 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+ccancels thetcpdumpcommand. - Now move the
iptv.capfile toPC, open it usingwireshark, and export theHTTPobject. FindgetchannellistHWCTC.jspand choose to save it as a file. - Open the
getchannellistHWCTC.jspfile and add the following code to the header of the file (and comment thegoServicesEntrymethod):
<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>- Modify the
getchannellistHWCTC.jspfile name togetchannellistHWCTC.htmland open it in the browser, you can download the source file with the suffix.m3u8.
