Skip to content

Instantly share code, notes, and snippets.

View 0xquad's full-sized avatar

Alex Just Alex 0xquad

  • Synlabs Consulting Inc.
  • Montreal, Quebec, Canada
View GitHub Profile
@0xquad
0xquad / primez.py
Last active August 29, 2015 14:04
Simple way to calculate prime factors
#!/usr/bin/python3
#
# Copyright (c) 2014, Alexandre Hamelin <alexandre.hamelin gmail.com>
#
# Small program that calculates primes and print them on screen.
import sys
@0xquad
0xquad / em410x.py
Last active August 29, 2015 14:04
Simple Python class to interpret a raw bit stream as read from an EM410x RFID tag.
#!/usr/bin/env python3
class EM410x:
def __init__(self, bits):
assert len(bits) == 64
self.header = bits[:9]
self.nibbles = []
for i in range(9, 9 + 5 * 11, 5):
self.nibbles.append((bits[i:i+4], bits[i+4]))
@0xquad
0xquad / UnprivilegedContainersOnGentoo.md
Created June 2, 2015 08:53
Unprivileged LCX containers on Gentoo

Getting unprivileged LCX containers to work on Gentoo

So many references on the Internet describe how to setup unprivileged containers on Ubuntu, but I've found that it is astonishingly cryptic to get them to work on other Linux distros without knowing about LXC internals. In my case, my distro of choice is Gentoo, and here's how I managed to run my first unprivileged container. (Big thanks to Lord on #gentoofr for spending just a few minutes to find the reference I needed to get it working; it helped tremendously.)

The Gentoo Wiki helped, but was incomplete for some of the crucial steps, namely the following two requirements:

  • app-admin/cgmanager-0.37 or newer is necessary. It's not currently present in portage as of now (June 2nd 2015), so I had to use a local overlay to install it in a clean way. See below for a quick how-to.
  • A cgroup hierarchy is needed, but no online guide mentions how to create one. That's because on Ubuntu systemd is responsible for automatically managing it. Gentoo d
@0xquad
0xquad / chroot-esc.c
Last active December 19, 2022 02:10
chroot jail escape methods
/*
* Simple chroot jail escape
* Copyright (c) 2015, Alexandre Hamelin <alexandre.hamelin gmail.com>
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
@0xquad
0xquad / vbox-linux-guest-ipv6-workaround.md
Last active December 20, 2023 23:07
Fixing VirtualBox IPv6 connectivity on bridged wireless adapter (issue 5503)

Fixing VirtualBox IPv6 connectivity on bridged wireless adapter

VirtualBox has a [long standing issue][1] about IPv6 connectivity over a bridged wireless adapter.

The current and easiest workaround I've found is to remove the neighbor entry corresponding to the IPv6 router in the neighbor table. This is on in Linux guest on a Windows host.

$ ping6 icanhazip.com
PING icanhazip.com(2606:4700::6812:7361) 56 data bytes
^C
@0xquad
0xquad / cg.sh
Last active March 1, 2016 01:54
Script to allow the creation of user cgroups at login when no systemd is present
#!/bin/sh
#
# Simple script that uses the cgmanager client to create cgroups upon login
# for normal users so that they can use unprivileged LXC containers during
# their session. Meant to be executed at login time with a password-less
# sudo command like this:
#
# sudo /usr/local/bin/cg.sh create $$
#
# To be used on systems without systemd.
@0xquad
0xquad / gistcli.py
Last active March 3, 2016 04:01
Simple Gist command line tool
#!/usr/bin/env python3
#
# Simple Gist command line tool. Only support listing the user's gist for now.
#
# Copyright (c) 2015, Alexandre Hamelin <alexandre.hamelin gmail.com>
import requests
import json
import os
@0xquad
0xquad / lm-hashes-to-hashcat.py
Last active June 16, 2021 19:55
Script that converts a LM/NTLM hash dump from metasploit to oclhashcat/cudahashcat format for cracking
#!/usr/bin/env python
# Copyright (c) 2015, Alexandre Hamelin <alexandre.hamelin gmail.com>
# usage: $0 hashdump.txt > hashes-lm.txt
import sys
with open(sys.argv[1], 'r') as fp:
lines = fp.read().splitlines()
# Get all LM hashes (each halves of full LM hashes) and make a set of unique
@0xquad
0xquad / strip-jessie.sh
Last active November 23, 2015 17:20
Script to create a stripped down version of the Docker Debian image
#!/bin/sh
#
# Copyright (c) 2015, Alexandre Hamelin <alexandre.hamelin gmail.com>
# Released under the MIT LICENSE.
# Create a stripped down debian image.
docker pull debian
cid=$(docker run -dt debian)
docker exec $cid rm -fr /usr/share/doc /usr/share/man /usr/share/locale
<!DOCTYPE html>
<html>
<head>
<title>Testing Content-Security-Policy and X-Frame-Options</title>
</head>
<body>
<h1>Frame Test</h1>
<iframe src="#http://web-site-to-frame" width="80%" height="600">
<noframes>Unable to load the frame</noframes>