Fixing remaining issues on missing bands + cleaning the print

This commit is contained in:
Sébastien Dudek 2023-02-21 16:31:55 +01:00
parent 8c44b926f7
commit 996c67c027
2 changed files with 21 additions and 5 deletions

View File

@ -20,6 +20,10 @@ import xmlrpc.client
import argparse import argparse
from utils.eu_arfcn_calc import * from utils.eu_arfcn_calc import *
def superprintofdeath(message):
print('\r'+message, end='\r\r\r\r\r\r\r', flush=True)
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Modmodjam - Software-Defined Radio Jammer') parser = argparse.ArgumentParser(description='Modmodjam - Software-Defined Radio Jammer')
parser.add_argument('-s', '--host', dest='host', default='localhost', parser.add_argument('-s', '--host', dest='host', default='localhost',
@ -80,8 +84,12 @@ if __name__ == "__main__":
cbandwidth = int(val['bandwidth'].replace('MHz','')) cbandwidth = int(val['bandwidth'].replace('MHz',''))
try: try:
if ctype == '3G': if ctype == '3G':
if band is None:
band = findband(table_uarfcn, findex)
downlink, uplink = uarfcn2freq(int(band), findex, None) downlink, uplink = uarfcn2freq(int(band), findex, None)
elif ctype == '4G': elif ctype == '4G':
if band is None:
band = findband(table_earfcn, findex)
downlink, uplink = earfcn2freq(int(band), findex, None) downlink, uplink = earfcn2freq(int(band), findex, None)
elif ctype == '2G': elif ctype == '2G':
pass pass
@ -90,19 +98,21 @@ if __name__ == "__main__":
cent_freq = downlink cent_freq = downlink
if linkjam == 1: if linkjam == 1:
cent_freq = uplink cent_freq = uplink
t_freqs[key] = { 'freq' : cent_freq, t_freqs[key] = { 'freq' : round(cent_freq),
'bandwidth' : cbandwidth } 'bandwidth' : cbandwidth }
except Exception as e: except Exception as e:
print (e) print (e)
while True: while True:
try: try:
for key, val in t_freqs.items(): 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'])) message="[+] 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) superprintofdeath(message)
s.set_var_bandwidth(val['bandwidth']*1000000) s.set_var_cent_freq(val['freq']*1e6)
s.set_var_bandwidth(val['bandwidth']*1e6)
time.sleep(delay) time.sleep(delay)
except: except Exception as e:
print('Stopping jammer...') print('Stopping jammer...')
state = False state = False
#print(e)
break break

View File

@ -426,6 +426,12 @@ table_uarfcn = {
# Functions # Functions
# #
def findband(indextable, dl_frequency):
for i,j in indextable.items():
if dl_frequency <= j['DL_range'][1] and dl_frequency >= j['DL_range'][0]:
return i
def uarfcn2freq(band, dl_uarfcn=None, ul_uarfcn=None): def uarfcn2freq(band, dl_uarfcn=None, ul_uarfcn=None):
''' '''
in(1): int band index, in(1): int band index,