From 6b111854461bad407ef8ce82da405a39bb21676d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dudek?= Date: Thu, 9 Mar 2023 23:53:13 +0100 Subject: [PATCH 01/11] Adding Osmosdr devices support --- ...ission.py => preamble_emission_limesdr.py} | 0 code/scripts/preamble_emission_osmosdr.py | 158 ++++++++++++++++++ 2 files changed, 158 insertions(+) rename code/scripts/{preamble_emission.py => preamble_emission_limesdr.py} (100%) create mode 100755 code/scripts/preamble_emission_osmosdr.py diff --git a/code/scripts/preamble_emission.py b/code/scripts/preamble_emission_limesdr.py similarity index 100% rename from code/scripts/preamble_emission.py rename to code/scripts/preamble_emission_limesdr.py diff --git a/code/scripts/preamble_emission_osmosdr.py b/code/scripts/preamble_emission_osmosdr.py new file mode 100755 index 0000000..07b88fb --- /dev/null +++ b/code/scripts/preamble_emission_osmosdr.py @@ -0,0 +1,158 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# +# SPDX-License-Identifier: GPL-3.0 +# +# GNU Radio Python Flow Graph +# Title: Brokenwire Osmocom +# Author: FlUxIuS (Penthertz) +# GNU Radio version: 3.10.5.1 + +from gnuradio import blocks +import pmt +from gnuradio import gr +from gnuradio.filter import firdes +from gnuradio.fft import window +import sys +import signal +from argparse import ArgumentParser +from gnuradio.eng_arg import eng_float, intx +from gnuradio import eng_notation +import osmosdr +import time + + + + +class brokenwireosmo(gr.top_block): + + def __init__(self, devicestring="", inputfile='captured_preamble.dat', txgain=10, var_freq=int(17e6)): + gr.top_block.__init__(self, "Brokenwire Osmocom", catch_exceptions=True) + + ################################################## + # Parameters + ################################################## + self.devicestring = devicestring + self.inputfile = inputfile + self.txgain = txgain + self.var_freq = var_freq + + ################################################## + # Variables + ################################################## + self.samp_rate = samp_rate = 25e6 + self.freq = freq = var_freq + + ################################################## + # Blocks + ################################################## + + self.osmosdr_sink_0 = osmosdr.sink( + args="numchan=" + str(1) + " " + devicestring + ) + self.osmosdr_sink_0.set_time_unknown_pps(osmosdr.time_spec_t()) + self.osmosdr_sink_0.set_sample_rate(samp_rate) + self.osmosdr_sink_0.set_center_freq(freq, 0) + self.osmosdr_sink_0.set_freq_corr(0, 0) + self.osmosdr_sink_0.set_gain(txgain, 0) + self.osmosdr_sink_0.set_if_gain(20, 0) + self.osmosdr_sink_0.set_bb_gain(20, 0) + self.osmosdr_sink_0.set_antenna('', 0) + self.osmosdr_sink_0.set_bandwidth(0, 0) + self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, inputfile, True, 0, 0) + self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) + + + ################################################## + # Connections + ################################################## + self.connect((self.blocks_file_source_0, 0), (self.osmosdr_sink_0, 0)) + + + def get_devicestring(self): + return self.devicestring + + def set_devicestring(self, devicestring): + self.devicestring = devicestring + + def get_inputfile(self): + return self.inputfile + + def set_inputfile(self, inputfile): + self.inputfile = inputfile + self.blocks_file_source_0.open(self.inputfile, True) + + def get_txgain(self): + return self.txgain + + def set_txgain(self, txgain): + self.txgain = txgain + self.osmosdr_sink_0.set_gain(self.txgain, 0) + + def get_var_freq(self): + return self.var_freq + + def set_var_freq(self, var_freq): + self.var_freq = var_freq + self.set_freq(self.var_freq) + + def get_samp_rate(self): + return self.samp_rate + + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + self.osmosdr_sink_0.set_sample_rate(self.samp_rate) + + def get_freq(self): + return self.freq + + def set_freq(self, freq): + self.freq = freq + self.osmosdr_sink_0.set_center_freq(self.freq, 0) + + + +def argument_parser(): + parser = ArgumentParser() + parser.add_argument( + "--devicestring", dest="devicestring", type=str, default="", + help="Set deviceargs [default=%(default)r]") + parser.add_argument( + "--inputfile", dest="inputfile", type=str, default='captured_preamble.dat', + help="Set preamblefile [default=%(default)r]") + parser.add_argument( + "--txgain", dest="txgain", type=intx, default=10, + help="Set txgain [default=%(default)r]") + parser.add_argument( + "--var-freq", dest="var_freq", type=intx, default=int(17e6), + help="Set frequency [default=%(default)r]") + return parser + + +def main(top_block_cls=brokenwireosmo, options=None): + if options is None: + options = argument_parser().parse_args() + tb = top_block_cls(devicestring=options.devicestring, inputfile=options.inputfile, txgain=options.txgain, var_freq=options.var_freq) + + def sig_handler(sig=None, frame=None): + tb.stop() + tb.wait() + + sys.exit(0) + + signal.signal(signal.SIGINT, sig_handler) + signal.signal(signal.SIGTERM, sig_handler) + + tb.start() + + try: + input('Press Enter to quit: ') + except EOFError: + pass + tb.stop() + tb.wait() + + +if __name__ == '__main__': + main() From 1910876a3f33526045667594b19a6f7c19f5399d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dudek?= Date: Thu, 9 Mar 2023 23:57:25 +0100 Subject: [PATCH 02/11] Update README.md --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 8265654..fff4a15 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ This repository is organized as follows: │ ├── req # text file that contains all the Python requirements │ └── scripts # directory that contains additional evaluation scripts │ └── preamble_emission.py # Python script that emits the preamble with a LimeSDR +│ └── preamble_emission.py # Python script that emits the preamble with a OsmoSDR devices such as (USRP, BladeRF, AntSDR E200 with UHD, etc.) ├── data # directory that contains required files │ └── preambles # directory that contains the preamble │ └── captured_preamble.dat # captured preamble used for the attack @@ -62,6 +63,22 @@ and run the following command to start the attack: where LIMESDR_GAIN is a value between -12 and 64. +Initially the source included the LimeSDR, but an alternative using OsmoSDR block can also be used: + +``` +python3 preamble_emission_osmosdr.py --help +usage: preamble_emission_osmosdr.py [-h] [--devicestring DEVICESTRING] [--inputfile INPUTFILE] [--txgain TXGAIN] [--var-freq VAR_FREQ] + +optional arguments: + -h, --help show this help message and exit + --devicestring DEVICESTRING + Set deviceargs [default=''] + --inputfile INPUTFILE + Set preamblefile [default='captured_preamble.dat'] + --txgain TXGAIN Set txgain [default=10] + --var-freq VAR_FREQ Set frequency [default=17000000] +``` + ## Recommended Equipment To run the Brokenwire attack, a software-defined radio that can transmit at a center frequency of 17 MHz with a sample rate >= 25MSPS is required. From 6f7f82a86092c02804cec7f12fd616227bc039fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dudek?= Date: Thu, 9 Mar 2023 23:58:32 +0100 Subject: [PATCH 03/11] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index fff4a15..bda7b01 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,9 @@ and run the following command to start the attack: where LIMESDR_GAIN is a value between -12 and 64. + +## Using other SDR devices + Initially the source included the LimeSDR, but an alternative using OsmoSDR block can also be used: ``` @@ -79,6 +82,7 @@ optional arguments: --var-freq VAR_FREQ Set frequency [default=17000000] ``` + ## Recommended Equipment To run the Brokenwire attack, a software-defined radio that can transmit at a center frequency of 17 MHz with a sample rate >= 25MSPS is required. From ca12c97e8293fe70c6618d7cf34964fa79026c3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dudek?= Date: Fri, 10 Mar 2023 00:18:21 +0100 Subject: [PATCH 04/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bda7b01..3236126 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ This repository is organized as follows: │ ├── req # text file that contains all the Python requirements │ └── scripts # directory that contains additional evaluation scripts │ └── preamble_emission.py # Python script that emits the preamble with a LimeSDR -│ └── preamble_emission.py # Python script that emits the preamble with a OsmoSDR devices such as (USRP, BladeRF, AntSDR E200 with UHD, etc.) +│ └── preamble_emission.py # Python script that emits the preamble with a OsmoSDR devices such as (USRP, BladeRF, AntSDR E200 with UHD, etc.). USRP X or N versions with a DC-30 MHz daughter board would fit well, others will need a downconverter ├── data # directory that contains required files │ └── preambles # directory that contains the preamble │ └── captured_preamble.dat # captured preamble used for the attack From ffdb707b43f001cc161c6adfb1f4f23e4eda7b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dudek?= Date: Fri, 10 Mar 2023 00:19:58 +0100 Subject: [PATCH 05/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3236126..0abf1fb 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ where LIMESDR_GAIN is a value between -12 and 64. ## Using other SDR devices -Initially the source included the LimeSDR, but an alternative using OsmoSDR block can also be used: +Initially the source was made for the LimeSDR, but an alternative using OsmoSDR block can also be used for USRP X/N version with a DC-30 MHz daughter, or a downconverter for other devices that wouldn't tune to 17 MHz frequencies: ``` python3 preamble_emission_osmosdr.py --help From f82239c415e1f87cd75e65cbef85657fa32dd6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dudek?= Date: Fri, 10 Mar 2023 00:21:28 +0100 Subject: [PATCH 06/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0abf1fb..3052949 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ where LIMESDR_GAIN is a value between -12 and 64. ## Using other SDR devices -Initially the source was made for the LimeSDR, but an alternative using OsmoSDR block can also be used for USRP X/N version with a DC-30 MHz daughter, or a downconverter for other devices that wouldn't tune to 17 MHz frequencies: +Initially the source was made for the LimeSDR mini*, but an alternative using OsmoSDR block can also be used for USRP X/N version with a DC-30 MHz daughter, or a downconverter for other devices that wouldn't tune to 17 MHz frequencies: ``` python3 preamble_emission_osmosdr.py --help From 4d5d3ef3dca144fe91fdaa5d7318ce061d062f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dudek?= Date: Fri, 10 Mar 2023 00:28:55 +0100 Subject: [PATCH 07/11] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3052949..8c38b04 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ This repository is organized as follows: │ ├── req # text file that contains all the Python requirements │ └── scripts # directory that contains additional evaluation scripts │ └── preamble_emission.py # Python script that emits the preamble with a LimeSDR -│ └── preamble_emission.py # Python script that emits the preamble with a OsmoSDR devices such as (USRP, BladeRF, AntSDR E200 with UHD, etc.). USRP X or N versions with a DC-30 MHz daughter board would fit well, others will need a downconverter +│ └── preamble_emission.py # Python script that emits the preamble with a OsmoSDR devices such as (USRP, BladeRF, AntSDR E200 with UHD, etc.). USRP X or N versions with a DC-30 MHz daughter board would fit well, maybe Red Pitaya SDRlab 122-16? Others will need a downconverter ├── data # directory that contains required files │ └── preambles # directory that contains the preamble │ └── captured_preamble.dat # captured preamble used for the attack @@ -66,7 +66,7 @@ where LIMESDR_GAIN is a value between -12 and 64. ## Using other SDR devices -Initially the source was made for the LimeSDR mini*, but an alternative using OsmoSDR block can also be used for USRP X/N version with a DC-30 MHz daughter, or a downconverter for other devices that wouldn't tune to 17 MHz frequencies: +Initially the source was made for the LimeSDR mini*, but an alternative using OsmoSDR block can also be used for USRP X/N version with a DC-30 MHz daughter, Red Pitaya SDRlab 122-16? , or a downconverter for other devices that wouldn't tune to 17 MHz frequencies: ``` python3 preamble_emission_osmosdr.py --help From 9e73e66e95c35f71b30cd7f264e01c9cca7db19f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dudek?= Date: Fri, 10 Mar 2023 00:36:28 +0100 Subject: [PATCH 08/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c38b04..83859dd 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ where LIMESDR_GAIN is a value between -12 and 64. ## Using other SDR devices -Initially the source was made for the LimeSDR mini*, but an alternative using OsmoSDR block can also be used for USRP X/N version with a DC-30 MHz daughter, Red Pitaya SDRlab 122-16? , or a downconverter for other devices that wouldn't tune to 17 MHz frequencies: +Initially the source was made for the LimeSDR mini*, but an alternative using OsmoSDR block can also be used for USRP X/N version with a DC-30 MHz daughter, Red Pitaya SDRlab 122-16? , or a downconverter for other devices that wouldn't tune to 17 MHz frequency: ``` python3 preamble_emission_osmosdr.py --help From 9b2a4e9a1940c93e31268c1652e460e9f7c86318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dudek?= Date: Fri, 10 Mar 2023 00:37:33 +0100 Subject: [PATCH 09/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83859dd..3987f68 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ This repository is organized as follows: │ ├── req # text file that contains all the Python requirements │ └── scripts # directory that contains additional evaluation scripts │ └── preamble_emission.py # Python script that emits the preamble with a LimeSDR -│ └── preamble_emission.py # Python script that emits the preamble with a OsmoSDR devices such as (USRP, BladeRF, AntSDR E200 with UHD, etc.). USRP X or N versions with a DC-30 MHz daughter board would fit well, maybe Red Pitaya SDRlab 122-16? Others will need a downconverter +│ └── preamble_emission_osmosdr.py # Python script that emits the preamble with a OsmoSDR devices such as (USRP, BladeRF, AntSDR E200 with UHD, etc.). USRP X or N versions with a DC-30 MHz daughter board would fit well, maybe Red Pitaya SDRlab 122-16? Others will need a downconverter ├── data # directory that contains required files │ └── preambles # directory that contains the preamble │ └── captured_preamble.dat # captured preamble used for the attack From 92ce8c1ef9ec93bdb854f481587eed95a9cde928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dudek?= Date: Fri, 10 Mar 2023 00:38:26 +0100 Subject: [PATCH 10/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3987f68..09d455b 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ where LIMESDR_GAIN is a value between -12 and 64. ## Using other SDR devices -Initially the source was made for the LimeSDR mini*, but an alternative using OsmoSDR block can also be used for USRP X/N version with a DC-30 MHz daughter, Red Pitaya SDRlab 122-16? , or a downconverter for other devices that wouldn't tune to 17 MHz frequency: +Initially the source was made for the LimeSDR mini*, but an alternative using OsmoSDR block can also be used for USRP X/N version with a DC-30 MHz daughter, Red Pitaya SDRlab 122-16? Or a downconverter for other devices that wouldn't tune to 17 MHz frequency: ``` python3 preamble_emission_osmosdr.py --help From 67f29768086925a0681740ac4611f537bee56cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dudek?= Date: Fri, 10 Mar 2023 00:43:55 +0100 Subject: [PATCH 11/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 09d455b..7b31355 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ where LIMESDR_GAIN is a value between -12 and 64. ## Using other SDR devices -Initially the source was made for the LimeSDR mini*, but an alternative using OsmoSDR block can also be used for USRP X/N version with a DC-30 MHz daughter, Red Pitaya SDRlab 122-16? Or a downconverter for other devices that wouldn't tune to 17 MHz frequency: +Initially the source was made for the LimeSDR mini*, but an alternative using OsmoSDR block can also be used for USRP X/N version (or v1) with a DC-30 MHz daughter, Red Pitaya SDRlab 122-16? Or a downconverter for other devices that wouldn't tune to 17 MHz frequency: ``` python3 preamble_emission_osmosdr.py --help