Skip to content

Instantly share code, notes, and snippets.

View petabyt's full-sized avatar

Daniel C petabyt

View GitHub Profile
@petabyt
petabyt / log
Created May 31, 2022 20:09
dss-vs
This file has been truncated, but you can view the full file.
Rebuild started...
1>------ Rebuild All started: Project: libjpg, Configuration: Debug x64 ------
2>------ Rebuild All started: Project: libtiff, Configuration: Debug x64 ------
3>------ Rebuild All started: Project: ZCLass, Configuration: Debug x64 ------
4>------ Rebuild All started: Project: libraw, Configuration: Debug x64 ------
4>Search paths being used for $(MSBuildExtensionsPath) are C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild;$(MSBuildProgramFiles32)\MSBuild
4>Trying to import C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\$(MSBuildToolsVersion)\Microsoft.Common.props using extensions path C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild
4>Property reassignment: $(MSBuildProjectExtensionsPath)="C:\msys64\home\brikb\DSS\LibRaw\buildfiles\obj\" (previous value: "obj\") at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Microsoft.Common.props (57,5)
4>Search paths being used for $(MSBuildExtensionsPath) a
@petabyt
petabyt / serv.c
Last active February 24, 2022 15:47
tiny c99 web server
// Inspired by https://gist.github.com/laobubu/d6d0e9beb934b60b2e552c2d03e1409e
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <signal.h>
#define MAX_CONNECTION 100
#define RESP_BUF_MAX 1000
@petabyt
petabyt / README.md
Created February 7, 2022 17:27
ARM Reverse Engineering Tools
@petabyt
petabyt / README.md
Last active February 4, 2022 16:39
Stub File Spec

Stubs File

Feb 5 2022

gcc main.S -DSTUBS -include "../model/$(model).h"

xf1.h:

#define MODEL_NAME "Fujifilm XF1"

#define BASE_ADDR 0xa0000000
@petabyt
petabyt / importmacro.mk
Last active June 26, 2022 19:41
(Public Domain) Get C preprocessor macro inside of Makefile
# You may use this anywhere, if you link back to this page.
# Usage:
# $(call getMacro header.h MY_MAC %s)
# The macro will be 0 when it is undefined
# "Parse" C header, converting C macro to Make macro
# See https://gist.github.com/petabyt/898d3437decf65fc04fc50bd0e125362
define importMacro
$(shell echo "#include <stdio.h>\n \
@petabyt
petabyt / README.md
Created January 1, 2022 03:10
Is firmware reverse engineering legal?

Yes.
Kind of.

I'm not a lawyer, nor have I talked to one, but this is my analysis:

Copyright is a nightmare to work with. There are no garuntees
that a company won't sue you.

As for US law, "Reverse engineering (section 1201(f))"

This exception permits

@petabyt
petabyt / android_auto_install.md
Last active February 18, 2024 09:42
Debian/ubuntu android auto install instructions

Install debian android build tools

Most of what you need:

sudo apt install android-sdk android-sdk-platform-23 

If you can't find it, just download Android Studio and abandon this guide.

Accept the android licenses

git clone https://github.com/Shadowstyler/android-sdk-licenses.git
@petabyt
petabyt / af.c
Last active December 18, 2021 20:16
autofree.h: Hijack malloc and free on exit(), or autofree()
void *allocList_[1000];int allocn_=0;void *malloc_(long unsigned int n){
void *x=malloc(n);allocList_[allocn_]=x;allocn_++;return x;}void autofree(){
while (allocn_){allocn_--;free(allocList_[allocn_]);}}
#define malloc(x) malloc_(x)
#define exit(x) autofree(x);exit(x);
@petabyt
petabyt / a.c
Created December 11, 2021 23:13
arm32 assemble b branch instruction
void assemble_b(uintptr_t *from, uintptr_t *to, uint8_t buf[4]) {
uint32_t temp = (uintptr_t)to;
// Assemble instruction based on location
// of new addr relative to old address
if (from < to) {
temp = (temp - 8) / 4;
memcpy(buf, &temp, 4);
} else {
temp = 0xffffff - ((from - to + 4) / 4);
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
void hijack(uintptr_t *addr, uintptr_t *newa, uint8_t buf[4]) {
uint32_t temp = (uintptr_t)newa;
if (addr < newa) {
temp = (temp - 8) / 4;