Skip to content

Instantly share code, notes, and snippets.

@zbuc
zbuc / ScreenshotManager.m
Created February 26, 2012 11:13
NSImage base64 HTTP POST
- (void)uploadImage:(NSImage *)image
{
NSData *imageData = [image TIFFRepresentation];
NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:imageData];
imageData = [imageRep representationUsingType:NSPNGFileType properties:nil];
NSString *base64 = [imageData encodeBase64WithNewlines: NO];
@zbuc
zbuc / crash
Created July 16, 2012 21:49
crash
Process: httpd [92518]
Path: /usr/sbin/httpd
Identifier: httpd
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: httpd [92504]
PlugIn Path: /usr/local/lib/libmemcached.10.dylib
PlugIn Identifier: libmemcached.10.dylib
PlugIn Version: 11.0.0 (compatibility 11.0.0)
@zbuc
zbuc / pony.py
Created October 11, 2012 17:50
pony
import collections
# NOTE requires GitPython>=0.3.2.RC1 for 'blame' support
from git import Repo
def autodict():
return collections.defaultdict(autodict)
repo = Repo('/path/to/repo')
@zbuc
zbuc / keybase.md
Created September 18, 2014 15:23
keybase.md

Keybase proof

I hereby claim:

  • I am zbuc on github.
  • I am zbuc (https://keybase.io/zbuc) on keybase.
  • I have a public key whose fingerprint is 93C2 CD7F 3368 0356 5FBA CE2C E2CC 62D7 BDB5 9DA0

To claim this, I am signing this object:

@zbuc
zbuc / python shellshock
Created September 25, 2014 23:27
Python shellshock example
# python subprocess calls using shell=True
# are vulnerable to shellshock...
bash-3.2$ cat test.py
#!/usr/bin/env python
import subprocess
subprocess.call(["/bin/ls"], shell=True)
@zbuc
zbuc / patch-sshmitm.c.diff
Last active August 29, 2015 14:07
dsniff csin patch
--- sshmitm.c.orig 2014-10-20 11:45:13.000000000 -0400
+++ sshmitm.c 2014-10-20 11:45:41.000000000 -0400
@@ -41,7 +41,7 @@
int client_fd, server_fd;
SSH_CTX *ssh_client_ctx, *ssh_server_ctx;
SSH *ssh_client, *ssh_server;
-struct sockaddr_in csin, ssin;
+struct sockaddr_in csin_, ssin;
int sig_pipe[2];
@zbuc
zbuc / patch-webmitm.c.diff
Created October 20, 2014 16:02
patch-webmitm.c.diff
--- webmitm.c.orig 2014-10-20 11:45:13.000000000 -0400
+++ webmitm.c 2014-10-20 11:45:38.000000000 -0400
@@ -43,7 +43,7 @@
int client_fd, server_fd;
SSL_CTX *ssl_client_ctx, *ssl_server_ctx;
SSL *ssl_client, *ssl_server;
-struct sockaddr_in csin, ssin;
+struct sockaddr_in csin_, ssin;
int do_ssl, sig_pipe[2];
in_addr_t static_host = 0;
@zbuc
zbuc / patch-zbuc.diff
Last active August 29, 2015 14:07
patch-zbuc.diff
diff --git sshmitm.c sshmitm.c
index 60993dd..c570464 100644
--- sshmitm.c
+++ sshmitm.c
@@ -41,7 +41,7 @@ int mitm_fd;
int client_fd, server_fd;
SSH_CTX *ssh_client_ctx, *ssh_server_ctx;
SSH *ssh_client, *ssh_server;
-struct sockaddr_in csin, ssin;
+struct sockaddr_in csin_, ssin;
@zbuc
zbuc / patch-zbuc.diff
Created October 20, 2014 18:54
patch-zbuc.diff
diff --git sshmitm.c sshmitm.c
index 60993dd..c570464 100644
--- sshmitm.c
+++ sshmitm.c
@@ -41,7 +41,7 @@ int mitm_fd;
int client_fd, server_fd;
SSH_CTX *ssh_client_ctx, *ssh_server_ctx;
SSH *ssh_client, *ssh_server;
-struct sockaddr_in csin, ssin;
+struct sockaddr_in csin_, ssin;
@zbuc
zbuc / multithreaded_flask.py
Created February 18, 2015 05:38
Example Multithreaded Flask App
from flask import Flask
app = Flask("proxapp")
@app.route('/')
def hello_world():
return 'Hello World!'