Fixing issues merging @h0rac pull request - things specific to bladeRF
This commit is contained in:
parent
335c2bd5e4
commit
8c44b926f7
|
@ -1,6 +1,7 @@
|
|||
options:
|
||||
parameters:
|
||||
author: ''
|
||||
catch_exceptions: 'True'
|
||||
category: Custom
|
||||
cmake_opt: ''
|
||||
comment: ''
|
||||
|
@ -39,18 +40,18 @@ blocks:
|
|||
gui_hint: ''
|
||||
label: Bandwidth
|
||||
min_len: '200'
|
||||
orient: Qt.Horizontal
|
||||
orient: QtCore.Qt.Horizontal
|
||||
rangeType: float
|
||||
start: 2e6
|
||||
step: '10'
|
||||
stop: 50e6
|
||||
value: var_bandwidth
|
||||
widget: slider
|
||||
widget: counter_slider
|
||||
states:
|
||||
bus_sink: false
|
||||
bus_source: false
|
||||
bus_structure: null
|
||||
coordinate: [882, 19]
|
||||
coordinate: [736, 20.0]
|
||||
rotation: 0
|
||||
state: true
|
||||
- name: bb_gain
|
||||
|
@ -60,13 +61,13 @@ blocks:
|
|||
gui_hint: ''
|
||||
label: BB gain
|
||||
min_len: '200'
|
||||
orient: Qt.Horizontal
|
||||
orient: QtCore.Qt.Horizontal
|
||||
rangeType: float
|
||||
start: '10'
|
||||
step: '10'
|
||||
stop: '60'
|
||||
value: var_bb_gain
|
||||
widget: slider
|
||||
widget: counter_slider
|
||||
states:
|
||||
bus_sink: false
|
||||
bus_source: false
|
||||
|
@ -81,13 +82,13 @@ blocks:
|
|||
gui_hint: ''
|
||||
label: Freq
|
||||
min_len: '200'
|
||||
orient: Qt.Horizontal
|
||||
orient: QtCore.Qt.Horizontal
|
||||
rangeType: float
|
||||
start: 900e6
|
||||
step: '500'
|
||||
stop: 2200e6
|
||||
value: var_cent_freq
|
||||
widget: slider
|
||||
widget: counter_slider
|
||||
states:
|
||||
bus_sink: false
|
||||
bus_source: false
|
||||
|
@ -102,13 +103,13 @@ blocks:
|
|||
gui_hint: ''
|
||||
label: IF gain
|
||||
min_len: '200'
|
||||
orient: Qt.Horizontal
|
||||
orient: QtCore.Qt.Horizontal
|
||||
rangeType: float
|
||||
start: '10'
|
||||
step: '10'
|
||||
stop: '60'
|
||||
value: var_if_gain
|
||||
widget: slider
|
||||
widget: counter_slider
|
||||
states:
|
||||
bus_sink: false
|
||||
bus_source: false
|
||||
|
@ -123,13 +124,13 @@ blocks:
|
|||
gui_hint: ''
|
||||
label: RF gain
|
||||
min_len: '200'
|
||||
orient: Qt.Horizontal
|
||||
orient: QtCore.Qt.Horizontal
|
||||
rangeType: float
|
||||
start: '10'
|
||||
step: '10'
|
||||
stop: '60'
|
||||
value: var_rf_gain
|
||||
widget: slider
|
||||
widget: counter_slider
|
||||
states:
|
||||
bus_sink: false
|
||||
bus_source: false
|
||||
|
@ -149,27 +150,6 @@ blocks:
|
|||
coordinate: [8, 68]
|
||||
rotation: 0
|
||||
state: enabled
|
||||
- name: sample_rate
|
||||
id: variable_qtgui_range
|
||||
parameters:
|
||||
comment: ''
|
||||
gui_hint: ''
|
||||
label: Sample rate
|
||||
min_len: '200'
|
||||
orient: Qt.Horizontal
|
||||
rangeType: float
|
||||
start: 2e6
|
||||
step: '10'
|
||||
stop: 20e6
|
||||
value: samp_rate
|
||||
widget: slider
|
||||
states:
|
||||
bus_sink: false
|
||||
bus_source: false
|
||||
bus_structure: null
|
||||
coordinate: [743, 17]
|
||||
rotation: 0
|
||||
state: true
|
||||
- name: var_bandwidth
|
||||
id: variable
|
||||
parameters:
|
||||
|
@ -254,7 +234,7 @@ blocks:
|
|||
parameters:
|
||||
affinity: ''
|
||||
alias: ''
|
||||
ant0: '1'
|
||||
ant0: ''
|
||||
ant1: ''
|
||||
ant10: ''
|
||||
ant11: ''
|
||||
|
@ -286,7 +266,7 @@ blocks:
|
|||
ant7: ''
|
||||
ant8: ''
|
||||
ant9: ''
|
||||
args: ''
|
||||
args: bladerf=0
|
||||
bb_gain0: bb_gain
|
||||
bb_gain1: '20'
|
||||
bb_gain10: '20'
|
||||
|
@ -492,7 +472,7 @@ blocks:
|
|||
minoutbuf: '0'
|
||||
nchan: '1'
|
||||
num_mboards: '1'
|
||||
sample_rate: sample_rate
|
||||
sample_rate: bandwidth+bandwidth/80
|
||||
sync: sync
|
||||
time_source0: ''
|
||||
time_source1: ''
|
||||
|
@ -521,7 +501,7 @@ blocks:
|
|||
bus_sink: false
|
||||
bus_source: false
|
||||
bus_structure: null
|
||||
coordinate: [331, 416]
|
||||
coordinate: [304, 420.0]
|
||||
rotation: 0
|
||||
state: enabled
|
||||
|
||||
|
@ -530,3 +510,4 @@ connections:
|
|||
|
||||
metadata:
|
||||
file_format: 1
|
||||
grc_version: 3.10.5.1
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
#
|
||||
# GNU Radio Python Flow Graph
|
||||
# Title: Jammer Gen
|
||||
# GNU Radio version: 3.8.2.0
|
||||
# GNU Radio version: 3.10.5.1
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from packaging.version import Version as StrictVersion
|
||||
|
||||
if __name__ == '__main__':
|
||||
import ctypes
|
||||
|
@ -23,6 +23,7 @@ if __name__ == '__main__':
|
|||
from gnuradio import analog
|
||||
from gnuradio import gr
|
||||
from gnuradio.filter import firdes
|
||||
from gnuradio.fft import window
|
||||
import sys
|
||||
import signal
|
||||
from PyQt5 import Qt
|
||||
|
@ -30,20 +31,20 @@ from argparse import ArgumentParser
|
|||
from gnuradio.eng_arg import eng_float, intx
|
||||
from gnuradio import eng_notation
|
||||
from gnuradio.qtgui import Range, RangeWidget
|
||||
from PyQt5 import QtCore
|
||||
from xmlrpc.server import SimpleXMLRPCServer
|
||||
import threading
|
||||
import osmosdr
|
||||
import time
|
||||
try:
|
||||
from xmlrpc.server import SimpleXMLRPCServer
|
||||
except ImportError:
|
||||
from SimpleXMLRPCServer import SimpleXMLRPCServer
|
||||
import threading
|
||||
|
||||
|
||||
|
||||
from gnuradio import qtgui
|
||||
|
||||
class jammer_gen(gr.top_block, Qt.QWidget):
|
||||
|
||||
def __init__(self):
|
||||
gr.top_block.__init__(self, "Jammer Gen")
|
||||
gr.top_block.__init__(self, "Jammer Gen", catch_exceptions=True)
|
||||
Qt.QWidget.__init__(self)
|
||||
self.setWindowTitle("Jammer Gen")
|
||||
qtgui.util.check_set_qss()
|
||||
|
@ -82,7 +83,6 @@ class jammer_gen(gr.top_block, Qt.QWidget):
|
|||
self.var_bb_gain = var_bb_gain = 10
|
||||
self.var_bandwidth = var_bandwidth = 10e6
|
||||
self.samp_rate = samp_rate = 5e6
|
||||
self.sample_rate = sample_rate = samp_rate
|
||||
self.rf_gain = rf_gain = var_rf_gain
|
||||
self.if_gain = if_gain = var_if_gain
|
||||
self.cent_freq = cent_freq = var_cent_freq
|
||||
|
@ -92,45 +92,42 @@ class jammer_gen(gr.top_block, Qt.QWidget):
|
|||
##################################################
|
||||
# Blocks
|
||||
##################################################
|
||||
self._sample_rate_range = Range(2e6, 20e6, 10, samp_rate, 200)
|
||||
self._sample_rate_win = RangeWidget(self._sample_rate_range, self.set_sample_rate, 'Sample rate', "slider", float)
|
||||
self.top_grid_layout.addWidget(self._sample_rate_win)
|
||||
|
||||
self._rf_gain_range = Range(10, 60, 10, var_rf_gain, 200)
|
||||
self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, 'RF gain', "slider", float)
|
||||
self.top_grid_layout.addWidget(self._rf_gain_win)
|
||||
self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF gain", "counter_slider", float, QtCore.Qt.Horizontal)
|
||||
self.top_layout.addWidget(self._rf_gain_win)
|
||||
self._if_gain_range = Range(10, 60, 10, var_if_gain, 200)
|
||||
self._if_gain_win = RangeWidget(self._if_gain_range, self.set_if_gain, 'IF gain', "slider", float)
|
||||
self.top_grid_layout.addWidget(self._if_gain_win)
|
||||
self._if_gain_win = RangeWidget(self._if_gain_range, self.set_if_gain, "IF gain", "counter_slider", float, QtCore.Qt.Horizontal)
|
||||
self.top_layout.addWidget(self._if_gain_win)
|
||||
self._cent_freq_range = Range(900e6, 2200e6, 500, var_cent_freq, 200)
|
||||
self._cent_freq_win = RangeWidget(self._cent_freq_range, self.set_cent_freq, 'Freq', "slider", float)
|
||||
self.top_grid_layout.addWidget(self._cent_freq_win)
|
||||
self._cent_freq_win = RangeWidget(self._cent_freq_range, self.set_cent_freq, "Freq", "counter_slider", float, QtCore.Qt.Horizontal)
|
||||
self.top_layout.addWidget(self._cent_freq_win)
|
||||
self._bb_gain_range = Range(10, 60, 10, var_bb_gain, 200)
|
||||
self._bb_gain_win = RangeWidget(self._bb_gain_range, self.set_bb_gain, 'BB gain', "slider", float)
|
||||
self.top_grid_layout.addWidget(self._bb_gain_win)
|
||||
self._bb_gain_win = RangeWidget(self._bb_gain_range, self.set_bb_gain, "BB gain", "counter_slider", float, QtCore.Qt.Horizontal)
|
||||
self.top_layout.addWidget(self._bb_gain_win)
|
||||
self._bandwidth_range = Range(2e6, 50e6, 10, var_bandwidth, 200)
|
||||
self._bandwidth_win = RangeWidget(self._bandwidth_range, self.set_bandwidth, 'Bandwidth', "slider", float)
|
||||
self.top_grid_layout.addWidget(self._bandwidth_win)
|
||||
self._bandwidth_win = RangeWidget(self._bandwidth_range, self.set_bandwidth, "Bandwidth", "counter_slider", float, QtCore.Qt.Horizontal)
|
||||
self.top_layout.addWidget(self._bandwidth_win)
|
||||
self.xmlrpc_server_0 = SimpleXMLRPCServer(('localhost', 8888), allow_none=True)
|
||||
self.xmlrpc_server_0.register_instance(self)
|
||||
self.xmlrpc_server_0_thread = threading.Thread(target=self.xmlrpc_server_0.serve_forever)
|
||||
self.xmlrpc_server_0_thread.daemon = True
|
||||
self.xmlrpc_server_0_thread.start()
|
||||
self.osmosdr_sink_0 = osmosdr.sink(
|
||||
args="numchan=" + str(1) + " " + ''
|
||||
args="numchan=" + str(1) + " " + 'bladerf=0'
|
||||
)
|
||||
self.osmosdr_sink_0.set_time_unknown_pps(osmosdr.time_spec_t())
|
||||
self.osmosdr_sink_0.set_sample_rate(sample_rate)
|
||||
self.osmosdr_sink_0.set_sample_rate((bandwidth+bandwidth/80))
|
||||
self.osmosdr_sink_0.set_center_freq(cent_freq, 0)
|
||||
self.osmosdr_sink_0.set_freq_corr(0, 0)
|
||||
self.osmosdr_sink_0.set_gain(rf_gain, 0)
|
||||
self.osmosdr_sink_0.set_if_gain(if_gain, 0)
|
||||
self.osmosdr_sink_0.set_bb_gain(bb_gain, 0)
|
||||
self.osmosdr_sink_0.set_antenna('1', 0)
|
||||
self.osmosdr_sink_0.set_antenna('', 0)
|
||||
self.osmosdr_sink_0.set_bandwidth(bandwidth, 0)
|
||||
self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, 50, 0)
|
||||
|
||||
|
||||
|
||||
##################################################
|
||||
# Connections
|
||||
##################################################
|
||||
|
@ -140,6 +137,9 @@ class jammer_gen(gr.top_block, Qt.QWidget):
|
|||
def closeEvent(self, event):
|
||||
self.settings = Qt.QSettings("GNU Radio", "jammer_gen")
|
||||
self.settings.setValue("geometry", self.saveGeometry())
|
||||
self.stop()
|
||||
self.wait()
|
||||
|
||||
event.accept()
|
||||
|
||||
def get_var_rf_gain(self):
|
||||
|
@ -182,14 +182,6 @@ class jammer_gen(gr.top_block, Qt.QWidget):
|
|||
|
||||
def set_samp_rate(self, samp_rate):
|
||||
self.samp_rate = samp_rate
|
||||
self.set_sample_rate(self.samp_rate)
|
||||
|
||||
def get_sample_rate(self):
|
||||
return self.sample_rate
|
||||
|
||||
def set_sample_rate(self, sample_rate):
|
||||
self.sample_rate = sample_rate
|
||||
self.osmosdr_sink_0.set_sample_rate(self.sample_rate)
|
||||
|
||||
def get_rf_gain(self):
|
||||
return self.rf_gain
|
||||
|
@ -224,12 +216,12 @@ class jammer_gen(gr.top_block, Qt.QWidget):
|
|||
|
||||
def set_bandwidth(self, bandwidth):
|
||||
self.bandwidth = bandwidth
|
||||
self.osmosdr_sink_0.set_sample_rate((self.bandwidth+self.bandwidth/80))
|
||||
self.osmosdr_sink_0.set_bandwidth(self.bandwidth, 0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def main(top_block_cls=jammer_gen, options=None):
|
||||
|
||||
if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
|
||||
|
@ -244,6 +236,9 @@ def main(top_block_cls=jammer_gen, options=None):
|
|||
tb.show()
|
||||
|
||||
def sig_handler(sig=None, frame=None):
|
||||
tb.stop()
|
||||
tb.wait()
|
||||
|
||||
Qt.QApplication.quit()
|
||||
|
||||
signal.signal(signal.SIGINT, sig_handler)
|
||||
|
@ -253,11 +248,6 @@ def main(top_block_cls=jammer_gen, options=None):
|
|||
timer.start(500)
|
||||
timer.timeout.connect(lambda: None)
|
||||
|
||||
def quitting():
|
||||
tb.stop()
|
||||
tb.wait()
|
||||
|
||||
qapp.aboutToQuit.connect(quitting)
|
||||
qapp.exec_()
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
# <sebastien.dudek(<@T>)penthertz.com> wrote this file. As long as you retain this notice you
|
||||
# can do whatever you want with this stuff. If we meet some day, and you think
|
||||
# this stuff is worth it, you can buy me a beer in return FlUxIuS ;)
|
||||
#
|
||||
# We would like to thank our contributors for maintening this code:
|
||||
# - @h0rac Grzegorz Wypych from PWNsec.pl
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
from __future__ import print_function
|
||||
|
@ -77,9 +80,9 @@ if __name__ == "__main__":
|
|||
cbandwidth = int(val['bandwidth'].replace('MHz',''))
|
||||
try:
|
||||
if ctype == '3G':
|
||||
downlink, uplink = uarfcn2freq(band, findex, None)
|
||||
downlink, uplink = uarfcn2freq(int(band), findex, None)
|
||||
elif ctype == '4G':
|
||||
downlink, uplink = earfcn2freq(band, findex, None)
|
||||
downlink, uplink = earfcn2freq(int(band), findex, None)
|
||||
elif ctype == '2G':
|
||||
pass
|
||||
# not implemented for our purposes
|
||||
|
@ -92,8 +95,14 @@ if __name__ == "__main__":
|
|||
except Exception as e:
|
||||
print (e)
|
||||
while True:
|
||||
for key, val in t_freqs.items():
|
||||
print ("[+] Jamming cell {cell} central frequency at {freq} MHz with {bandwidth} MHz bandwidth".format(cell=key, freq=val['freq'], bandwidth=val['bandwidth']))
|
||||
s.set_var_cent_freq(val['freq']*1000000)
|
||||
s.set_var_bandwidth(val['bandwidth']*1000000)
|
||||
time.sleep(delay)
|
||||
try:
|
||||
for key, val in t_freqs.items():
|
||||
print ("[+] Jamming cell {cell} central frequency at {freq} MHz with {bandwidth} MHz bandwidth".format(cell=key, freq=val['freq'], bandwidth=val['bandwidth']))
|
||||
s.set_var_cent_freq(val['freq']*1000000)
|
||||
s.set_var_bandwidth(val['bandwidth']*1000000)
|
||||
time.sleep(delay)
|
||||
except:
|
||||
print('Stopping jammer...')
|
||||
state = False
|
||||
break
|
||||
|
||||
|
|
Loading…
Reference in New Issue