Skip to content

Instantly share code, notes, and snippets.

@sehrgut
sehrgut / console.log-uncaught.js
Created November 24, 2015 17:22
logs uncaught exceptions which bubble up to window.onerror
window.onerror = (function () {
var old_err = window.onerror;
var new_err = function (msg, url, line, col, err) {
console.log("Line " + line + ":" + col + " - " + msg);
if (typeof err.stack !== 'undefined')
console.log(err.stack);
else
console.log(err);
@sehrgut
sehrgut / ios-profile-certs.sh
Last active November 9, 2022 16:25
Lists certificates permitted by an iOS provisioning profile
#!/bin/bash
readonly MODE_INFO=0
readonly MODE_VERBOSE=1
readonly MODE_EXTRACT=2
PLISTBUDDY=/usr/libexec/PlistBuddy
RUNMODE=$MODE_BASIC
TMP=`mktemp -t ios-profile-certs`
@sehrgut
sehrgut / curl-output.txt
Created January 3, 2016 21:56
How to hijack a page via a <script> tag loading HTML. Real-world example in curl-output.txt.
HTTP/1.1 302 Found
Date: Sun, 03 Jan 2016 19:58:45 GMT
Server: Apache
X-Powered-By: PHP/5.4.45-0+deb7u2
Location: http://ww31.gvisit.com/record.php?sid=592101993e8b9913eb0462e5bd4d7501
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8
HTTP/1.1 200 OK
@sehrgut
sehrgut / README.md
Last active April 17, 2023 20:10
AdBlock Plus rule to neuter Forbes "AdBlock detection"

Forbes Is Irrelevant

an AdBlock Plus filter list

Installation

  1. Right-click the "ABP" icon in yoru browser toolbar.
  2. Select "Options".
  3. Click the "Add Filter Subscription" button.
  4. Select "Add a different subscription..." from the drop-down menu.
  5. Enter "Forbes Is Irrelevant" for the subscription title, and http://bit.ly/forbes-sucks for the filter list location.
  6. Click the "Add" button.
@sehrgut
sehrgut / xsplit.sh
Last active March 20, 2019 17:33
like xargs for stdin
#!/bin/bash
# todo: keep or discard record separator
# todo: record sep within line?
# todo: line delim param
# todo: print0
# todo: verbose mode showing objects being passed and util being invoked, etc.
VERSTRING='xsplit/v0.2'
@sehrgut
sehrgut / list-keychain-identities.sh
Last active May 22, 2016 22:51
show signing certs available in keychain
#!/bin/bash
XSPLIT=~/bin/xsplit
pass=`dd if=/dev/random bs=1 count=256 2>/dev/null | openssl sha1`
(
sudo security export -k "/Library/Keychains/System.keychain" \
-P "$pass" -t identities -f pkcs12 2>/dev/null
security export -k "$HOME/Library/Keychains/login.keychain" \
@sehrgut
sehrgut / index.js
Last active April 25, 2016 05:24
requirebin sketch
var sprintf = require('printf'),
isLuhn = require('luhn').validate;
var tmpl = '4505530024789%03d';
for (var i=0, n=1; i< 999; i++) {
var ccn = sprintf(tmpl, i);
if (isLuhn(ccn))
console.log(sprintf('%d: %s', n++, ccn));
@sehrgut
sehrgut / showcert.sh
Last active June 5, 2021 00:45
retrieves the SSL certificate from a remote server
#!/bin/bash
VERSTRING="showcert/v0.2a"
OPENSSL="openssl"
VERBOSE=0
HOST=""
PORT=""
SNI=""
@sehrgut
sehrgut / mono-symbol.sh
Created September 20, 2016 18:50
retrieves the ASCII method name for a symbol offset in a mono process
#!/bin/bash
PID=$1
OFFSET=$2
sudo lldb -p ${PID} <<< "p (char*)mono_pmip ((void*)0x${OFFSET})"
@sehrgut
sehrgut / castlebot.user.js
Last active November 6, 2023 21:47
Sandcastle Builder autobot: kitten clicking, and ninja-safe sand clicking
// ==UserScript==
// @name castlebot
// @namespace http://alphahelical.com/
// @version 0.4
// @description Sandcastle Builder autobot: kitten clicking, and ninja-safe sand clicking
// @author sehrgut
// @match http://castle.chirpingmustard.com/castle.html
// @grant GM_info
// @grant unsafeWindow
// @grant GM_log