Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# This little hack-job will grab credentials from a running openvpn process in Linux
# Keep in mind this won't work if the user used the --auth-nocache flag
grep rw-p /proc/$1/maps | sed -n 's/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1 \2/p' | while read start stop; do gdb --batch-silent --silent --pid $1 -ex "dump memory $1-$start-$stop.dump 0x$start 0x$stop"; done
echo "Your credentials should be listed below as username/password"
strings *.dump | grep -B2 KnOQ | grep -v KnOQ
rm *.dump --force
@bahamat
bahamat / 00-illumos_SMF_manifests_for_CFengine.md
Last active November 11, 2015 17:49
illumos SMF manifests for Cfengine.

Download each file using the Raw link, or clone this gist then run the following commands:

svccfg import cf-serverd.xml
svccfg import cf-monitord.xml
svcdfg import cf-execd.xml

In your policy, cfe_internal/update/update_processes.cf should be updated accordingly to enable the SMF services instead of executing commands directly.

@bahamat
bahamat / nginx_log_format_bunyan.conf
Last active September 14, 2016 08:12
nginx log_format bunyan
log_format bunyan '{'
'"name": "nginx/$nginx_version",'
'"hostname": "$hostname",'
'"pid": "$pid",'
'"level": 30,'
'"time": "$time_iso8601",'
'"v": 0,'
'"msg": "access",'
'"remoteAddress": "$remote_addr",'
@bahamat
bahamat / Makefile
Last active October 12, 2016 19:13 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
This file has been truncated, but you can view the full file.
PCRE version 8.36 2014-09-26
/([^\s]+)\-([0-9][^\s;]+).*[\s;]/
0verkill-0.16nb1;0verkill is bloody 2D action deathmatch-like game in ASCII-ART
0: 0verkill-0.16nb1;0verkill is bloody 2D action deathmatch-like game in
1: 0verkill
2: 0.16nb1
2vcard-0.5nb3;Convert an addressbook to the popular VCARD file format
0: 2vcard-0.5nb3;Convert an addressbook to the popular VCARD file
@bahamat
bahamat / pipasswd
Last active January 5, 2017 19:45
Find the SmartDataCenter default root password for any installed platform image.
#!/bin/bash
if (( UID > 0 )); then
echo "You must elevate privileges."
exit 1
fi
usbkey_status=$(/opt/smartdc/bin/sdc-usbkey status)
passwd_file=/mnt/usbkey/private/root.password.$1
@bahamat
bahamat / moved.md
Last active May 16, 2017 22:31
Update all components of SDC.
@bahamat
bahamat / flask_example.md
Created July 25, 2017 05:09
Simple flask example.
@bahamat
bahamat / pkgsrc-brew.md
Created May 22, 2017 23:45
Packages I get from brew instead of pkgsrc, and why
pkg why
dnstracer not available
fortune not available
ghc not available on mac
hping out of date (pkgsrc==hping2, brew==hping3)
nagios-plugins does not compile on mac. Maybe brew patch(es) can be used?
shunit2 not available
tcpflow out of date (pkgrsc==0.21, brew==1.4); depends on dfxml which does not compile on smartos due to missing MAP_FILE ([tcpflow#91)[simsong/tcpflow#91])
@bahamat
bahamat / auto_homedir
Created November 17, 2018 19:51
auto_homedir for use with illumos autofs to create user home directories on first access
#!/bin/bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 2018 Brian Bennett <brian.bennett@joyent.com>
# Inspired by
# http://znogger.blogspot.com/2010/05/solaris-automatic-creation-of-home-dirs.html