1

I just ran into a serious networking Problem. I am in the process to setup a Virtual Radar Server with at least one RasPi as ADS-B receiver. Just to explain what this is all about: Airplanes transmit location data on a public frequency (1080MHz) and I want to display that. It's kind like Flightradar24.

On my Pi I run dump1090 from Malcolm Robb which intercepts these transmitions via an SDR device (DVB-T stick) and provides a network stream with the decoded data. You can watch this stream if you just telnet on port 30003 of the Pi. So far, so good.

On a second machine Virtual Radar Server (short VRS) is running. It is mostly a webserver which displays the data received on the described port of the PI. In my local LAN this works as well.

But know comes the tricky part. The Pi is normally situated behind a router/firewall with no port forwarding so VRS can't hook up on that TCP stream. I already managed to establish a reverse SSH connection to open up that stream in telnet again but since this is a telnet session running on the Pi and just remote controlled VRS can't us it.

Now my idea was to intercept the data from the reverse SSH on the VRS machine and use a Python script to read it and provide a fresh local TCP stream of it. So in theorie VRS could read it.

My first problem is how to intercept the connection. I found two ways to do it in Python. Which one would you prefer or do you even have a better idea?

Method 1

import os
os.system("ssh pi@localhost -p 13889 telnet localhost 30003

Method 2

import subprocess
subprocess.call("ssh pi@localhost -p 13889 telnet localhost 30003")

But how do I get the stout to further wor with?

The next problem is about setting up the TCP stream. Dump1090 seems to send the data all time but so far i could not figure out how to set this up in Python. so far I only got a client-server-combo where the receiving server needs to be started first. Other wise the client will throw an exeption that the listening port is not open. Is there any way to resolve this problem?

Maybe I am thinking ways to copmplicated. So i someone has an easier idea, post it!

Florian

flightradar24.com github.com/MalcolmRobb/dump1090 virtualradarserver.co.uk/

FlorianM
  • 33
  • 4
  • If you already have a SSH session then why don't you simply use the [port forwarding built into SSH](http://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html)? – Steffen Ullrich Dec 12 '16 at 14:19
  • 1
    @SteffenUllrich He is already using it. My question to Florian would rather be "Why don't you directly ssh-forward to port 30003?" I mean, on your Pi, instead of `ssh user@vrs -R 13889:localhost:22`, why don't you just do `ssh user@vrs -R 30003:localhost:30003`. This way, you have just to open port 30003 on the vrs to get the stream from the Pi. – xhienne Dec 12 '16 at 14:27

1 Answers1

0

While I am not a master in ssh and tunelling I will answer only for the second part: use Try/Except with some delay to establish a connection.

Example

import time

connected = False
while not connected:
    try:
        # connect whatever you like
        connected = True
    except IOError: # or any other exception you get from connecting
        time.sleep(5) # or any other value
        print('Could not connect, retrying...')
Pax0r
  • 2,324
  • 2
  • 31
  • 49