Skip to content

Instantly share code, notes, and snippets.

@gvanem
Last active January 29, 2022 18:21
Show Gist options
  • Select an option

  • Save gvanem/8a83e5f5dd487af4bf4e73c0f81c5393 to your computer and use it in GitHub Desktop.

Select an option

Save gvanem/8a83e5f5dd487af4bf4e73c0f81c5393 to your computer and use it in GitHub Desktop.
Python script to poll a list of AirSpy servers from the list at https://airspy.com/spy-servers/ + some more. Use as e.g: py -3 SpyServerPoll.py -c sdr://k2*
"""A Python script to poll a list of AirSpy, Kiwi and SDR-Console (V3) servers.
"""
#
# By G. Vanem <[email protected]> 2018
#
# The Gist is here:
# https://gist.github.com/gvanem/8a83e5f5dd487af4bf4e73c0f81c5393
#
# todo: OpenWebRX and WebSockets like this:
# ws://n8mdp.dyndns.org:8073/",ws/5a6203636b565174b91b96498705a3b3
#
# todo: Ping the servers before/after (?) connecting to them.
#
from __future__ import print_function
import sys, os, argparse, signal, struct, fnmatch, time, socket, csv
PY3 = (sys.version[0] == '3')
this_prog = sys.argv[0]
this_dir = os.path.dirname(__file__)
quit = False
_DEF_TIMEOUT = 5
_DEF_PORT_SDR = 1234
_DEF_PORT_HTTP = 8073
_URL = 0
_LOCATION = 1
_RADIO = 2
opt = None
class colour:
GREEN = RED = YELLOW = RESET = ""
try:
from colorama import init, Fore, Style
init()
colour.GREEN = Fore.GREEN + Style.BRIGHT
colour.RED = Fore.RED + Style.BRIGHT
colour.YELLOW = Fore.YELLOW + Style.BRIGHT
colour.RESET = Style.RESET_ALL
except:
pass
#
# _URL _LOCATION _RADIO
#
spy_servers = [
[ "sdr://airspy.com:5559", "Amsterdam, NL", "Airspy HF+" ],
[ "sdr://rtlsdrblog.hopto.org", "Auckland, NZ", "Airspy HF+" ],
[ "sdr://193.93.75.99:5555", "Bratislava, SK", "RTL-SDR V2" ],
[ "sdr://airspy.com:5557", "Copenhagen, DK", "Airspy HF+" ],
[ "sdr://airspy.com:5558", "Cornwall, UK", "Airspy HF+" ],
[ "sdr://airspy.com:5559", "Cornwall, UK", "Airspy HF+" ],
[ "sdr://pjm.uhf-satcom.com:55555", "Dorset, UK", "Airspy HF+" ],
[ "sdr://pjm.uhf-satcom.com:55556", "Dorset, UK", "Airspy R2" ],
[ "sdr://85.183.11.108:5555", "Hamburg, DE", "Airspy R2" ],
[ "sdr://fenu-airspy.ddns.net", "Kefikon, CH", "Airspy HF+" ],
[ "sdr://5.135.3.67:5555", "Budejovice, CZ", "Airspy HF+" ],
[ "sdr://109.164.114.15:50101", "??", "V3Server" ],
[ "sdr://qthr.ddns.net", "London, UK", "Airspy Mini" ],
[ "sdr://londonhf.radioham.com", "London, UK", "Airspy R2+SpyVerter" ],
[ "sdr://k2sdr.dyndns.org", "New Jersey, USA", "Airspy R2+SpyVerter" ],
[ "sdr://k2sdr.dyndns.org:5556", "New Jersey, USA", "RTL-SDR" ],
[ "sdr://airspy.com:5555", "Paris, FR", "Airspy HF+" ],
[ "sdr://ik0mmi.ddns.net", "Perugia, IT", "Airspy R2" ],
[ "sdr://saltdean.ddns.net", "Sussex, UK", "Airspy R2" ],
[ "sdr://k2zn.ddns.net:5555", "Rochester, NY, USA", "Airspy HF+" ],
[ "sdr://80.229.173.194:5555", "UK", "Airspy Mini" ],
[ "sdr://87.6.14.181:5555", "San Marino", "Airspy HF+" ],
[ "sdr://178.212.47.131:34063", "Poland", "Airspy HF+" ],
[ "sdr://66.220.248.9:5555", "Vermont, USA", "Airspy HF+" ],
[ "sdr://75.52.185.118:5555", "USA", "Airspy HF+" ],
[ "sdr://212.187.114.164:5556", "Netherland", "Airspy HF+" ],
[ "sdr://188.27.170.170:5555", "Bucharest, Romania", "Airspy HF+" ],
[ "sdr://75.26.160.74:50000", "Nevada City, CA, USA", "SDR-IQ" ],
[ "sdr://86.134.72.80:50000", "Sunbury-on-Thames, UK", "SDR-IQ" ],
[ "sdr://72.172.110.98:8019", "Beaverhill, CA", "SDR-IQ" ],
[ "sdr://209.194.249.18:50000", "Tucson, USA", "SDR-IQ" ],
[ "sdr://137.103.107.73:50000", "Waterford, USA", "SDR-IQ" ],
[ "sdr://185.123.114.129:50000", "Drayton, UK", "SDR-IQ" ],
[ "sdr://216.137.195.217:50000", "Palmer, Alaska", "CloudIQ" ],
[ "sdr://31.51.14.164:5000", "Maidenhead, UK", "CloudIQ" ],
]
#
# Generated via:
# lynx -dump http://kiwisdr.com/public/ | grep --before-context=2 'http://.*:807.'
#
# TODO:
# Use the 'kiwisdr_com' Json-array from:
# http://rx.linkfanel.net/kiwisdr_com.js
#
# to generate extra data.
#
kiwi_servers = [
[ "http://on5kq.ddns.net:8078" , "?", "?" ],
[ "http://on5kq.ddns.net:8074" , "?", "?" ],
[ "http://on5kq.ddns.net:8077" , "?", "?" ],
[ "http://ua3ahm.ddns.net:8073" , "?", "?" ],
[ "http://f1jeksdr1.ddns.net:8073" , "?", "?" ],
[ "http://ve3hoa.ddns.net:8073" , "?", "?" ],
[ "http://ma3kiwi.ddns.net:8073" , "?", "?" ],
[ "http://w7pua.ddns.net:8073" , "?", "?" ],
[ "http://data3.caprockweather.com:8073" , "?", "?" ],
[ "http://sdr.sixvpn.net:8073" , "?", "?" ],
[ "http://sdr.m0taz.co.uk:8073" , "?", "?" ],
[ "http://tangar.utvarp.com:8073" , "?", "?" ],
[ "http://hasenberg700m.ddns.net:8073" , "?", "?" ],
[ "http://glorinha.kiwisdr.com.br:8073" , "?", "?" ],
[ "http://kiwisdr.hirokinet.com:8074" , "?", "?" ],
[ "http://186.193.231.135:8073" , "?", "?" ],
[ "http://31.53.94.180:8073" , "?", "?" ],
[ "http://nippynet.com:8073" , "?", "?" ],
[ "http://atxsdr.zapto.org:8073" , "?", "?" ],
[ "http://k4led.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://173.209.121.35:8063" , "?", "?" ],
[ "http://bat-server.dyndns.org:8073" , "?", "?" ],
[ "http://sdr-kiel.dyn-ip24.de:8073" , "?", "?" ],
[ "http://44.140.163.236:8073" , "?", "?" ],
[ "http://py1kk.dyndns.org:8074" , "?", "?" ],
[ "http://32.211.98.147:8074" , "?", "?" ],
[ "http://83.200.146.38:8073" , "?", "?" ],
[ "http://kiwi.42dx.ru:8073" , "?", "?" ],
[ "http://kiwisdr1.hoka.co.uk:8072" , "?", "?" ],
[ "http://vk6qs.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://ik2biy.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://ja0veu.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://202.127.177.27:8074" , "?", "?" ],
[ "http://ohioswl.com:8073" , "?", "?" ],
[ "http://sdr.n4but.com:8173" , "?", "?" ],
[ "http://98.163.194.144:8073" , "?", "?" ],
[ "http://planet3.dyndns.org:8073" , "?", "?" ],
[ "http://kiwisdr.marmosetelectronics.com:8073" , "?", "?" ],
[ "http://sdr.hfunderground.com:8077" , "?", "?" ],
[ "http://sdr.hfunderground.com:8078" , "?", "?" ],
[ "http://f6abj-kiwihf.ddns.net:8073" , "?", "?" ],
[ "http://n5hyh.ddns.net:8073" , "?", "?" ],
[ "http://WV5L-sdr.dynu.net:8073" , "?", "?" ],
[ "http://w9mdo.dvrdns.org:8073" , "?", "?" ],
[ "http://sdrbcn.duckdns.org:8073" , "?", "?" ],
[ "http://lounix.net:8073" , "?", "?" ],
[ "http://db0hal.dyndns.org:8073" , "?", "?" ],
[ "http://g4bkhkiwi.ddns.net:8073" , "?", "?" ],
[ "http://kiwisdr.briata.org:8073" , "?", "?" ],
[ "http://ntkiwi.uni-paderborn.de:8073" , "?", "?" ],
[ "http://kiwi.farnham-sdr.com:8073" , "?", "?" ],
[ "http://allewaert.redirectme.net:8073" , "?", "?" ],
[ "http://db3th.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://de1lon.dd-dns.de:8073" , "?", "?" ],
[ "http://kiwisdr.ve7av.ca:8073" , "?", "?" ],
[ "http://ab9mq.hopto.org:8073" , "?", "?" ],
[ "http://gnss.0am.jp" , "?", "?" ],
[ "http://m6gqu.duckdns.org:8073" , "?", "?" ],
[ "http://212.225.223.201:8073" , "?", "?" ],
[ "http://oe3xfh.websdr.at:8073" , "?", "?" ],
[ "http://df1qq.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://9k2ra-2k.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://foxgulch.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://jplin53a.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://kiwisdr.gadallah.net:8073" , "?", "?" ],
[ "http://jimlill.com:8076" , "?", "?" ],
[ "http://g0vqy-kiwisdr.ddns.net:8073" , "?", "?" ],
[ "http://jimlill.com:8074" , "?", "?" ],
[ "http://kj7oxt.ddns.net:8073" , "?", "?" ],
[ "http://76.126.82.217:8073" , "?", "?" ],
[ "http://ka7u.no-ip.org:8074" , "?", "?" ],
[ "http://jimlill.com:8075" , "?", "?" ],
[ "http://w4qed.hamshack.info:8073" , "?", "?" ],
[ "http://38.86.67.206:8078" , "?", "?" ],
[ "http://83.82.152.141:8073" , "?", "?" ],
[ "http://68.14.214.57:8073" , "?", "?" ],
[ "http://r3tio.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://kiwi.ve7gl.ca:8073" , "?", "?" ],
[ "http://kiwisdr.lamont.me.uk:8073" , "?", "?" ],
[ "http://cwitalia.ddns.net:8073" , "?", "?" ],
[ "http://www.dd9lh.de:8073" , "?", "?" ],
[ "http://sdr.yo3ksr.ro:8073" , "?", "?" ],
[ "http://sdr-amradioantennas.com:8075" , "?", "?" ],
[ "http://kiwisdr.hirokinet.com:8073" , "?", "?" ],
[ "http://85.150.102.90:8073" , "?", "?" ],
[ "http://midskiwi.ddns.net:8073" , "?", "?" ],
[ "http://kiwisdr.aprsinfo.com:8073" , "?", "?" ],
[ "http://99.3.11.63:8073" , "?", "?" ],
[ "http://hb9bxewebsdr.ddns.net:8073" , "?", "?" ],
[ "http://kiwisdr-iz0ina.ns0.it:8073" , "?", "?" ],
[ "http://kiwi.web-sdr.at:8073" , "?", "?" ],
[ "http://174.112.185.12:8073" , "?", "?" ],
[ "http://keywest.twrmon.net:8073" , "?", "?" ],
[ "http://sdr.hdarc.co.uk:8073" , "?", "?" ],
[ "http://risxcgcs7tf4gwzi.myfritz.net:8074" , "?", "?" ],
[ "http://greatexpectations.se:8073" , "?", "?" ],
[ "http://kiwisdr.njctech.com:8073" , "?", "?" ],
[ "http://railgun.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://85.191.81.117:8073" , "?", "?" ],
[ "http://185.199.176.46:8073" , "?", "?" ],
[ "http://hb9ttu.dyndns.org:8073" , "?", "?" ],
[ "http://174.99.82.202:8073" , "?", "?" ],
[ "http://pw5w.homeip.net:8073" , "?", "?" ],
[ "http://ea7hpm.ddns.net:8073" , "?", "?" ],
[ "http://fenu-radio.ddns.net:8073" , "?", "?" ],
[ "http://websdr.dnsuser.de:8073" , "?", "?" ],
[ "http://sdr.hfunderground.com:8075" , "?", "?" ],
[ "http://ur4pwj.lrv.net.ua:8073" , "?", "?" ],
[ "http://jk1lot.ham-radio-op.net:8073" , "?", "?" ],
[ "http://dr.twrmon.net:8073" , "?", "?" ],
[ "http://kp.twrmon.net:8073" , "?", "?" ],
[ "http://df8fh.ddnss.de:8073" , "?", "?" ],
[ "http://sdr.hfunderground.com:8074" , "?", "?" ],
[ "http://blackforestkiwi.ddns.net:8075" , "?", "?" ],
[ "http://70.115.110.81:8073" , "?", "?" ],
[ "http://73.185.80.191:8073" , "?", "?" ],
[ "http://www.cheshiresdr.co.uk" , "?", "?" ],
[ "http://118.243.180.108:8073" , "?", "?" ],
[ "http://69.27.184.58:8074" , "?", "?" ],
[ "http://sdr.vy.fi" , "?", "?" ],
[ "http://matt1234.viewnetcam.com:8073" , "?", "?" ],
[ "http://kiwisdr2.sdrutah.org:8074" , "?", "?" ],
[ "http://carinthia.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://mvradio.org:8073" , "?", "?" ],
[ "http://119.18.20.124:8073" , "?", "?" ],
[ "http://dentonhill-sdr.moses.bz" , "?", "?" ],
[ "http://swiss.ham-radio-op.net:8073" , "?", "?" ],
[ "http://swiss.ham-radio-op.net:8075" , "?", "?" ],
[ "http://kiwisdr-DK0FFO.hamspirit.de:8073" , "?", "?" ],
[ "http://46.69.196.132:8073" , "?", "?" ],
[ "http://kram-bt.dyndns.org:8073" , "?", "?" ],
[ "http://cdkiwisdr.ddns.net:8073" , "?", "?" ],
[ "http://vk2aak.ddns.net:8073" , "?", "?" ],
[ "http://oe3wyc.ddns.net:8073" , "?", "?" ],
[ "http://kf2da.ddns.net:8073" , "?", "?" ],
[ "http://kiwisdr4.sdrutah.org:8076" , "?", "?" ],
[ "http://kiwisdr1.sdrutah.org:8073" , "?", "?" ],
[ "http://emeraldsdr1.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://oe1xtu.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://kd9khz.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://kiwisdr.owdjim.gen.nz:8073" , "?", "?" ],
[ "http://caruaru.kiwisdr.com.br:8073" , "?", "?" ],
[ "http://sdr1hgn.ddns.net" , "?", "?" ],
[ "http://85.183.11.108:8073" , "?", "?" ],
[ "http://sv8rv.dyndns.org:8073" , "?", "?" ],
[ "http://ymartin.com:8073" , "?", "?" ],
[ "http://hb9ibe.internet-box.ch:8073" , "?", "?" ],
[ "http://oz1bfm.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://wo2s.hopto.org:8073" , "?", "?" ],
[ "http://g4gnk.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://31.187.212.94:8073" , "?", "?" ],
[ "http://178.174.166.174:8074" , "?", "?" ],
[ "http://9z4rgsdr2.ddns.net:8073" , "?", "?" ],
[ "http://dl2sba.ddns.net:8073" , "?", "?" ],
[ "http://kiwistbg.ddns.net:8074" , "?", "?" ],
[ "http://k2zn.ddns.net:8073" , "?", "?" ],
[ "http://kiwisdr.ddnss.de:8073" , "?", "?" ],
[ "http://kiwisdr.gmejpeqqtsdklisr.myfritz.net:8073" , "?", "?" ],
[ "http://kiwisdr.moxley.us:8073" , "?", "?" ],
[ "http://kiwi-kuo.aprs.fi:8073" , "?", "?" ],
[ "http://sdr-amradioantennas.com:8072" , "?", "?" ],
[ "http://os.f5.si:8073" , "?", "?" ],
[ "http://la1d.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://kiwi.oe9.at:8074" , "?", "?" ],
[ "http://204.235.44.74:8073" , "?", "?" ],
[ "http://74.82.153.108:8073" , "?", "?" ],
[ "http://sdr.ok2kyj.cz:8073" , "?", "?" ],
[ "http://ka7u.no-ip.org:8073" , "?", "?" ],
[ "http://norfolk.george-smart.co.uk:8073" , "?", "?" ],
[ "http://kiwisdr.n2law.net:8073" , "?", "?" ],
[ "http://ciw321.cfars.ca:8174" , "?", "?" ],
[ "http://sa4bna.hopto.org:8073" , "?", "?" ],
[ "http://118.104.14.161:8073" , "?", "?" ],
[ "http://80.75.112.98:8073" , "?", "?" ],
[ "http://fw.k6mtu.net:8073" , "?", "?" ],
[ "http://59.167.63.92:8073" , "?", "?" ],
[ "http://bikedork.myddns.me:8073" , "?", "?" ],
[ "http://24.78.155.2:8073" , "?", "?" ],
[ "http://arcticsdr.ddns.net:8073" , "?", "?" ],
[ "http://kiwisdrvolker.ddns.net:8073" , "?", "?" ],
[ "http://iz6byy.ddns.net:8073" , "?", "?" ],
[ "http://kiwisdr.areg.org.au:8073" , "?", "?" ],
[ "http://77.162.242.103:8073" , "?", "?" ],
[ "http://webcamapo.dynt4.de:8073" , "?", "?" ],
[ "http://oh1rj.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://kiwisdr.ka9q.net:8073" , "?", "?" ],
[ "http://msk.swl.su:8073" , "?", "?" ],
[ "http://ka7oeikiwi.ddns.net:8073" , "?", "?" ],
[ "http://df3af.ddns.net:8073" , "?", "?" ],
[ "http://aa842.jp:8073" , "?", "?" ],
[ "http://kiwisdriu8cri.addns.org:8073" , "?", "?" ],
[ "http://kiwisdr.sk2hg.se:8073" , "?", "?" ],
[ "http://sdr.n3ka.com:8073" , "?", "?" ],
[ "http://69.27.184.58:8073" , "?", "?" ],
[ "http://newdelhi.twrmon.net:8073" , "?", "?" ],
[ "http://m0aqy.uk:8073" , "?", "?" ],
[ "http://sdr.pjs.de:8073" , "?", "?" ],
[ "http://air.swl.su:8073" , "?", "?" ],
[ "http://hb9ttu.dyndns.org:8074" , "?", "?" ],
[ "http://WWW.ALFARADIO.CA:8073" , "?", "?" ],
[ "http://vk2ggc2.ddns.net:8074" , "?", "?" ],
[ "http://kj6ei.ddns.net:8073" , "?", "?" ],
[ "http://w9adkiwi.hopto.org:8073" , "?", "?" ],
[ "http://oh5ae.dyndns.org:8073" , "?", "?" ],
[ "http://sbs1suisse.internet-box.ch:8073" , "?", "?" ],
[ "http://Hallmann.selfhost.eu" , "?", "?" ],
[ "http://PONTAULTCOMBAULT.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://ph0a.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://oh5liz.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://211.135.186.118:8073" , "?", "?" ],
[ "http://birdsnest.zapto.org:8073" , "?", "?" ],
[ "http://kiwisdr.ping.net.au:8080" , "?", "?" ],
[ "http://kiwisdr.hameleers.net:8073" , "?", "?" ],
[ "http://ptlensdr.ddns.net:8073" , "?", "?" ],
[ "http://fsdr.duckdns.org" , "?", "?" ],
[ "http://w3piesdr.ddns.net:8073" , "?", "?" ],
[ "http://w3piesdr.ddns.net:7073" , "?", "?" ],
[ "http://swiss.ham-radio-op.net:8074" , "?", "?" ],
[ "http://n4dkd.asuscomm.com:8073" , "?", "?" ],
[ "http://84.112.131.138:8073" , "?", "?" ],
[ "http://kiwisdr.dhmitchell.com:8073" , "?", "?" ],
[ "http://boca.homeip.net:8073" , "?", "?" ],
[ "http://141.75.245.241:8073" , "?", "?" ],
[ "http://141.75.245.240:8073" , "?", "?" ],
[ "http://lodingen.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://www.na5b.com:8073" , "?", "?" ],
[ "http://vilhena.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://vr2bg.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://nd8d.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://pd0dh.ddns.net:8073" , "?", "?" ],
[ "http://rgv.twrmon.net:8075" , "?", "?" ],
[ "http://rgv2.twrmon.net:8074" , "?", "?" ],
[ "http://sabbel-nich.goip.de:8073" , "?", "?" ],
[ "http://dj9kaikiwi.ddns.net:8073" , "?", "?" ],
[ "http://kiwisdr.bh7jag.com:8073" , "?", "?" ],
[ "http://sdr.k9mq.com:8073" , "?", "?" ],
[ "http://tsgo.synology.me" , "?", "?" ],
[ "http://w9xa.us:8073" , "?", "?" ],
[ "http://ratisbona.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://sergiocorda.synology.me:8076" , "?", "?" ],
[ "http://la2g.ddns.net:8072" , "?", "?" ],
[ "http://julussdalen.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://89.34.219.106:8073" , "?", "?" ],
[ "http://kiwisdr.n2yo.net:8073" , "?", "?" ],
[ "http://hl3amo.ddns.net:8074" , "?", "?" ],
[ "http://ku4a.ddns.net:8073" , "?", "?" ],
[ "http://72.235.217.245:8073" , "?", "?" ],
[ "http://kiwi-sm2gct.mooo.com:8073" , "?", "?" ],
[ "http://sdr-amradioantennas.com:8071" , "?", "?" ],
[ "http://108.174.127.102:8073" , "?", "?" ],
[ "http://take4radio.asuscomm.com:8073" , "?", "?" ],
[ "http://kiwi-vih.aprs.fi:8073" , "?", "?" ],
[ "http://81.174.134.21:8073" , "?", "?" ],
[ "http://raleigh.twrmon.net:8073" , "?", "?" ],
[ "http://rx2.wa2zkd.net:8073" , "?", "?" ],
[ "http://pso.p.sdrotg.com:8073" , "?", "?" ],
[ "http://174.99.82.202:8074" , "?", "?" ],
[ "http://89.212.54.101:8073" , "?", "?" ],
[ "http://83.162.220.82:8073" , "?", "?" ],
[ "http://plonsk3.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://hb9odp.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://fabrys.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://kd7nfr.freeddns.org:8073" , "?", "?" ],
[ "http://94.214.128.124:8073" , "?", "?" ],
[ "http://n4tvc.zapto.org:8073" , "?", "?" ],
[ "http://sdrtas.ddns.net:8073" , "?", "?" ],
[ "http://sdrtoyb.ddns.net:8073" , "?", "?" ],
[ "http://ElsinorePeak.DDNS.Net:8073" , "?", "?" ],
[ "http://erserver.ddns.net:8073" , "?", "?" ],
[ "http://185.89.55.189:8073" , "?", "?" ],
[ "http://wa6our.ddns.net:8073" , "?", "?" ],
[ "http://sdr.w1eqx.com:8073" , "?", "?" ],
[ "http://kb1.psokiwi.net:8073" , "?", "?" ],
[ "http://kiwi-hf.hamradio.isel.ipl.pt:8073" , "?", "?" ],
[ "http://bodenberg.my-wan.de:8081" , "?", "?" ],
[ "http://kiwi.ziegler.bz:8073" , "?", "?" ],
[ "http://73.150.139.247:8073" , "?", "?" ],
[ "http://zubi.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://sdrbris.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://32.211.98.147:8073" , "?", "?" ],
[ "http://daviken.ddns.net:8073" , "?", "?" ],
[ "http://sdr-amradioantennas.com:8074" , "?", "?" ],
[ "http://72.172.110.98:8175" , "?", "?" ],
[ "http://pallas-kiwi.ddns.net:8073" , "?", "?" ],
[ "http://ur4nww.ddns.net:8073" , "?", "?" ],
[ "http://pa3emx.ddns.net:8073" , "?", "?" ],
[ "http://colombiadx.ddns.net:8073" , "?", "?" ],
[ "http://hl3amo.ddns.net:8075" , "?", "?" ],
[ "http://mdusakiwi.ddns.net:8073" , "?", "?" ],
[ "http://nw8s-kiwi.ddns.net:8073" , "?", "?" ],
[ "http://irelandnorthwest.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://cx8bit.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://do1dbs.dd-dns.de:8073" , "?", "?" ],
[ "http://24.245.90.36:8073" , "?", "?" ],
[ "http://kiwisdr-m0kwr.ddns.net:8073" , "?", "?" ],
[ "http://kiwisdr.ku4by.com:8073" , "?", "?" ],
[ "http://grimsoy.dyndns.org:8073" , "?", "?" ],
[ "http://javaradiofrance.ddns.net:8073" , "?", "?" ],
[ "http://n1bpd.net:8073" , "?", "?" ],
[ "http://ov1bcn.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://w5uxh.ddns.net:8073" , "?", "?" ],
[ "http://209.115.233.71:8073" , "?", "?" ],
[ "http://kiwisdr2.hoka.co.uk:8073" , "?", "?" ],
[ "http://78.71.162.126:8073" , "?", "?" ],
[ "http://87.251.229.127:8073" , "?", "?" ],
[ "http://station.mynetgear.com:8073" , "?", "?" ],
[ "http://kiwisdr.itfais.com:8073" , "?", "?" ],
[ "http://77.38.19.217:8073" , "?", "?" ],
[ "http://la8uu.duckdns.org:8073" , "?", "?" ],
[ "http://198.200.90.74:8073" , "?", "?" ],
[ "http://ka7u.no-ip.org:8075" , "?", "?" ],
[ "http://kiwisdr.w6sun.club:8873" , "?", "?" ],
[ "http://iw2nke.ddns.net:8073" , "?", "?" ],
[ "http://kiwi.24x7.hk:8073" , "?", "?" ],
[ "http://warszawa.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://i1fqh.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://oe6cud.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://ssi.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://kiwisdrzl1kfm.ddns.net:8073" , "?", "?" ],
[ "http://sk6ag2.ddns.net:8072" , "?", "?" ],
[ "http://oss706.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://sdxlkiwi3.ddns.net:8074" , "?", "?" ],
[ "http://158.255.239.102:8073" , "?", "?" ],
[ "http://kiwisdr.audric.it:8073" , "?", "?" ],
[ "http://ams.dedyn.io:8073" , "?", "?" ],
[ "http://radio.ofadam.com:8073" , "?", "?" ],
[ "http://kiwijo53cn.ddnss.org:8073" , "?", "?" ],
[ "http://emeraldsdr.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://bottlebranch.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://141.135.55.42:8073" , "?", "?" ],
[ "http://82.99.19.40:8073" , "?", "?" ],
[ "http://sbs1suisse.internet-box.ch:8075" , "?", "?" ],
[ "http://kongsdr.ddns.net:8074" , "?", "?" ],
[ "http://raspsdr.psokiwi.net:80734" , "?", "?" ],
[ "http://dl4qb.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://bengaluru.twrmon.net:8073" , "?", "?" ],
[ "http://heinerskiwi.ddns.net:8073" , "?", "?" ],
[ "http://camanserville.no-ip.biz:8073" , "?", "?" ],
[ "http://68.201.195.142:8073" , "?", "?" ],
[ "http://75.144.20.99:8073" , "?", "?" ],
[ "http://malinsdr.ddns.net:8073" , "?", "?" ],
[ "http://astw.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://db0ovp.de:8073" , "?", "?" ],
[ "http://jplin53c.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://alex.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://balou.spdns.de:8074" , "?", "?" ],
[ "http://sdr.hfunderground.com:8073" , "?", "?" ],
[ "http://kiwiik2wbg.ddns.net:8073" , "?", "?" ],
[ "http://elektrongr.ddns.net:8073" , "?", "?" ],
[ "http://on5kq.ddns.net:8073" , "?", "?" ],
[ "http://sdr.ddns.net:8073" , "?", "?" ],
[ "http://km6cq.hopto.org:8073" , "?", "?" ],
[ "http://k4luz.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://lb8pi.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://alfaromeo170.myqnapcloud.com:8073" , "?", "?" ],
[ "http://sdr.hfunderground.com:8076" , "?", "?" ],
[ "http://www.dxcluster.world:8073" , "?", "?" ],
[ "http://65.29.124.73:8073" , "?", "?" ],
[ "http://websdr.uk:8076" , "?", "?" ],
[ "http://kiwisdr.ve6slp.ca:8173" , "?", "?" ],
[ "http://websdr.uk:8074" , "?", "?" ],
[ "http://websdr.uk:8073" , "?", "?" ],
[ "http://websdr.uk:8077" , "?", "?" ],
[ "http://websdr.uk:8060" , "?", "?" ],
[ "http://www.websdr.at:8073" , "?", "?" ],
[ "http://websdr.uk:8078" , "?", "?" ],
[ "http://81.168.1.206:8073" , "?", "?" ],
[ "http://78.40.253.65" , "?", "?" ],
[ "http://192.168.1.148:8073" , "?", "?" ],
[ "http://bonaire.twrmon.net:8073" , "?", "?" ],
[ "http://hb9ttu.dyndns.org:8075" , "?", "?" ],
[ "http://eemedia.mynetgear.com:8073" , "?", "?" ],
[ "http://kiwisdr.smeter.net:8073" , "?", "?" ],
[ "http://kb0fxkiwisdr.hopto.org:8073" , "?", "?" ],
[ "http://95.155.200.107:8073" , "?", "?" ],
[ "http://funknetz.nrw:8074" , "?", "?" ],
[ "http://misdr.duckdns.org" , "?", "?" ],
[ "http://213.183.77.54:8073" , "?", "?" ],
[ "http://lodsdr.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://k9dxi.zapto.org:8073" , "?", "?" ],
[ "http://sigmasdr.ddns.net:8073" , "?", "?" ],
[ "http://82.74.101.138:8073" , "?", "?" ],
[ "http://logemann-joerg.de:8073" , "?", "?" ],
[ "http://kiwisdr01.buhler.nu:8073" , "?", "?" ],
[ "http://zr6aic.giga.co.za:8073" , "?", "?" ],
[ "http://haerkiwi.dyndns.org:8000" , "?", "?" ],
[ "http://119.47.17.5:8073" , "?", "?" ],
[ "http://kiwisdr.thulesius.se:8073" , "?", "?" ],
[ "http://kiwiSDR0.thulesius.se:8073" , "?", "?" ],
[ "http://scottgs.dynip.com:8073" , "?", "?" ],
[ "http://echofox.fr:8073" , "?", "?" ],
[ "http://nordheide.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://plonsk.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://ve4per.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://k9vdkiwi.hopto.org:8073" , "?", "?" ],
[ "http://sdr-amradioantennas.com:8076" , "?", "?" ],
[ "http://62.2.184.6:8073" , "?", "?" ],
[ "http://foschum.dyn.cc:8073" , "?", "?" ],
[ "http://kiwisdr.ddns.net:8073" , "?", "?" ],
[ "http://80.75.112.98:8075" , "?", "?" ],
[ "http://la9lt.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://kiwisdr.inf.dhbw-ravensburg.de:8073" , "?", "?" ],
[ "http://jp1odj.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://jp1odj-air.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://sdxlkiwi7.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://213.109.126.8:8074" , "?", "?" ],
[ "http://kiwisdr.prideradio.group:8073" , "?", "?" ],
[ "http://kiwisdr.prideradio.group:8074" , "?", "?" ],
[ "http://risxcgcs7tf4gwzi.myfritz.net:8075" , "?", "?" ],
[ "http://80.75.112.98:8074" , "?", "?" ],
[ "http://kiwisdr.ddns.net:8075" , "?", "?" ],
[ "http://n0emp.ddns.net:8073" , "?", "?" ],
[ "http://sk6ag1.ddns.net:8071" , "?", "?" ],
[ "http://sdr-badragaz.ddns.net:8073" , "?", "?" ],
[ "http://lu4eec.ddns.net:8073" , "?", "?" ],
[ "http://rhakiwi.ddns.net:8073" , "?", "?" ],
[ "http://kiwisdr-dm7rm.goip.de:8073" , "?", "?" ],
[ "http://109.147.122.197:8073" , "?", "?" ],
[ "http://83.128.85.68:8073" , "?", "?" ],
[ "http://kiwisdr.k1ra.us:8073" , "?", "?" ],
[ "http://dab956kiwi.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://bigsatnet.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://s57bit.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://sibamanna.duckdns.org:8073" , "?", "?" ],
[ "http://kiwisdr.ka9q.net:8073" , "?", "?" ],
[ "http://sdr.vebik.cz:8073" , "?", "?" ],
[ "http://tranp.sytes.net:8073" , "?", "?" ],
[ "http://59.129.216.68:8073" , "?", "?" ],
[ "http://109.109.112.170:8073" , "?", "?" ],
[ "http://ke6gg.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://216.196.177.66:8073" , "?", "?" ],
[ "http://areyouready.dyndns.org:8073" , "?", "?" ],
[ "http://kiwisdrvk1cm.ddns.net:8073" , "?", "?" ],
[ "http://oe3akb.ddns.net:8073" , "?", "?" ],
[ "http://g0ezy-kiwisdr2.ddns.net:8079" , "?", "?" ],
[ "http://kiwisdr.k3fef.com:8073" , "?", "?" ],
[ "http://g0ezy-kiwisdr.ddns.net:8073" , "?", "?" ],
[ "http://0kqvydic4s76vnto.myfritz.net:8073" , "?", "?" ],
[ "http://ne4dx.ddns.net:8073" , "?", "?" ],
[ "http://radiorovero.ddns.net:8073" , "?", "?" ],
[ "http://hnswerkstatt.dyndns.org:8073" , "?", "?" ],
[ "http://73.31.180.244:9000" , "?", "?" ],
[ "http://69.27.184.58:8076" , "?", "?" ],
[ "http://174.25.5.37:8073" , "?", "?" ],
[ "http://dl1dam.feste-ip.net:8185" , "?", "?" ],
[ "http://iz3eaw.ddns.net:8073" , "?", "?" ],
[ "http://meinsdr.ddns.net:8073" , "?", "?" ],
[ "http://chimay.homelinux.org:8073" , "?", "?" ],
[ "http://kt0tt.dynu.net:8073" , "?", "?" ],
[ "http://lowersaxonykiwi.ddns.me:8075" , "?", "?" ],
[ "http://69.27.184.58:8075" , "?", "?" ],
[ "http://jp7fso.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://vk2ggc.ddns.net:8073" , "?", "?" ],
[ "http://sdr-amradioantennas.com:8073" , "?", "?" ],
[ "http://kolsjon.mooo.com:8073" , "?", "?" ],
[ "http://82.70.254.222:8073" , "?", "?" ],
[ "http://178.174.166.174:8073" , "?", "?" ],
[ "http://kiwisdr.lollisoft.de:8073" , "?", "?" ],
[ "http://sergiocorda.synology.me:8074" , "?", "?" ],
[ "http://kiwisdrik4cie.ddns.net:8073" , "?", "?" ],
[ "http://kk6pr.ddns.net:8075" , "?", "?" ],
[ "http://w0air.ddns.net:8073" , "?", "?" ],
[ "http://mediaexplorer.ddns.net:8073" , "?", "?" ],
[ "http://risxcgcs7tf4gwzi.myfritz.net:8073" , "?", "?" ],
[ "http://wfohvupmh6h0ehye.myfritz.net:8073" , "?", "?" ],
[ "http://ca3pbr.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://ahorn.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://mbu.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://9k2ra-1.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://websdr.ham.ee:8073" , "?", "?" ],
[ "http://beefy.fun:8073" , "?", "?" ],
[ "http://kiwisdrshane77781.hopto.org:8073" , "?", "?" ],
[ "http://kiwisdrtrebor.ddns.net:8073" , "?", "?" ],
[ "http://kiwisdr.yensaw.net:8073" , "?", "?" ],
[ "http://dl1kgt.ham-radio-op.net:8073" , "?", "?" ],
[ "http://plonsk2.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://kiwi-sdr2-leiden.impactam.nl:8073" , "?", "?" ],
[ "http://du6_pe1nsq.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://www.kiwi-usasama-sdr.net:8073" , "?", "?" ],
[ "http://fgt.770net.de:8073" , "?", "?" ],
[ "http://hb9exc.iotvs.ch:8073" , "?", "?" ],
[ "http://z2abpyweepil7rhq.myfritz.net:8073" , "?", "?" ],
[ "http://db0ovl.projekt-pegasus.net:8073" , "?", "?" ],
[ "http://hb9cwk.internet-box.ch:8073" , "?", "?" ],
[ "http://kiwisdr.surriel.com" , "?", "?" ],
[ "http://kiwi-vecbebri.jveits.de:8073" , "?", "?" ],
[ "http://sigmasdr.ddns.net:8075" , "?", "?" ],
[ "http://sigmasdr.ddns.net:8074" , "?", "?" ],
[ "http://sigmasdr.ddns.net:8076" , "?", "?" ],
[ "http://kiwisdr.vk3tlw.net:8073" , "?", "?" ],
[ "http://w5pie.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://kiwisdr.tgcfabian.nl:8073" , "?", "?" ],
[ "http://sdr.tambov.gq:8901" , "?", "?" ],
[ "http://vk3cmz.ddns.net:8073" , "?", "?" ],
[ "http://213.109.126.8:8073" , "?", "?" ],
[ "http://kiwi8073.ddns.net:8073" , "?", "?" ],
[ "http://kiwisdrsk3jr2021.ddns.net:8073" , "?", "?" ],
[ "http://la6lukiwisdr.ddns.net:8073" , "?", "?" ],
[ "http://sdxlkiwi3.ddns.net:8073" , "?", "?" ],
[ "http://khv.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://shack.oe9.at:8073" , "?", "?" ],
[ "http://jq1zyv.ddns.net" , "?", "?" ],
[ "http://nsk.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://la3rk.dyndns.org:8073" , "?", "?" ],
[ "http://k1fb.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://67.170.2.228:8073" , "?", "?" ],
[ "http://hurricane.ddns.me:8073" , "?", "?" ],
[ "http://91.149.49.175:8073" , "?", "?" ],
[ "http://88.220.45.111:8073" , "?", "?" ],
[ "http://hasenberg.ddns.net:8073" , "?", "?" ],
[ "http://skhicks.ddns.net:8073" , "?", "?" ],
[ "http://kiwil.la2zoa.net:8073" , "?", "?" ],
[ "http://sdr.dyndns.org:8073" , "?", "?" ],
[ "http://kb1uif-kiwisdr.ddns.net:8073" , "?", "?" ],
[ "http://sjoukes.mine.nu:8073" , "?", "?" ],
[ "http://gibsons.dyndns.org:8073" , "?", "?" ],
[ "http://sdr-bayern.spdns.de:8073" , "?", "?" ],
[ "http://kiwisdr.sytes.net:8073" , "?", "?" ],
[ "http://westernmd.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://ha6smfkiwi.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://izh.swl.su:8073" , "?", "?" ],
[ "http://109.155.162.67:8073" , "?", "?" ],
[ "http://kiwisdr.oh6ai.fi:8073" , "?", "?" ],
[ "http://midorikiwi.hopto.org:8073" , "?", "?" ],
[ "http://n4ttn.ham-radio-op.net:8073" , "?", "?" ],
[ "http://kiwicam.sk3w.se:8073" , "?", "?" ],
[ "http://midtn.dynu.net:8073" , "?", "?" ],
[ "http://m14.fernschreibstelle.de:8073" , "?", "?" ],
[ "http://garths.zapto.org:8073" , "?", "?" ],
[ "http://ixworthsdr.hopto.org:8073" , "?", "?" ],
[ "http://ne499lr.proxy.kiwisdr.com:8073" , "?", "?" ],
[ "http://90.244.160.68:8073" , "?", "?" ],
[ "http://188.60.45.205:8074" , "?", "?" ],
[ "http://kiwisdr.duckdns.org:8073" , "?", "?" ],
[ "http://194.144.253.31" , "?", "?" ],
[ "http://sdr.ironstonerange.com:8073" , "?", "?" ],
[ "http://ve6hfd.ddns.net:8074" , "?", "?" ],
[ "http://oh6hps.ddns.net:8073" , "?", "?" ],
[ "http://somiakiwi.ddns.net:8073" , "?", "?" ],
[ "http://9z4rgsdr.ddns.net" , "?", "?" ],
[ "http://thomas0177.dnshome.de:8073" , "?", "?" ],
[ "http://w1nt.onthewifi.com:8073" , "?", "?" ],
[ "http://91.222.155.56:8073" , "?", "?" ],
[ "http://178.250.214.27:8073" , "?", "?" ],
[ "http://47.215.229.32:8072" , "?", "?" ],
[ "http://vk2pw.ddns.net:8073" , "?", "?" ],
[ "http://80.88.23.229:8073" , "?", "?" ],
[ "http://rio.f5.si:8073" , "?", "?" ],
[ "http://sbs1suisse.internet-box.ch:8074" , "?", "?" ],
[ "http://ab4kb.duckdns.org:8073" , "?", "?" ],
[ "http://jimlill.com:8073" , "?", "?" ],
[ "http://kiwi-iva.aprs.fi:8073" , "?", "?" ],
[ "http://hb9flq.ham-radio-op.net:8073" , "?", "?" ],
[ "http://www.l-enterprises.com:8073" , "?", "?" ],
[ "http://sergiocorda.synology.me:8073" , "?", "?" ],
[ "http://kiwisdr.criffield.net:8073" , "?", "?" ],
[ "http://server.ol7m.com:8073" , "?", "?" ],
[ "http://obereip.selfhost.de:8073" , "?", "?" ],
[ "http://92.236.180.238:8074" , "?", "?" ],
[ "http://OE9XBV.ddnss.org:8073" , "?", "?" ],
[ "http://kernow.hopto.org:8073" , "?", "?" ],
[ "http://94.214.27.243:8073" , "?", "?" ],
[ "http://sielsdr.ddns.net:8073" , "?", "?" ],
[ "http://witikiwi.ddns.net:8073" , "?", "?" ],
[ "http://taudel.ddns.net:8073" , "?", "?" ],
[ "http://gau.twrmon.net:8073" , "?", "?" ],
[ "http://ccu.twrmon.net:8083" , "?", "?" ],
[ "http://vk2fjmw.proxy.kiwisdr.com:8073" , "?", "?" ],
]
def get_number (s, Min, Max, err_msg):
try:
val = int(s)
except ValueError:
val = Min - 1
if num < Min or num > Max:
fatal (err_msg)
return num
def fatal (s):
print (s)
sys.exit (1)
def print2 (s1, s2, s1_color):
'''Print 2 strings:
's1' in 's1_colour' and
's2' in default colour.
Do not print a new-line.
'''
print ("%s%s%s%s" % (s1_color, s1, colour.RESET, s2), end="")
sys.stdout.flush()
def sig_handler (*args):
'''Our SIGINT / SIGTERM handler.
Simply sets a global 'quit' variable.
'''
global quit
quit = True
trace ("quit.\n",0)
################ SpyServer HELLO packet #############################
r'''
SPYSERVER_PROTOCOL_VERSION = (((2) << 24) | ((0) << 16) | (1558))
= ((0x02 << 24) | (0x00 << 16) | 0x0616)
Captured HELLO message from "windump port 5557" with "SDRSharp.exe" to sdr://airspy.com:5557
0000 00 00 00 00 37 00 00 00 38 06 00 02 53 44 52 23 ....7...8...SDR#
0010 20 76 31 2e 30 2e 30 2e 31 36 33 30 20 6f 6e 20 v1.0.0.1630 on
0020 4d 69 63 72 6f 73 6f 66 74 20 57 69 6e 64 6f 77 Microsoft Window
0030 73 20 4e 54 20 36 2e 32 2e 39 32 30 30 2e 30 s NT 6.2.9200.0
Data: 000000003700000038060002534452232076312e302e302e...
[Length: 63]
Command-header: Cmd: HELLO = 0, 4 bytes
CmdLength: 0x37, 4 bytes
Protocol-header: 8 bytes (ignore)
Command-data: 55 bytes
'''
_HEADER_LEN = 4
_PROTO_LEN = 4
_HELLO_CMD = 0
_HELLO_SOFTWARE = "SpyServerPoll"
_HELLO_LEN = _HEADER_LEN + _PROTO_LEN + len(_HELLO_SOFTWARE)
def send_hello (s):
packet = bytearray (_HELLO_LEN)
struct.pack_into ('>l', packet, 1, _HELLO_CMD)
if PY3:
pass
else:
packet[0] = struct.pack ('<b', _HELLO_CMD)
packet[4] = struct.pack ('<b', _HELLO_LEN - _HEADER_LEN)
packet[8] = 4
packet[12:] = _HELLO_SOFTWARE
hex_dump (packet)
s.send (packet)
return 1
def recv_hello (s):
try:
packet = s.recv (_HELLO_LEN)
if len(packet) > 0:
hex_dump (packet)
return 1
except:
return 2
def get_host_port (url):
host = url
if url.startswith("sdr://"):
host = url [6:]
elif url.startswith("http://"):
host = url [7:]
i = host.find (':')
if i == -1:
port = opt.dest_port
else:
port = int (host[i+1:])
host = host[:i]
return host, port
################ PyCurl class #######################################
class PycurlPoll:
def __init__ (self):
self.curl = None
self.socket = None
self.timeout = opt.timeout
self.debug_level = opt.debug_level
try:
os.environ['WSOCK_TRACE_LEVEL'] = '0'
import pycurl
self.curl = pycurl.Curl()
except:
fatal ("Failed to import PyCurl.")
#
# Called when the instance gets out of scope or
# a 'del x' is done on it.
#
def __del__ (self):
trace ("PycurlPoll.__del__.\n", 2)
if self.curl:
self.curl.close()
if self.socket:
self.socket.close()
def socket_open (self, purpose, curl_address):
family, socktype, protocol, address = curl_address
s = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt (socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
self.socket = s
return s
def poll (self, host):
if opt.kiwis:
url = "%s:%d" % (get_host_port(host))
else:
url = "telnet://%s:%d" % (get_host_port(host))
print (" %sTrying%s %-40s" % (colour.YELLOW, colour.RESET, url), end="")
sys.stdout.flush()
if opt.dry_run:
return 1
rc = 1
if 0 and self.debug_level > 0:
print ("")
self.curl.setopt (self.curl.URL, url)
self.curl.setopt (self.curl.MAXREDIRS, 0)
self.curl.setopt (self.curl.CONNECTTIMEOUT, self.timeout)
self.curl.setopt (self.curl.TIMEOUT, self.timeout)
self.curl.setopt (self.curl.VERBOSE, self.debug_level)
self.curl.setopt (self.curl.DEBUGFUNCTION, self.debug_func)
self.curl.setopt (self.curl.READFUNCTION, self.read)
self.curl.setopt (self.curl.WRITEFUNCTION, self.write)
if not opt.kiwis:
self.curl.setopt (self.curl.OPENSOCKETFUNCTION, self.socket_open)
self.curl.setopt (self.curl.CONNECT_ONLY, 1)
try:
self.curl.perform()
except:
rc = 0
sys.stdout.flush()
code = self.curl.getinfo (self.curl.RESPONSE_CODE)
ip = self.curl.getinfo (self.curl.PRIMARY_IP)
port = self.curl.getinfo (self.curl.PRIMARY_PORT)
trace ("code: %d, IP: %s, port: %d\n" % (code, ip, port))
return rc
def read():
return "\r"
def write (self, buf):
trace ("data: %s\n" % buf)
def debug_func (self, t, buf):
if t == 0 or t == 1:
trace ("dbg: t:%d, %s\n" % (t, buf))
################ socket module class ################################
class SocketPoll:
def __init__ (self):
self.timeout = opt.timeout
self.debug_level = opt.debug_level
self.socket = None
def __del__ (self):
trace ("SocketPoll.__del__.\n", 2)
if self.socket:
self.socket.close()
def poll (self, host):
host, port = get_host_port (host)
if 0:
i = host.find (':')
port = int (host[i+1:])
host = host[:i]
addr = "%s:%d" % (host, port)
print2 (" Trying ", "%-40s" % addr, colour.YELLOW)
if opt.dry_run:
return 1
self.socket = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
self.socket.setsockopt (socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
self.socket.settimeout (opt.timeout)
try:
self.socket.connect ((host, port))
return 1
except:
return 0
#####################################################################
def trace (s, level = 1, line = 0):
if opt.debug_level >= level:
if line == 0:
frame = sys._getframe (0)
line = frame.f_back.f_lineno
print ("%s(%d)%s: %s" % (colour.GREEN, line, colour.RESET, s), end="")
def hex_dump (buf):
if opt.debug_level >= 1:
hex_buf = ' '.join(format(x, '02X') for x in buf)
print ("")
frame = sys._getframe (0)
line = frame.f_back.f_lineno
trace ("pkt: %s\n" % hex_buf, opt.debug_level, line)
def list_servers():
if opt.kiwis:
print ("This list of servers is obtained from:")
print (" http://kiwisdr.com/public/")
servers = kiwi_servers
scheme = "http" # Always
else:
print ("This list of servers is obtained from:")
print (" https://airspy.com/directory/")
print (" http://onairv3.sdrspace.com/onair-v3.xml")
print (" http://moetronix.com/cgi-bin/getentries.py")
print ("and combined.")
servers = spy_servers
scheme = "sdr" # Always
print ("\n %s%-50s%-25s%s%22s" % (colour.YELLOW, "URL", "Location", "Radio", colour.RESET))
for i in range(len(servers)):
host, port = get_host_port (servers[i][_URL])
url = "%s://%s:%d" % (scheme, host, port)
print (" %-50s%-25s%-23s" % (url, servers[i][_LOCATION], servers[i][_RADIO]))
print ("\nBy default all servers are polled unless %s[server-spec]%s is specified.\n"
"E.g. \"%s sdr://k2z*\" will poll \"k2zn.ddns.net:5555\" only." % \
(colour.YELLOW, colour.RESET, this_dir))
return 0
def usage (e = None):
if e:
print (e)
else:
print (__doc__, end="")
print ("Usage: %s %s" % (this_prog, "[-dHnPh] [-p <port>] [-t <seconds>] [server-spec]"))
print2 (" -d: ", "sets debug level (-dd for level 2).\n", colour.YELLOW)
print2 (" -H: ", "send a HELLO packet.\n", colour.YELLOW)
print2 (" -i: ", "ignore cached information.\n", colour.YELLOW)
print2 (" -l: ", "list the servers supported.\n", colour.YELLOW)
print2 (" -n: ", "run in dry-run mode.\n", colour.YELLOW)
print2 (" -k: ", "poll for Kiwi servers instead\n", colour.YELLOW)
print2 (" -P: ", "use Pycurl (default is 'socket module').\n", colour.YELLOW)
print2 (" -p <port>: ", "the port for a 'sdr://' URL with no port (default %s)\n" % _DEF_PORT_SDR, colour.YELLOW)
print2 (" -p <port>: ", "the port for a 'http://' URL with no port (default %s)\n" % _DEF_PORT_HTTP, colour.YELLOW)
print2 (" -t <seconds>: ", "the connect-timeout for each attempt (default %s)\n" % _DEF_TIMEOUT, colour.YELLOW)
print2 (" -h: ", "this help.\n", colour.YELLOW)
def parse_cmd_line():
parser = argparse.ArgumentParser (add_help = False)
parser.add_argument ("-d", dest = "debug_level", action = "count", default = 0)
parser.add_argument ("-H", dest = "send_hello", action = "store_true")
parser.add_argument ("-i", dest = "no_cache", action = "store_true")
parser.add_argument ("-l", dest = "list_servers", action = "store_true")
parser.add_argument ("-n", dest = "dry_run", action = "store_true")
parser.add_argument ("-k", dest = "kiwis", action = "store_true")
parser.add_argument ("-P", dest = "use_pycurl", action = "store_true")
parser.add_argument ("-p", dest = "dest_port", type = int, default = _DEF_PORT_SDR)
parser.add_argument ("-t", dest = "timeout", type = int, default = _DEF_TIMEOUT)
parser.add_argument ("-h", dest = "show_help", action = "store_true")
parser.add_argument ("server_spec", nargs = argparse.REMAINDER)
opt = parser.parse_args()
if opt.server_spec:
opt.server_spec = opt.server_spec[0]
elif opt.kiwis:
opt.server_spec = 'http://*'
else:
opt.server_spec = 'sdr://*'
if opt.dry_run:
opt.send_hello = False
if opt.dest_port != _DEF_PORT_SDR:
opt.dest_port = get_number (opt.dest_port, 1, 64*1024, "port must be in range %d-%d." % (1, 64*1024))
if opt.timeout != _DEF_TIMEOUT:
opt.timeout = get_number (opt.timeout, 1, 60*60, "timeout must be >= 1 sec.")
return opt
def poll_loop():
return num, quit
############################################################################################
#
# Interface for IP2Location
#
def ip2loc_get_datadir():
try:
return os.environ['IP2LOC_ROOT'] + "/data/"
except KeyError:
return None
def ip2loc_init():
dir = ip2loc_get_datadir()
if not dir:
print2 ("No ~2$IP2LOC_ROOT~0 is defined.", "", colour.RED)
return False
file = dir + ip2loc_file
if not os.path.exists(file):
print2 ("Failed to find %s." % file, "", colour.RED)
return False
try:
import IP2Location
global geo
geo = IP2Location.IP2Location (file)
if not geo:
print2 ("Failed to initialise IP2Location.", "", colour.RED)
return False
except:
print2 ("Failed to import IP2Location.", "", colour.RED)
return False
global have_ip2loc
have_ip2loc = True
return True
def get_country (geo, ip):
if not geo:
color_print.trace ("geo == None")
return ''
if have_ip2loc:
global ip2loc
ip2loc = geo.get_all(ip)
if PY3:
ip2loc.city = ip2loc.city.decode("utf-8")
ip2loc.region = ip2loc.region.decode("utf-8")
country = ip2loc.country_long or ip2loc.country_short
if PY3 and country:
country = country.decode("utf-8")
else:
color_print.trace ("Using Geoip")
country = geo.country_code_by_addr (ip)
if not country or country == "-":
return ''
# Strip off at commas and hypens.
# E.g. "Korea, Republic of" -> "Korea"
# "Lao People's Democratic Republic" -> "Lao People"
#
c = country.find (",")
if c > 1:
return country[:c]
c = country.find ("'")
if c > 1:
return country[:c]
return country
############################################################################################
class PollCache:
def __init__(self, filename):
self.filename = filename
self.file = None
self.items = dict()
try:
f = open (self.filename, "r")
for c in csv.reader (f.readlines()):
if c[0].startswith("sdr://") or c[0].startswith("http://"):
self.items [c[0]] = { "Timestamp" : c[1],
"Status" : c[2]
}
f.close()
except FileNotFoundError:
pass
def close (self):
if self.file:
self.file.close()
self.file = None
def write_status (self, status):
if opt.dry_run:
return
if not self.file:
self.file = open (self.filename, "a+")
self.file.write ("# URL,timestamp,status # Started: %s (%d)\n" % (time.ctime(), time.time()))
self.file.write ("%s\n" % status)
def items (self):
return self.items # sorted (ret, key=lambda x: x[0])
# return self.items # sorted (ret, key=lambda x: x[0])
def server (self, server):
if opt.no_cache:
return []
try:
return self.items[server]
except KeyError:
return []
############################################################################################
def main():
global opt
opt = parse_cmd_line()
cache = PollCache (this_dir + "/SpyServer-cache.csv")
if opt.show_help:
sys.exit (usage())
if opt.list_servers:
sys.exit (list_servers())
if 0:
for c in cache.items:
print ("url: %-20s, TS: %d, status: %s" % (c, int(cache.items[c]["Timestamp"]), cache.items[c]["Status"]))
if 1:
s = cache.server("sdr://k2zn.ddns.net:5555")
print (s[:])
s = cache.server("http://kiwisdr2.hoka.co.uk:8073")
if s: print (s[:])
return 0
signal.signal (signal.SIGINT, sig_handler)
signal.signal (signal.SIGTERM, sig_handler)
if 0:
f = open (this_dir + "/SpyServer-cache.csv", "a+")
f.write ("# URL,timestamp,status # Started: %s (%d)\n" % (time.ctime(), time.time()))
if opt.use_pycurl:
poller = PycurlPoll()
print ("Polling using 'Pycurl extension':")
else:
poller = SocketPoll()
print ("Polling using 'socket module':")
if opt.kiwis:
servers = kiwi_servers
else:
servers = spy_servers
num_polled = num_cache_skiped = mis_matches = 0
for i in range (len(servers)):
now = time.time()
server = servers [i][_URL]
if not opt.no_cache:
try:
if cache.items [server]:
poll_ts = int (cache.items[server]["Timestamp"])
if now - poll_ts < 1000:
print ("Server %s already polled %d minutes ago." % (server, (now - poll_ts) / 60))
num_cache_skiped += 1
continue
except KeyError:
pass
ofs = 0
if server.startswith("sdr://"):
ofs = 6
if server.startswith("http://"):
ofs = 7
if ofs == 0:
fatal ("URL must start with 'sdr://' or 'http://'")
if not fnmatch.fnmatch (server, opt.server_spec):
trace ("%s does not match opt.server_spec: '%s'\n" % (server, opt.server_spec), 2)
mis_matches += 1
continue
rc = poller.poll (server[ofs:])
global quit
if quit:
break
num_polled += 1
if rc and opt.send_hello:
send_hello (poller.socket)
time.sleep (0.5)
rc = recv_hello (poller.socket)
now = time.time()
cache_status = "%s,%d" % (server, now)
if rc == 1:
print2 ("OK", "\n", colour.GREEN)
cache.write_status ("%s,OK" % cache_status)
elif rc == 2:
print2 ("Connection broken", "\n", colour.RED)
cache.write_status ("%s,Connection broken" % cache_status)
else:
# if not poller.ping (s[ofs:]):
print2 ("Timeout", "\n", colour.RED)
cache.write_status ("%s,Timeout" % cache_status)
if 0:
num_polled, quit = poll_loop()
if num_polled == 0:
print2 ("No servers matched %s!?" % opt.server_spec, "\n", colour.RED)
print ("mis_matches: %d, num_cache_skiped: %d" % (mis_matches, num_cache_skiped))
if num_polled == 0 and mis_matches > num_cache_skiped:
print2 ("No servers matched %s. Try specifying a port like 'http://*.myfritz.net:8073'" % opt.server_spec, "\n", colour.RED)
cache.close()
# del poller
if __name__ == '__main__':
main()
sys.exit (0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment