Skip to content

Instantly share code, notes, and snippets.

View monester's full-sized avatar
🎯
Focusing

Alexander Charykov monester

🎯
Focusing
  • Moscow
View GitHub Profile
import socket
import struct
import select
import sys
packet_id = 0
SERVERDATA_AUTH = 3
SERVERDATA_AUTH_RESPONSE = 2
@monester
monester / disassemble.md
Created April 26, 2020 09:24 — forked from jarun/disassemble.md
Guide to disassemble

prerequisites

  • Compile the program in gcc with debug symbols enabled (-g)
  • Do NOT strip the binary
  • To generate assembly code using gcc use the -S option: gcc -S hello.c

utilities

objdump

@monester
monester / kubeconfig-from-ssl.py
Last active March 18, 2020 08:59
Rancher recover access to kubernetes cluster from master nodes
#!/usr/bin/env python3
import os
import sys
import json
import base64
import tempfile
from subprocess import check_output, DEVNULL, run
#!/usr/bin/env python3
import os
import json
from subprocess import check_output, CalledProcessError
from configparser import ConfigParser
def kubectl(command, context=None, output=True):
context = f'--context={context}' if context else ''
#!/bin/sh
#===================================================================================
#
# FILE: dump.sh
# USAGE: dump.sh [-i interface] [tcpdump-parameters]
# DESCRIPTION: tcpdump on any interface and add the prefix [Interace:xy] in front of the dump data.
# OPTIONS: same as tcpdump
# REQUIREMENTS: tcpdump, sed, ifconfig, kill, awk, grep, posix regex matching
# BUGS: ---
# FIXED: - In 1.0 The parameter -w would not work without -i parameter as multiple tcpdumps are started.
# create service-principal
az ad sp create-for-rbac --query "{ client_id: appId, client_secret: password, tenant_id: tenant }"
cat >~/.azure/credentials <<EOF
# az ad sp create-for-rbac --query "{ client_id: appId, client_secret: password, tenant_id: tenant }"
[default]
# subscription
subscription_id=
# ruamel.yaml adds !!omap when using ordered dicts
# and there is no switch to avoid such behaviour
# Here is a workarond to put all keys in specific order
# and instead of following constuctions:
# list:
# - !!omap
# - [key1, value1]
# - [key2, value2]
# create this one:
# list:
@monester
monester / install-docker-ce-ubuntu.sh
Created June 10, 2018 13:01
install-docker-ce-ubuntu.sh
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
#!/bin/bash
set -x
set -e
if [[ $(id -u) != 0 ]]; then
sudo $(realpath $0) $@
exit
fi
#!/bin/sh
# usage: tailnew < /var/log/messages
awk 'BEGIN{getline l<"/tmp/tailnew"}(NR>l){print;l=NR}END{print l>"/tmp/tailnew"}'