Skip to content

Instantly share code, notes, and snippets.

View craSH's full-sized avatar

Ian Gallagher craSH

View GitHub Profile
@craSH
craSH / aes_ctr-chosen_plaintext.py
Created June 22, 2012 01:18
Simple chosen-plaintext attack on AES-CTR given NONCE and IV re-use for multiple ciphertexts. Basically just a OTP chosen-plaintext attack implementation.
#!/usr/bin/env python
"""
Simple chosen-plaintext attack on AES-CTR given NONCE and IV re-use for
multiple ciphertexts
Copyleft 2011 Ian Gallagher <crash@neg9.org>
"""
import sys
def decrypt(keystream, ciphertext):
@craSH
craSH / proxmox_lxc_install_latest_nvidia_drivers.sh
Last active January 4, 2025 01:49
Install the latest NVIDIA drivers on a Proxmox host and LXC container with a GPU configured for passthrough.
#!/bin/bash
#
# This script installs the latest NVIDIA drivers on a Proxmox host
# and LXC container guests (Debian based) with a card passed through to them.
#
# It essentially automates the repeatable steps from this guide for re-running after kernel upgrades
# https://forums.plex.tv/t/plex-hw-acceleration-in-lxc-container-anyone-with-success/219289/35
# It automatically grabs the latest version of the driver from: https://github.com/keylase/nvidia-patch
#
# This other script exists that appears to do the same thing, perhaps in a more clever way for the LXC container,
@craSH
craSH / bulletproof_arch.md
Last active September 28, 2024 10:22 — forked from altercation/bulletproof_arch.txt
Bulletproof Arch - Minimal Clean Install

Bulletproof Arch

These are working notes on the installation of Arch Linux. I've just completed this install on a notebook (@altercation: Lenovo P50. @craSH: Dell XPS 13" 9380) but the setup should work for most laptop/desktop configurations.

Some assumptions/notes:

  1. This isn't a dual boot configuration. I can see some of the appeal and still work in Adobe from time to time, but given the increasing complexity of EFI and the way Windows/MS manhandles the EFI partition during upgrades, I really would recommend steering clear of dual boot. Just my two cents here.
@craSH
craSH / Password.java
Last active June 12, 2024 05:13
A simple example Java class to safely generate and verify bcrypt password hashes for use in authentication systems.
/**
* Author: Ian Gallagher <igallagher@securityinnovation.com>
*
* This code utilizes jBCrypt, which you need installed to use.
* jBCrypt: http://www.mindrot.org/projects/jBCrypt/
*/
public class Password {
// Define the BCrypt workload to use when generating password hashes. 10-31 is a valid value.
private static int workload = 12;
@craSH
craSH / sdr-monitor.ps1
Last active May 9, 2024 22:14
PowerShell script that starts specified applications if they are not currently running. Useful in conjuncftion with Windows Event Log triggered Scheduled Tasks to provide a simple process supervisor system.
# Use this as the "Start Program" Action for an "On an event -> Log - > Application -> Application Error" Scheduled Task
# To automatically restart applications in the $monitored_apps hash if they crash (and the crash is reported in the event log)
#
# Setup scheduled task like documented @ https://www.reddit.com/r/windows/comments/4td55w/comment/d5gldsj/,
# except don't bother with Step 7 (keyword filtering) as it doesn't work as written there.
# Instead, delegate all process filtering to this script in the $monitored_apps hash below.
#
# Copyleft Ian Gallagher <crash@neg9.org>
# Applications to monitor and start if they are found to not be running (hash of Process fields Name and Path)
@craSH
craSH / pet-snippet.toml
Last active July 3, 2023 03:09
description
[[snippets]]
description = "pacman - show files owned by installed package"
command = "pacman -Ql <package>"
tag = ["arch", "package", "sysadmin"]
output = ""
[[snippets]]
description = "pacman - remove orphan packages"
command = "pacman -Qtdq | sudo pacman -Rns -"
tag = ["arch", "package", "sysadmin"]
@craSH
craSH / upgradebrews
Created June 17, 2010 02:50
upgrade brews a-la 'apt-get dist-upgrade'
#!/bin/bash
#
# Very simple script that updates your brew formula repo and
# then upgrades all installed and outdated formulae
# Run with -y to upgrade formulae automatically
#
# Update the repo
brew update
@craSH
craSH / har_response_urls.py
Created March 29, 2011 14:49
Parse a HAR (HTTP Archive) and return URLs which resulted in a given HTTP response code
#!/usr/bin/env python
"""
Parse a HAR (HTTP Archive) and return URLs which resulted in a given HTTP response code
HAR Spec: http://groups.google.com/group/http-archive-specification/web/har-1-2-spec
Copyleft 2010 Ian Gallagher <crash@neg9.org>
Example usage: ./har_response_urls.py foo.har 404
"""
import json
@craSH
craSH / windows_prefetch_paths.py
Created May 7, 2010 07:05
Given a path to a Windows Prefetch file, extract and print a list of all file paths that it contains (which will be prefetched)
import struct
def get_file_paths(pf_file):
"""
Given a path to a Windows Prefetch file, extract and return a list of all file
paths that it contains (which will be prefetched)
References:
- http://en.wikipedia.org/wiki/Prefetcher
- http://msdn.microsoft.com/en-us/magazine/cc302206.aspx
@craSH
craSH / gpg_bruteforce.py
Created May 24, 2011 20:09
Determine password for a PGP private key based on a wordlist.
#!/usr/bin/env python
"""
Determine password for a PGP private key based on a wordlist.
Also performs permutations on passwords in the case of l33tsp3ak, etc.
Requires python-gnupg (easy_install/pip install python-gnupg)
To quiet down some of the exceptions during signing attempts, the following
"patch" is needed within gnupg.py: