3

My fiber internet provider supports IPTV over UDP. They do not however list the channels anywhere.

I have found most of them manually, but would like to have a script that can verify if a channel is active/available.

Any ideas on how to go about this in Python?

Peter B
  • 59
  • 1
  • 7
  • I had the ip address and portnumber of one of the channels and was then told increase the last digit of the IP address. The channels are not all sequential so it's trial and error. What I'm looking for is a way to add an IP range and test if a given IP within that range contains an IPTV signal then add that IP to a list. – Peter B Jan 02 '11 at 18:04

1 Answers1

1

I think the python code should look like below. Note that don't run it in Python IDLE since ipRange() will hang it.

def ipRange(start_ip, end_ip):
  start = list(map(int, start_ip.split(".")))
  end = list(map(int, end_ip.split(".")))
  temp = start
  ip_range = []

  ip_range.append(start_ip)
  while temp != end:
    start[3] += 1
    for i in (3, 2, 1):
      if temp[i] == 256:
        temp[i] = 0
        temp[i-1] += 1
    ip_range.append(".".join(map(str, temp)))    
  return ip_range

def IPTVSignalTest(ip):
  # do your test here, return true if IPTV signal, false otherwise
  return TRUE

ip_range = ipRange("192.168.1.0", "192.171.3.25")
save_ip = []
for ip in ip_range:
  if IPTVSignalTest(ip):
    save_ip.append(ip)
Ming Hsieh
  • 713
  • 2
  • 8
  • 29