Skip to content

Instantly share code, notes, and snippets.

@Auscitte
Auscitte / dbxupdate_matroska.py
Created February 10, 2023 10:21
Prints set-theoretic (loosly speaking) relations for a sequence of consecutive dbxupdate.bin files
""" Prints set-theoretic relations for a sequence of consecutive dbxupdate.bin files
Prepend file names with the release date in the yyyy-mm-dd format (you can name the files
in some other way, but make sure that sorting the files in a lexicographical order
correspendeds to sorting them by a release date)
dbxupdate_parser lives at https://github.com/Auscitte/sys-utils/blob/main/dbxupdate_parser.py
:Copyright:
Ry Auscitte 2023. This script is distributed under MIT License.
@Auscitte
Auscitte / minimax_fit.py
Created January 22, 2022 07:32
Solution for the Minimax Rational Fit to the Exponential problem
""" Solution for the "Minimax rational fit to the exponential" problem in Stephen Boyd's Convex Optimization
Compares a bisection-based implementation to that employing coordinate descent (iterative partial minimization).
:Copyright:
Copyright Ry Auscitte 2021. This script is distributed under MIT License.
:Authors:
Ry Auscitte
"""
@Auscitte
Auscitte / hw9_3.py
Last active September 29, 2021 21:17
Data for the Allocation of Interdiction problem
#Data for the Allocation of Interdiction problem (in Stephen Boyd's Convex Optimization course) generated with Matlab;
#I borrowed the list of edges from https://github.com/NoamGit/CVX101-HW-with-python/blob/master/HW10/hw10_script.py and
#used matlab to generate a and x_max.
import numpy as np
(n, m) = (10, 20)
B = m / 2.0
@Auscitte
Auscitte / pefileseh.py
Last active April 4, 2023 09:15
Reading exception directory with pefile
""" Extends Ero Carrera's pefile with the functionality for parsing exception tables (SEH support).
Beginning from version 2021.9.3, this functionality has been integrated into pefile, so you will
need pefileseh.py only if you use an older version of pefile.
Only x64 and IA64 architectures are supported.
Classes defined in this module:
* StructureWithBitfields
* ExceptionsDirEntryData
@Auscitte
Auscitte / RegistryParse.py
Created April 20, 2021 21:52
Recovers a broken Windows registry
#!/bin/python
# This file was borrowed from python-registry, version 1.3.1,
# and modified by Ry Auscitte to work with a registry-recovery script (breg.py).
# This file is part of python-registry.
#
# Copyright 2011 Will Ballenthin <william.ballenthin@mandiant.com>
# while at Mandiant <http://www.mandiant.com>
@Auscitte
Auscitte / ServerDllInitialization.cpp
Created December 26, 2020 21:33
Reverse-engineered basesrv::ServerDllInitialization()
/**
* @file ServerDllInitialization.cpp
* @brief Some partially reverse-engineered functions and structures from basesrv.dll (build 1804).
*
* The file contains ServerDllInitialization(), BaseSrvInitializeIniFileMappings(), and CreateBaseAcls(),
* reverse-engineered to the extent and with accuracy necessary to figure out the reason why the OS
* installed on authors' laptop failed to boot.
*
* @author Ry Auscitte
*/
@Auscitte
Auscitte / gdata.py
Last active July 3, 2021 01:15
Lists code blocks belonging to a function with the help of pdbparse library
# This file is a copy of gdata.py from pdbparse library ver. 1.5
# (see https://github.com/moyix/pdbparse)
# with a few mofifications that are necessary for my scripts to work correctly
# Ry Auscitte
# Python 2 and 3
from construct import *
gsym = Struct(
@Auscitte
Auscitte / ServerDllInitialization_r2dec.c
Created November 27, 2020 19:27
basesrv::ServerDllInitialization() decompiled with r2dec
/* r2dec pseudo code output */
/* /home/ubuntu/basesrv.dll @ 0x180001680 */
#include <stdint.h>
int64_t ServerDllInitialization (int64_t arg_10h, int64_t arg_18h, int64_t arg_20h, int64_t arg1, int64_t arg2, int64_t arg4) {
int64_t var_ee8h;
int64_t var_ee0h;
int64_t var_ea8h;
int64_t var_ea0h;
int64_t var_e98h;
@Auscitte
Auscitte / ServerDllInitialization_pdc.c
Created November 27, 2020 19:21
pseudocode for basesrv::ServerDllInitialization() generated by radare2's built-in decompiler
function sym.BASESRV.dll_ServerDllInitialization () {
// 92 basic blocks
loc_0x180001680:
push rbp
push rbx
push rsi
push r12
push r15
@Auscitte
Auscitte / ServerDllInitialization_retdec.c
Created November 27, 2020 19:16
basesrv::ServerDllInitialization() decompiled by retdec plugin for radare2
// Address range: 0x180004f72 - 0x180004f77
int64_t function_180004f72(void) {
// 0x180004f72
int64_t result; // 0x180004f72
return result;
}
// Address range: 0x180004f77 - 0x180004f8a
int64_t function_180004f77(void) {
// 0x180004f77