Skip to content

Instantly share code, notes, and snippets.

View lukele's full-sized avatar

Lukas Pitschl lukele

View GitHub Profile
@lukele
lukele / zibopt-build.sh
Created March 7, 2013 22:37
Script that makes building zibpot python bindings easier.
#!/bin/bash
if [ -z "$1" ]; then
echo "usage: ./zibopt-install.sh <build-dir>"
exit 1
fi
function bailout {
echo "$1"
exit 1

GPGServices v1.8.2 - Release Notes

Features

Symmetric encryption

  • One of the most requested GPGServices features has arrived. You can now encrypt with a password. [#74]

Keybase proof

I hereby claim:

  • I am lukele on github.
  • I am lukele (https://keybase.io/lukele) on keybase.
  • I have a public key whose fingerprint is 608B 00AB E1DA A350 1C5F F91A E582 7132 6F9F 4937

To claim this, I am signing this object:

@lukele
lukele / gist:25746d3a835e7933c44ad6b49bd99a90
Created November 2, 2016 15:47
Access block captured variables by using the offsets seen in Hopper
1.) Find the block (subroutine) Hopper
2.) Copy the start address of the block and set a breakpoint to it in lldb (e.g. 0x1000fa522)
(lldb) breakpoint s -a 0x1000fa522
3.) Once your application hits the breakpoint, you can now compare the assembly with the pseudo code in Hopper,
to find out where the a captured block variable is first captured.
var_30 = *___stack_chk_guard;
rax = [*(arg0 + 0x20)->_smimeLock retain];
@lukele
lukele / Hopper Disassembly and Pseudo-code.txt
Last active December 22, 2016 10:46
Disassembly and Pseudo-code differing
Hopper Dissassembly:
00000000000478a4 mov qword [rbp+var_58], rcx ; CODE XREF=-[MCMessageGenerator _newOutgoingMessageFromTopLevelMimePart:topLevelHeaders:withPartData:]+329
00000000000478a8 lea rax, qword [_MCHeaderKeyFrom]
00000000000478af mov rdx, qword [rax]
00000000000478b2 mov rdi, rbx ; argument "instance" for method _objc_msgSend
00000000000478b5 mov qword [rbp+var_88], rbx
00000000000478bc mov rsi, r14 ; argument "selector" for method _objc_msgSend
00000000000478bf call qword [_objc_msgSend_d85c0] ; _objc_msgSend
00000000000478c5 mov rdi, rax ; argument "instance" for method imp___stubs__objc_retainAutoreleasedReturnValue
@lukele
lukele / code.asm
Created January 16, 2017 22:18
appendDataForMimePart:toData:withPartData:
char -[MCMessageGenerator appendDataForMimePart:toData:withPartData:](void * self, void * _cmd, void * arg2, void * arg3, void * arg4) {
rsi = _cmd;
var_40 = self;
r15 = _objc_retain;
r12 = [arg2 retain];
var_48 = [arg3 retain];
r14 = [arg4 retain];
r15 = _objc_msgSend;
rbx = [[r14 objectForKey:r12] retain];
if ([rbx isKindOfClass:[MCMimePart class]] != 0x0) {
- (id)MAParsedMessage {
// This method is called, when a message is opened from outside the library (an .eml is loaded.)
id messageData = [((MCMessage *)self) messageDataIncludingFromSpace:0x0 newDocumentID:0x0 fetchIfNotAvailable:0x1];
id parsedMessage = nil;
if (messageData) {
MCMimePart *topLevelPart = [[MCMimePart alloc] initWithEncodedData:messageData];
MCMimeBody *body = [MCMimeBody new];
[body setIvar:kMimeBodyMessageKey value:self];
[topLevelPart setIvar:kMimePartAllowPGPProcessingKey value:@(YES)];
[topLevelPart setIvar:@"MimeBody" value:body];
@lukele
lukele / first-pseudo-code-optimized.m
Last active April 3, 2017 15:56
First Hopper code automatically "optimized"
void * -[MCMimePart _decodeAllowingAttachmentRepresentation: ](void * self, void * _cmd, char arg2) {
rsi = _cmd;
r14 = self;
r13 = _objc_msgSend;
r15 = 0x0;
var_30 = [self _isTypeCode: 0x1 subtypeCode: 0x0];
rbx = [r14 _isTypeCode: 0x7 subtypeCode: 0x8f];
if (arg2 == 0x0) {
// inserted procedure _73ca3
rax = [r14 typeCode];
@lukele
lukele / send-eml.py
Created June 15, 2017 20:34
Resend a .eml file (useful for testing message loading in Mail.app)
#!/usr/bin/env python
# -*- mode: python; coding: utf-8-unix -*-
import sys
import os.path
import smtplib
def remove_headers(raw_message, headers=[]):
message = []
i = 0
for line in raw_message: