multicast checker
1.0.0
研究项目
您使用脚本的风险由您自行承担
该项目包含2个脚本:
这两个脚本都兼容 python3 并使用 FFprobe 和 FFmpeg
使用前请先安装:
您可以简单地运行以下示例来查看它是如何工作的:
python3 multicast-checker.py --playlist playlist.m3u
其中playlist.m3u是一个 M3U 文件,其中列出了所有 UDP 频道
M3U 文件示例:
#EXTM3U
#EXTINF:2,Info channel #1
udp://@233.99.65.1:1234
#EXTINF:2,Info channel #2
udp://@233.99.65.2:5500
#EXTINF:2,Info channel #3
udp://@233.99.65.3:1234
#EXTINF:2,Info channel #4
udp://@233.99.65.4:5500
#EXTINF:2,Info channel #5
udp://@233.99.65.5:1234
该脚本将使用多线程扫描 playlist.m3u 中的所有 schannel 并返回结果。 UDP 流中的 service_name 元数据字段将提前捕获。
输出示例:
[*] Email parameters are not defined.
[*] Run the script with -h parameter for the details.
[*] Channel Info channel #2 is not working
[*] Channel Info channel #4 is not working
[*] Channel Info channel #3 is not working
[*] Channel Info channel #5 is not working
[*] OK >>> Channel is working! >>> "Info channel #1" >>> No stream name found
[*] The following channel(s) are not working:
233.99.65.2:5500 - Info channel #2
233.99.65.4:5500 - Info channel #4
233.99.65.3:1234 - Info channel #3
233.99.65.5:1234 - Info channel #5
[*] Finished in 7.0 second(s)
python3 multicast-scanner.py --range 233.99.65.1/30
该脚本将使用多线程扫描给定的 UDP IP 范围并返回结果。 UDP 流中的 service_name 元数据字段将提前捕获。如果找不到 service_name,则将捕获 10 秒样本。
输出示例:
[*] IP range to scan: 233.99.65.0/30
[*] IPs to scan: 4
[*] Ports to scan for each IP: 1
[*] List of the port(s) to scan: 1234
[*] Timeout for UDP stream reply: 5 sec(s)
[*] Timeout for stream data collection: 10 sec(s)
[*] Sample lenght in seconds: 60 sec(s)
[*] Totals:
[*] Total items to scan: 4
[*] Total number of /32 subnets to scan (# of threads): 4
[*] Total number of hosts for each subnet to scan: 1
[*] Estimated maximum time to complete the task: 50 seconds
[*] 0 day(s) 0 hour(s) 0 minute(s) 50 second(s)
[*] Found opened port 1234 for 233.99.65.1
[*] Scanning for 233.99.65.0/32 completed!
[*] Scanning for 233.99.65.2/32 completed!
[*] Scanning for 233.99.65.3/32 completed!
[*] !!! No channel name found for 233.99.65.1:1234 !!!
[*] !!! Channel added to the playlist. 233.99.65.1:1234 >>> 1 !!!
[*] Scanning for 233.99.65.1/32 completed!
[*] Recording the samples for unnamed channels...
[*] !!! Sample for 233.99.65.1:1234 captured !!!
[*] Finished in 14.0 second(s)
[*] 0.0 day(s) 0.0 hour(s) 0.0 minute(s) 14.0 second(s)
[*] Channels found: 1
[*] Resulting file: scan_results_range_233.99.65.0-30.m3u
脚本在 Linux (Ubuntu 20.04) 和 MacOS (Big Sur, 11.2.2) 上进行了测试
您可以使用以下命令找到脚本的所有参数:
python3 multicast-checker.py -h
--playlist "Playlist *.m3u file with UDP streams" required: True
--nic "network interface IP address with UDP stream" required: False default: '0.0.0.0'
--udp_timeout "Time to wait in seconds for the UPD port reply" required: False default: 5
--info_timeout "Time to wait in seconds for the stream's info" required: False default: 10
--smtp_server "SMTP server to send an email" required: False
--smtp_port "Port for SMTP server" required: False default: 25
--sender "email address for email sender" required: False
--receivers "emails of the receivers (space separated)" required: False
python3 multicast-scanner.py -h
--range "Range of IPs to scan." required: True
--size "Size of the subnets to divide." required: False default: '32'
--playlist "Playlist *.m3u file with UDP streams" required: False
--nic "network interface IP address with UDP stream" required: False default: '0.0.0.0'
--udp_timeout "Time to wait in seconds for the UPD port reply" required: False default: 5
--port "addtional UDP port to scan. Default: 1234" required: False default: '1234'
--sample_sec "Sample lenght in seconds" required: False default: 60
--info_timeout "Time to wait in seconds for the stream's info" required: False default: 10
--smtp_server "SMTP server to send an email" required: False
--smtp_port "Port for SMTP server" required: False default: 25
--sender "email address for email sender" required: False
--receivers "emails of the receivers (space separated)" required: False
multicast-checker.py项目是作为监控 ISP IPTV 网络并在频道中断时发送警报的工具而创建的。
multicast-scanner.py项目是作为一个工具创建的,用于发现 ISP 网络中所有可用的 IPTV 频道。
请随意评论/指责/建议进一步的发展
使用的数据:
该项目中的代码已获得 MIT 许可