Skip to content

Instantly share code, notes, and snippets.

View lattera's full-sized avatar

Shawn Webb lattera

View GitHub Profile
# mount
rootfs on / type rootfs (rw)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
/dev/block/mmcblk0p2 on /cache type ext4 (rw,nodev,noatime,nodiratime,user_xattr,acl,barrier=1,data=ordered)
~ # mount /dev/block/mmcblk0p8 /data
mount: mounting /dev/block/mmcblk0p8 on /data failed: Invalid argument
@lattera
lattera / mass.c
Created December 27, 2012 21:12
Little conversion app to pull the authenticode certification chain out of a PE file using ClamAV 0.98
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#include <fcntl.h>
@lattera
lattera / json_encode.php
Last active December 11, 2015 11:48
Very simple json_encode PHP function for PHP < 5.2
function json_encode($arr, $tab=0) {
$ret = "{\n";
foreach ($arr as $key => $value) {
if (strlen($ret) > 2)
$ret .= ",\n";
for ($i=0; $i<$tab+1; $i++)
$ret .= "\t";
@lattera
lattera / sign.c
Created March 26, 2013 15:32
Create a digital signature with an RSA private key and verify that signature against the RSA public key exported as an x509 cert. This is just a PoC and the code is pretty ugly.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
@lattera
lattera / gist:5889210
Created June 29, 2013 01:10
Discussion about a potential vuln in FreeBSD's RTLD
20:52 < lattera> oOoO, I think I spot a vuln in fbsd's rtld
20:54 < chz> an actual vuln or a convoluted one that's not actually a vuln
20:54 < chz> maybe buffer overflow in rtld when loading libraries
20:55 < chz> an attacker with control of the library can cause program to execute arbitrary code
20:55 < chz> fUck
20:55 < lattera> haha, ya, if exploitable (or even if it's a valid vuln), it'd be low priority
20:56 < lattera> https://github.com/lattera/freebsd/blob/svn_stable_9/libexec/rtld-elf/rtld.c#L964
20:57 < lattera> that variable is an int, and other variables, including pointers, are calculated based on that variable
20:57 < chz> bloom_size32?
20:58 < lattera> ya
@lattera
lattera / gist:6585908
Created September 16, 2013 20:11
libreoffice compilation fail
====>> Building editors/libreoffice
build started at Mon Sep 16 09:53:04 EDT 2013
port directory: /usr/ports/editors/libreoffice
building for: FreeBSD 9-stable_amd64-local-job-01 9.2-PRERELEASE FreeBSD 9.2-PRERELEASE amd64
maintained by: office@FreeBSD.org
ident warning: no id keywords in /tank/poudriere/jails/data/build/9-stable_amd64-local/ref/../01//usr/ports/editors/libreoffice/Makefile
Makefile ident:
Poudriere version: 3.0.5
---Begin Environment---
@lattera
lattera / mem.zsh
Last active December 23, 2015 13:49
Calculate the total size of memory a process (in this example, freshclam) is utilizing in FreeBSD with procstat -v.
#!/usr/bin/env zsh
if [ ${#1} -eq 0 ]; then
pidfile="/tmp/clamd.pid"
if [ ! -f ${pidfile} ]; then
echo "[-] pidfile not found"
exit 1
fi
pid=$(cat ${pidfile})
else
@lattera
lattera / gist:9832504
Created March 28, 2014 13:19
keybase.md
### Keybase proof
I hereby claim:
* I am lattera on github.
* I am lattera (https://keybase.io/lattera) on keybase.
* I have a public key whose fingerprint is 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE
To claim this, I am signing this object:
@lattera
lattera / gist:83c6b1c13fc8dd68efcf
Created May 5, 2014 17:45
PIE-enabled chrome build log
This file has been truncated, but you can view the full file.
====>> Building www/chromium
build started at Sun May 4 03:06:50 EDT 2014
port directory: /usr/ports/www/chromium
building for: FreeBSD 11-current_amd64-local-job-04 11.0-CURRENT FreeBSD 11.0-CURRENT amd64
maintained by: chromium@FreeBSD.org
ident warning: no id keywords in /tank/poudriere/jails/data/build/11-current_amd64-local/ref/../04//usr/ports/www/chromium/Makefile
Makefile ident:
Poudriere version: 3.0.14
---Begin Environment---
@lattera
lattera / .vimrc
Created August 11, 2014 11:54
vimrc for FreeBSD development
" Modeline and Notes {
" vim: set foldmarker={,} foldlevel=0 spell:
" }
" Basics {
set nocompatible " explicitly get out of vi-compatible mode
set noexrc " don't use local version of .(g)vimrc, .exrc
set background=dark " we plan to use a dark background
set cpoptions=aABceFsmq
" |||||||||