Skip to content

Instantly share code, notes, and snippets.

View Kungergely's full-sized avatar

Gergely Kún Kungergely

  • Bratislava, Slovakia
View GitHub Profile
@Kungergely
Kungergely / hdf5version.py
Last active August 9, 2020 15:19
Detecting the version of the HDF5 library
import ctypes
lib=ctypes.windll.LoadLibrary("C:\\Path\\to\\hdf5.dll")
#lib=ctypes.cdll.LoadLibrary("/usr/lib/libhdf5.so")
length = 1
majnum = ctypes.cast(ctypes.create_string_buffer(length), ctypes.POINTER(ctypes.c_uint))
minnum = ctypes.cast(ctypes.create_string_buffer(length), ctypes.POINTER(ctypes.c_uint))
relnum = ctypes.cast(ctypes.create_string_buffer(length), ctypes.POINTER(ctypes.c_uint))
lib.H5get_libversion.argtypes = [ ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)]
lib.H5get_libversion(majnum, minnum, relnum)
@Kungergely
Kungergely / binwalk_on_win10.txt
Last active December 5, 2024 20:13
How to make binwalk work on Windows 10
The following steps are meant either to complement the wonderful book titled "The IoT Hacker’s Handbook A Practical Guide to Hacking the Internet of Things" by Aditya Gupta or to act as a generic aid in firmware exploiting and pentesting for Win10 users.
1. Clone akx's branch of binwalk:
git clone -b packaging-fixes https://github.com/akx/binwalk.git
2. Change to this newly-created directory and install the module:
cd C:\Path\to\binwalk
pip3 install .
3. Download squashfs for Windows:
@Kungergely
Kungergely / ff_history_backup.py
Last active January 10, 2022 11:36
A Py3 script for backing up the places.sqlite file (Firefox history) which's known to become corrupt and lose contents during crashes. It should work on both Windows and Linux with backing up the file from the first FF profile folder found. It requires a working Py3 installation and on Windows it should be scheduled using pythonw.exe to avoid CL…
import gzip, os, platform, shutil, sqlite3
from datetime import datetime
# The paths are somewhat different on Linux and Windows
if platform.system()=="Windows":
destdir="D:\\FF backups"
srcdir=os.environ["APPDATA"]+"\\Mozilla\\Firefox\\Profiles"
elif platform.system()=="Linux":
destdir="/media/backup"
srcdir=os.environ["HOME"]+"/.mozilla/firefox"
@Kungergely
Kungergely / gist:94b9e972f6023f483d51a7d6ce2e24b3
Last active November 15, 2022 15:25
RADRRTM format description
The file is read in Fortran as "unstructured" binary. The data is encoded in little endian format, while the size is encoded in big endian format.
# The first four bytes denote a block length (0x00009600 = 38400, 0x00037000 = 225280, 0x00002080 = 8320, 0x00019A00 = 104960, 0x00012480 = 74880 )
# The rest of the block consists of 64-bit floats
# Each block is succeeded by the size value (the same as in the beginning) again and this is the offset the block length at the beginning points to
# The individual blocks (complete with the block length prepended and appended to it) are concatenated together into a single file
# This is consistent with the FORTRAN "unformatted" file saving convention described e.g. in https://www.mathworks.com/matlabcentral/answers/97118-how-do-i-read-a-fortran-unformatted-binary-data-file-into-matlab#answer_106468