Skip to content

Instantly share code, notes, and snippets.

View pythonwood's full-sized avatar

pythonwood pythonwood

View GitHub Profile
@mboersma
mboersma / yaml2json
Last active July 31, 2023 12:34
YAML to JSON one-liner
python3 -c 'import sys, yaml, json; y=yaml.safe_load(sys.stdin.read()); print(json.dumps(y))'
@flaviovdf
flaviovdf / gist:4174938
Created November 30, 2012 10:12
http headers tshark
sudo tshark -i eth0 -f 'port 80 or 443' -R 'http.host matches ".*?youtube\.com.*"' -S -V -l -T fields -e ip.src -e ip.src_host -e ip.dst -e ip.dst_host -e http.accept -e http.accept_encoding -e http.accept_language -e http.authbasic -e http.authorization -e http.cache_control -e http.connection -e http.content_encoding -e http.content_length -e http.content_length_header -e http.content_type -e http.cookie -e http.date -e http.host -e http.last_modified -e http.location -e http.notification -e http.proxy_authenticate -e http.proxy_authorization -e http.proxy_connect_host -e http.proxy_connect_port -e http.referer -e http.request -e http.request.full_uri -e http.request.method -e http.request.uri -e http.request.version -e http.response -e http.response.code -e http.response.phrase -e http.sec_websocket_accept -e http.sec_websocket_extensions -e http.sec_websocket_key -e http.sec_websocket_protocol -e http.sec_websocket_version -e http.server -e http.set_cookie -e http.transfer_encoding -e http.upgrade -e http
@brandon15811
brandon15811 / android-tcpdump.sh
Created April 16, 2014 03:55
Script for easy tcpdump to wireshark on android
#!/bin/bash -xe
nc_running()
{
NC_RUN=$(adb shell busybox ps -w | grep "NCRUN='1'" > /dev/null 2>&1; echo $?)
}
tcpdump_running()
{
TCP_RUN=$(adb shell busybox ps -w | grep -v "NCRUN='1'" | grep 'TCPRUN="1"' > /dev/null 2>&1; echo $?)
}
@phryneas
phryneas / shellscan.sh
Last active January 14, 2016 11:00
quick web shell scan
#!/usr/bin/zsh
#improvements are greatly welcome:
terms=( )
terms=( $terms "exec" )
terms=( $terms "eval" )
terms=( $terms "passthru" )
terms=( $terms "shell_exec" )
terms=( $terms "system" )
terms=( $terms "pcntl_exec" )
@gotnix
gotnix / qemu_bridge-nat.txt
Created August 5, 2015 05:47
qemu 的网络桥接和NAT
chaos 的 qemu 技巧 (一) 网络桥接
http://ycool.com/post/sgeq9sf
原始的linux网络桥接 brctl 是很不错的技术,可以将虚拟机的网络和物理网络完好的桥接起来,
但是这个方法在服务器上应该是好的,然而,在桌面环境中,却会遇到一个大问题:
桥接设备如br0 不能跟network manager之类良好兼容,而且桌面机更多时候会跑wifi,这个brctl就更苦了。
所以,经过详细研究,现整理出一套用parprouted + vdeswitch + dhcp-helper +qemu的解决方案。
本方案中,出了 vde_tunctl , parprouted , dhcp-helper几个命令必须有root权限,其他任何步骤不需要root权限,
而且,在虚拟机里面也不会看到发到host machine的数据,基本上来说,安全模型还是比较清晰的。
@GaryLee
GaryLee / hook-openpyxl.py
Created November 30, 2015 06:44
Fix ".constants.json" not found issue when using Pyinstaller to pack openpyxl.
# When you're encountering following error.
# > IOError: [Errno 2] No such file or directory: 'C:\\Users\\username\\AppData\\Local\\Temp\\_MEI502322\\openpyxl\\.constants.json'
#
# This solution tested under Python 2.7.10 and Pyinstaller 3.0.
#
# Put this file to your script folder.
# Add this hook to your distribution by
# > pyinstaller --onefile --additional-hooks-dir=. yourscript.py
#
from PyInstaller.utils.hooks import collect_data_files
@BretFisher
BretFisher / docker-for-mac.md
Last active March 31, 2025 10:12
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@karlvr
karlvr / 00README.md
Last active December 12, 2024 19:09
Roadwarrior configuration for macOS 10.12, iOS 10 and Windows 10 using strongSwan and user certificates

strongSwan setup for Road Warriors on macOS 10.12, iOS 10 and Windows 10

This setup is for remote users to connect into an office/home LAN using a VPN (ipsec). This is based on (but not the same as) the strongSwan documentation and this guide: https://raymii.org/s/tutorials/IPSEC_vpn_with_Ubuntu_16.04.html

I used strongSwan 5.5.1.

apt-get install -y strongswan strongswan-pki
@rewida17
rewida17 / termux
Last active March 20, 2025 10:27
Run termux env via eg adb shell
#!/system/xbin/bash
#Based on https://github.com/termux/termux-app/issues/77
export PREFIX='/data/data/com.termux/files/usr'
export HOME='/data/data/com.termux/files/home'
export LD_LIBRARY_PATH='/data/data/com.termux/files/usr/lib'
export PATH="/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:$PATH"
export LANG='en_US.UTF-8'
export SHELL='/data/data/com.termux/files/usr/bin/bash'
export BIN='/data/data/com.termux/files/usr/bin'
export TERM=vt220
@islishude
islishude / k8s-install.md
Last active March 17, 2025 07:00
k8s-国内源安装

MOVE TO HERE

注意以下命令,需要切换到 root 后运行

安装 docker

首先确定已经安装完成 docker,如果没有安装可以使用以下脚本快速安装并配置: