Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import matplotlib.pyplot as plt
import matplotlib.patches as patches
COLORS = plt.style.library['bmh']['axes.color_cycle']
def show_colors():
fig, ax = plt.subplots(1)
@cojocar
cojocar / arm-elf-data-code-symbols.md
Last active October 16, 2021 19:28
Different behavior of objdump depending on data/code ARM specific symbols

Symbols are important for linear disassembly on ARM

For x86, because we don't have any "special" symbols, the output is the same for strip vs nostrip. ".word 0x9090" which is data is interpreted as code because of the linear disassambly behavior. The special symbols are documented here: https://sourceware.org/binutils/docs-2.23/as/ARM-Mapping-Symbols.html

For ARM objdump (and the tools alike), because symbols are used to determine if we have code ore data the linear disass knows where is data and where is code.

@cojocar
cojocar / libs-freq.md
Created May 11, 2016 07:48
Most used libs on Debian 8
$ find /bin /usr/bin/ /sbin/  -executable -exec ldd {} \; 2>/dev/null | cut -f1 -d' ' | tr -d '\t' | grep -ve "^not$" | sort | uniq -c | sort -n -k1 -r > /tmp/all-find
$ head -100 /tmp/all-find 
   2969 libc.so.6
   2968 linux-vdso.so.1
   2968 /lib64/ld-linux-x86-64.so.2
   1528 libdl.so.2
   1514 libm.so.6
   1444 libpthread.so.0
   1141 libz.so.1

Download the installer file

wget http://cdn.rowleydownload.co.uk/arm/releases/arm_crossworks_3_6_1_linux_x86.tar.gz

Extract the file

tar xf arm_crossworks_3_6_1_linux_x86.tar.gz && cd arm_crossworks_*
@cojocar
cojocar / resize-qcow.md
Last active August 11, 2022 11:00
Shrink size of a qcow image that contains an OS.

Prepare environment

$ wget https://people.debian.org/~aurel32/qemu/i386/debian_wheezy_i386_standard.qcow2
$ qemu-img info debian_wheezy_i386_standard.qcow2
image: debian_wheezy_i386_standard.qcow2
file format: qcow2
virtual size: 25G (26843545600 bytes)
disk size: 256M
cluster_size: 65536
@cojocar
cojocar / tomato-static-mac.md
Last active July 1, 2020 16:22
Set a fixed MAC address on a TAP interface (OpenVPN client) on Tomato Firmware 1.28.0000 MIPSR2-101 K26 USB AIO-64K and maybe on others

How to set a fixed MAC address on a TAP interface (OpenVPN client) on Tomato Firmware

Problem

Using the lladdr 00:11:22:33:44:55 option in the OpenVPN client custom configuration form doesn't change the MAC of the tap interface.

Solution

Paste this in the custom configuration box:

script-security 2
@cojocar
cojocar / tomato-compile.md
Last active January 27, 2019 08:50
Compile Tomato Shibby on Ubuntu 12.04.5 LTS (Asus RT-N66U)

How to compile Tomato Shibby on Ubuntu 12.04.5 LTS (for Asus RT-N66U)

$ git clone git://repo.or.cz/tomato.git
$ cd tomato
$ git checkout tomato-shibby-RT-AC
$ sudo ln -s full/path/to/tomato/tools/brcm /opt
$ export PATH=${PATH}:/opt/brcm/hndtools-mipsel-linux/bin:/opt/brcm/hndtools-mipsel-uclibc/bin:/mnt/a/projects/tomato/release/tools
$ git describe --tags
ShibbyRT-N_095-624-ga45b4d6

Keybase proof

I hereby claim:

  • I am cojocar on github.
  • I am cojocar (https://keybase.io/cojocar) on keybase.
  • I have a public key whose fingerprint is 1DA3 C639 B10C 215A 62ED 43ED 019E 4BA4 F235 22D6

To claim this, I am signing this object: