Skip to content

Instantly share code, notes, and snippets.

@tehmoon
tehmoon / main.go
Created December 19, 2017 02:30
Download from s3 in a streaming fashion
package main
import (
"net/url"
"fmt"
"github.com/tehmoon/errors"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"github.com/aws/aws-sdk-go/service/s3"
"io"
@tehmoon
tehmoon / iptables-reload.sh
Last active January 13, 2024 09:21
IPtables and docker reload!
#!/bin/sh
set -e
## SEE https://medium.com/@ebuschini/iptables-and-docker-95e2496f0b45
## You need to add rules in DOCKER-BLOCK AND INPUT for traffic that does not go to a container.
## You only need to add one rule if the traffic goes to the container
CWD=$(cd "$(dirname "${0}")"; pwd -P)
FILE="${CWD}/$(basename "${0}")"
@tehmoon
tehmoon / example_without_logstash.md
Last active June 29, 2019 14:10
Gist for elasticsearch and jq arcticle

First we index the numbers from 1 to 10 using json_lines and cryptocli in a temporary index.

seq 1 10 | \
bash json_lines.sh number 1 2>/dev/null | \
./cryptocli \
  -- stdin \
  -- line \
  -- elasticsearch-put \
    --index number_messages \
@tehmoon
tehmoon / init.sh
Last active June 4, 2019 02:38
Kali default configuration
#!/bin/bash
set -e
mkdir -pv /opt/local/{share,tools,bin}
mkdir -pv /opt/local/share/wordlists
PATH=/opt/local/bin:${PATH}
echo "deb http://kali.download/kali kali-rolling main contrib non-free" > /etc/apt/sources.list
@tehmoon
tehmoon / XMind.md
Last active March 20, 2019 00:45
XMind notes

How to install xmind (on kali):

  • download the zip file from their website
  • apt install openjdk-8-jdk libwebkit2gtk-4.0
  • comment the libwebkitgtk-1.0-0 from the setup.sh script
  • run setup.sh as root
  • use java 8 and execute ./XMind_64/Xmind
@tehmoon
tehmoon / .torrc.client
Last active December 12, 2018 16:31
Tor
# Example for tor client to connect to onion service
HidServAuth <onion service> <auth from hostname>
DataDir ~/.tor
SocksPort 9050 # set the port of the proxy
@tehmoon
tehmoon / powershell.md
Last active November 14, 2018 17:19
Windows stuff

Run as:

powershell -ExecutionPolicy bypass Start-Process  .\log-exporter.exe, -Verb, RunAs, -ArgumentList "-u `"blih`""

Escape string + get current user:

$blih = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
@tehmoon
tehmoon / compiling_on_alpine.md
Last active September 9, 2018 17:57
Go stuff

This is specific to Alpine using the go apk.

Compiling go binaries in same arch:

go build -buildmode exe -ldflags '-linkmode external -extldflags "-static"' .

Compiling go binaries in other arch:

@tehmoon
tehmoon / .tmux.conf
Last active September 6, 2018 02:12
My kali setup script
unbind [
unbind p
bind Escape copy-mode
bind p paste-buffer
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "xclip -se c -i"
bind-key -Tcopy-mode-vi Escape send -X cancel
@tehmoon
tehmoon / git.md
Last active August 22, 2018 19:40
Git/github stuff

extract the whole forked branch from merge commit:

git log @~1..@^2

Get all the tags that contain the commit:

git tag --contain