Skip to content

Instantly share code, notes, and snippets.

@friedbutter
friedbutter / gist:593e4bf1c88ee2612c99
Created November 20, 2015 01:35 — forked from jjo-sec/gist:0ead6f9a9f91e420f7c8
PE icon extraction using pefile
"""
extracts the first 18 bytes of the icon header from RT_GROUP_ICON data,
appends with a dword value 22 to signify the offset
and then appends the raw icon data from RT_ICON
"""
def extract_icon(pe):
"""
pe is a pefile object
"""
rt_string_idx = [entry.id for entry in pe.DIRECTORY_ENTRY_RESOURCE.entries].index(pefile.RESOURCE_TYPE['RT_GROUP_ICON'])
@friedbutter
friedbutter / gist:0b03932fad8e5ce39773
Created October 7, 2015 20:42 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@friedbutter
friedbutter / extract_domains_in_pcap.sh
Last active February 23, 2024 12:12
extract domains in a pcap
#!/bin/bash
# usage program.sh <filename.pcap>
tshark -r "$1" -T fields -e ip.src -e dns.qry.name -2R "dns.flags.response eq 0" | awk -F" " '{ print $2 }' | sort -u
@friedbutter
friedbutter / loop_dates.sh
Last active August 29, 2015 14:16
Loop echo dates between two dates
#!/bin/bash
now=`date +"%Y-%m-%d" -d "$1"`
end=`date +"%Y-%m-%d" -d "$2"`
while [ "$now" != "$end" ] ;
do
now=`date +"%Y-%m-%d" -d "$now + 1 day"`;
next=`date +"%Y-%m-%d" -d "$now + 1 day"`;
echo "$now to $next"
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
#
# Modified slightly by Andreas Thienemann <athienemann@schubergphilis.com> for clearer exploit code
# and 64k reads
#
# This version of the exploit does write received data to a file called "dump" in the local directory
# for analysis.
@friedbutter
friedbutter / libdnet_python.rb
Created March 20, 2014 05:19 — forked from benhagen/libdnet_python.rb
For installing scapy on mac osx
require 'formula'
class LibdnetPython <Formula
depends_on 'libdnet'
url 'http://libdnet.googlecode.com/files/libdnet-1.12.tgz'
homepage 'http://code.google.com/p/libdnet/'
sha1 '71302be302e84fc19b559e811951b5d600d976f8'
def install
ENV["CFLAGS"] = "-O3 -w -pipe"
{
"auto_complete": false,
"caret_style": "solid",
// osx
// "color_scheme": "Packages/User/Solarized (Dark) (SL).tmTheme",
// linux
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme",
"detect_indentation": false,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
# ipython alias
alias p=`which ipython`
# ssh alias
alias ssh-x='ssh -c arcfour,blowfish-cbc -XC'
# sshfs unmount
alias usshfs='fusermount -u'
# sudo reboot
@friedbutter
friedbutter / install_zsh.sh
Last active August 29, 2015 13:57
Install oh-my-zsh and additional zsh settings
#!/bin/sh
# Install oh-my-zsh
git clone git://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh
cp $HOME/.zshrc $HOME/.zshrc.orig.`date "+%y%m%d-%H%M"`
cp $HOME/.oh-my-zsh/templates/zshrc.zsh-template $HOME/.zshrc
cat custom_zshrc >> $HOME/.zshrc
chsh -s /bin/zsh
# Install powerline fonts
# Original author spicycode/tmux.conf
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi