Skip to content

Instantly share code, notes, and snippets.

@alex-bender
alex-bender / README.md
Created November 22, 2017 15:54 — forked from danriti/README.md
Line Profiling in Python

Install the line_profiler module:

[driti@ubuntu ]$ pip install line_profiler

Add the @profile decorator and run:

[driti@ubuntu ]$ kernprof.py -l -v example.py
@alex-bender
alex-bender / infosec_newbie.md
Created November 16, 2017 20:38 — forked from mubix/infosec_newbie.md
How to start in Infosec
@alex-bender
alex-bender / TrueColour.md
Created September 4, 2017 16:39 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Colours in terminal

It's a common confusion about terminal colours... Actually we have this:

  • plain ascii
  • ansi escape codes (16 colour codes with bold/italic and background)
  • 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit)
  • 24bit true colour ("888" colours (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"
@alex-bender
alex-bender / SimpleHTTPServerWithUpload.py
Created July 31, 2017 07:06 — forked from zhangxiaoyang/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@alex-bender
alex-bender / sshpass.py
Created July 31, 2017 07:01 — forked from virtuald/sshpass.py
Simple python wrapper to give SSH a password for automation purposes (with output capture)
#!/usr/bin/env python3
import os
import sys
_b = sys.version_info[0] < 3 and (lambda x:x) or (lambda x:x.encode('utf-8'))
def ssh_exec_pass(password, args, capture_output=False):
'''
Wrapper around openssh that allows you to send a password to
@alex-bender
alex-bender / get_image_manifest.sh
Last active April 1, 2021 14:17
Docker Registry v2 get manifest and push\pull
#!/bin/bash
#
# Shell scripts for get image manifest from v2 registry
#
# Tested on Debian 8, curl 7.38.0, jq-1.5
#
set -e -u
# Default tag is latest
@alex-bender
alex-bender / hastebin.sh
Created October 13, 2016 10:58 — forked from flores/hastebin.sh
hastebin shell client
#!/bin/bash
server='hastebin.com';
usage="$0 pastes into $server
usage: $0 something
example: '$0 pie' or 'ps aufx |$0'"
if [ -z $1 ]; then
str=`cat /dev/stdin`;
@alex-bender
alex-bender / kvm
Created October 5, 2016 14:34 — forked from leberus/kvm
# aptitude install qemu-kvm libvirt-bin
# create a bridge with your current interface
auto eth1
iface eth1 inet manual
auto br0
iface br0 inet dhcp
bridge_ports eth1
@alex-bender
alex-bender / gist:fd65ae11a66c1388b93a0d3cd392a322
Created May 8, 2016 16:41 — forked from rygorous/gist:e0f055bfb74e3d5f0af20690759de5a7
A bit of background on compilers exploiting signed overflow
Why do compilers even bother with exploiting undefinedness signed overflow? And what are those
mysterious cases where it helps?
A lot of people (myself included) are against transforms that aggressively exploit undefined behavior, but
I think it's useful to know what compiler writers are accomplishing by this.
TL;DR: C doesn't work very well if int!=register width, but (for backwards compat) int is 32-bit on all
major 64-bit targets, and this causes quite hairy problems for code generation and optimization in some
fairly common cases. The signed overflow UB exploitation is an attempt to work around this.