Skip to content

Instantly share code, notes, and snippets.

@crashish
crashish / golden_globes.py
Created January 22, 2018 07:51
golden globes best comedy/best director overlap
# twitter + insomnia + curiosity = crappy python code
# https://twitter.com/criznash/status/950268556544942080
import requests
import bs4
comedy = "https://en.wikipedia.org/wiki/Golden_Globe_Award_for_Best_Motion_Picture_%E2%80%93_Musical_or_Comedy"
director = "https://en.wikipedia.org/wiki/Golden_Globe_Award_for_Best_Director"
d = requests.get(comedy)
dpkg -l 'linux-*' | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | grep -E "(image|headers)"|xargs sudo dpkg -P
@crashish
crashish / ranbyus-decoder.py
Created June 24, 2014 20:09
A quick and dirty script to parse a PCAP file and decode Ranbyus C&C communications
#!/usr/bin/env python
import dpkt, sys
def b64decode(string,alphabet):
string = string.replace("=","")
ret = ""
left = 0
for i in range(0, len(string)):
if left == 0:
@crashish
crashish / base64decode.py
Last active September 19, 2022 19:02
A simple implementation of a base64 decoder that supports alternative alphabets
def b64decode(string,alphabet):
string = string.replace("=","")
ret = ""
left = 0
for i in range(0, len(string)):
if left == 0:
left = 6
else:
value1 = alphabet.index(string[i - 1]) & (2 ** left - 1)
value2 = alphabet.index(string[i]) >> (left - 2)
import textwrap, re, urllib
parse_sig = re.compile(
'\[(.*?)\]\s+?signature\s*=\s*(.*?)(\s+\?\?)*\s*ep_only\s*=\s*(\w+)(?:\s*section_start_only\s*=\s*(\w+)|)', re.S)
sig_f = urllib.urlopen('userdb.txt')
sig_data = sig_f.read()
sig_f.close()
sigs = parse_sig.findall(sig_data)
for packer_name, signature, superfluous_wildcards, ep_only, section_start_only in sigs:
print packer_name