Posts

Showing posts with the label Python

CC1120 + Arduino : Mobitex-1200

Image
https://techcoderadio.blogspot.com/2025/03/arduinosx1278-mobitex-1200-462325-mhz.html   #include <SPI.h> #include "cc1120.h" #define PRINT_INFO  1 #define DATA_SIZE   128 #define pinOfPin(P)\   (((P)>=0&&(P)<8)?&PIND:(((P)>7&&(P)<14)?&PINB:&PINC)) #define pinIndex(P)((uint8_t)(P>13?P-14:P&7)) #define pinMask(P)((uint8_t)(1<<pinIndex(P))) #define isHigh(P)((*(pinOfPin(P))& pinMask(P))>0) #define isLow(P)((*(pinOfPin(P))& pinMask(P))==0) #define digitalState(P)((uint8_t)isHigh(P)) uint8_t data[DATA_SIZE]; uint8_t chipStatus      = 0; volatile uint8_t index  = 0; volatile bool printData = false; void setup() {   Serial.begin(57600);   pinMode(RESET_PIN, OUTPUT);   pinMode(SS_PIN, OUTPUT);   pinMode(GDO0_PIN, INPUT);   pinMode(GDO2_PIN, INPUT);   pinMode(GDO3_PIN, INPUT);   digitalWrite(SS_PIN, HIGH);   digitalWrite(RESET_PIN, HIGH); ...

Tweaks for the Bearmock with USB serial adapter and USB null modem adapter

Image
https://techcoderadio.blogspot.com/2025/04/bearmock-for-python-3.html .. and generally for anykind of serial based dev emulator written in Python. Python 3.14/.15 with JIT tends to work a bit better than older versions $env:PYTHON_JIT=1 USB serial adapter: USB selective suspend off.   USB null modem adapter: try different Latency Timer values.  

Optimizing Uniden bearmock srecutils

https://techcoderadio.blogspot.com/2025/04/bearmock-for-python-3.html Some optimizations   # srecutils.py # # Copyright (C) 2011 Gabriel Tremblay - initnull hat gmail.com # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA """     Motorola S-Record utis     - Kudos to Montreal CISSP Groupies """ from functools...

Guidelines for inspecting old (circa 1998 - 2007) receiver control and updater software

Image
Old control/updater programs are usually written in VB6, Delphi/C++ Builder or .NET VB, C#. DetectItEasy can show PE32 info which usually and almost allways shows which development tool/framework is used. DetectItEasy strings function shows ASCII strings inside .EXE file. Sometimes there is code embedded inside exe, usually as Motorola S-Record format. E.g. with Python script is easy to extract it and remove unnecessary characters. import re re.sub(r'[^S0-9A-F\r\n]+', '', text) ...  or use Linux stings command.  Installers are usually msi or innoextract. Can be extracted e.g with unzip, msiexec, msiextract (Linux) or innoextract (Linux). Sometimes embedded code is inside in a one of the extracted files. SRecord is a set of tools for inspecting/converting etc. S-Record data. VB6 programs can be further examined e.g. with VB6 decompiler lite. .NET programs, dotPeek can export to VS solution. Even in deobfuscated .NET programs it is possible to find some quite clean code (...

Monitor with Python and RTL-SDR

Python, RTL-SDR, numpy This is modified version based on rtl-sdr-close-call-monitor  https://github.com/nootedandrooted/rtl-sdr-close-call-monitor It scans tetra uplink european frequencies. import sys import time import numpy as np from rtlsdr import RtlSdr sdr = RtlSdr() sr = 2.4e6 shift = 1.2e6 start_freq = 380.0125e6 end_freq = 0 freq = 381.2125e6 sdr.sample_rate = sr  # Hz sdr.freq_correction = 1  # PPM sdr.gain = 30  # dB num_samples = 2**16 squelch_level = -30 n = 0 while True:     gain_question = str(input("Do you want to use the default gain? (30dB) (y/n): "))     if gain_question == 'y':         print("Using the default gain (30 dB)")         break     elif gain_question == 'n':         gain_custom = int(input("Please enter the gain (in dB): "))         sdr.gain = gain_custom         break     else:      ...

Inspecting Uniden BC346XT firmware

Image
I am interested in finding unknown remote commands and test modes. Ghidra and a bit of Python code.

Inspecting some Uniden scanners firmware strings

Image
with srecparser.py https://techcoderadio.blogspot.com/2026/04/motorola-s-record-old-python-code.html     Uniden BR330T BCT15 BCD396T  

Inspecting Uniden BC898T firmware

Image
run BearMock to get decoded Motorola S-record format file https://techcoderadio.blogspot.com/2025/04/bearmock-for-python-3.html CPU is probably M16C/60N Ghidra:

Inspecting Uniden BCT8 firmware

Image
run BearMock to get decoded Motorola S-record format file https://techcoderadio.blogspot.com/2025/04/bearmock-for-python-3.html CPU is probably M16C/60N Ghidra:  

Motorola S-record - old Python code enhanced #2

https://techcoderadio.blogspot.com/2025/04/motorola-s-record-old-python-code.html https://github.com/gabtremblay/pysrec Code optimized New option -a which stores data section as ASCII Tested with Python 3.14.4 #!/usr/bin/python # srecparser.py # # Copyright (C) 2011 Gabriel Tremblay - initnull hat gmail.com # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA...

Enhancing old heatmap.py

Python 3.14.3 original code: https://github.com/keenerd/rtl-sdr-misc/blob/master/heatmap/heatmap.py   Enhanced code. Optimizations and works with latest pillow (12.x.x) versions #! /usr/bin/env python # fix for the pillow 12 from PIL import Image, ImageDraw, ImageFont import os, sys, gzip, math, argparse, colorsys, datetime from collections import defaultdict urlretrieve = lambda a, b: None try:     import urllib.request     urlretrieve = urllib.request.urlretrieve except:     import urllib     urlretrieve = urllib.urlretrieve # todo: # matplotlib powered --interactive # arbitrary freq marker spacing # ppm # blue-less marker grid # fast summary thing # gain normalization # check pil version for brokenness vera_url = "https://github.com/keenerd/rtl-sdr-misc/raw/master/heatmap/Vera.ttf" vera_path = os.path.join(sys.path[0], "Vera.ttf") tape_height = 25 tape_pt = 10 if not os.path.isfile(vera_path):     urlretrieve(vera_url, vera_path)...

Inspecting Uniden BC-246T firmware

Image
run BearMock to get decoded Motorola S-record format file https://techcoderadio.blogspot.com/2025/04/bearmock-for-python-3.html CPU is probably M16C/60N Ghidra:    

Inspecting Uniden BC796D firmware

Image
run BearMock to get decoded Motorola S-record format file https://techcoderadio.blogspot.com/2025/04/bearmock-for-python-3.html CPU is probably M16C/60N Ghidra: