Skip to content

Instantly share code, notes, and snippets.

View jonaslejon's full-sized avatar
:octocat:
Working from home

Jonas Lejon jonaslejon

:octocat:
Working from home
View GitHub Profile
@peon-pasado-zeitnot
peon-pasado-zeitnot / gist:1242279
Created September 26, 2011 13:53
This D-trace script lists all run programs with their arguments - works with OSX
#!/usr/sbin/dtrace -C -s
#pragma D option quiet
proc::posix_spawn:exec-success,proc::__mac_execve:exec-success
{
this->isx64=(curproc->p_flag & P_LP64)!=0;
#define SELECT_64_86(x64, x86) (this->isx64 ? (x64) : (x86))
#define GET_POINTER(base, offset) (user_addr_t)SELECT_64_86(*(uint64_t*)((base)+sizeof(uint64_t)*(offset)), *(uint32_t*)((base)+sizeof(uint32_t)*(offset)))
@nyergler
nyergler / maildir2mbox.py
Created January 31, 2012 05:39
Convert maildirs (including subfolders) to mbox format
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Frédéric Grosshans, 19 January 2012
Nathan R. Yergler, 6 June 2010
This file does not contain sufficient creative expression to invoke
assertion of copyright. No warranty is expressed or implied; use at
your own risk.
@ecin
ecin / phantomjs_facebook.js
Created April 23, 2012 21:06
Log into Facebook with phantomJS
console.log("got here");
var page = require('webpage').create();
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.open("http://facebook.com", function(status) {
if ( status === "success" ) {
/*
* TGDFileHash.c
* TagAdA: Tagging Advanced Application
*
* Copyright © 2008-2010 The TagAdA Team. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@RobinDavid
RobinDavid / pydbg_firefox.py
Created February 25, 2014 17:39
Pydbg: sample to hook a firefox function to retrieve credentials (Gray Hat Python book)
'''
Example taken from Gray Hat Python (book)
This script present a way to hook a DLL library in Firefox. For this example the script hook nspr4.dll which encrypt datas for SSL connection.
So we will be able to get the text before it is encrypted. Moreover we catch a pattern "password" to get all login/password before they are ciphered.
'''
from pydbg import *
from pydbg.defines import *
import utils
@jonaslejon
jonaslejon / Mailgun PHP API with curl
Last active July 31, 2021 21:29
Send mail with Mailgun API version 2 and PHP. Should also work with version 3 of the Mailgun API
define("DOMAIN", "test.se");
define("MAILGUN_API", "XXX123"); // Mailgun Private API Key
function br2nl($string) {
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string);
}
function mg_send($to, $subject, $message) {
$ch = curl_init();
@jonaslejon
jonaslejon / tarsnap-install.sh
Last active February 3, 2017 06:46
Tarsnap install
#!/bin/sh
#
# Author: Jonas Lejon <jonas.gist@triop.se>
# 2014-05-30 For Ubuntu
#
# Usage:
# ./tarsnap-install.sh <tarsnap-email>
#
if [ -z "$1" ]
then
@grugq
grugq / gist:03167bed45e774551155
Last active April 6, 2024 10:12
operational pgp - draft

Operational PGP

This is a guide on how to email securely.

There are many guides on how to install and use PGP to encrypt email. This is not one of them. This is a guide on secure communication using email with PGP encryption. If you are not familiar with PGP, please read another guide first. If you are comfortable using PGP to encrypt and decrypt emails, this guide will raise your security to the next level.

@secretsquirrel
secretsquirrel / osx_infector.py
Last active March 31, 2021 19:33
From Shmoocon infection demo
import os
import struct
import shutil
import subprocess
class macho_intel32_shellcode():
"""
Mach-O Intel x32 shellcode class
"""
@ryancdotorg
ryancdotorg / rsabd.py
Last active March 13, 2023 15:57
backdoored rsa key generation
#!/usr/bin/env python
import sys
import gmpy
import curve25519
from struct import pack
from hashlib import sha256
from binascii import hexlify, unhexlify