Skip to content

Instantly share code, notes, and snippets.

View coconut49's full-sized avatar
🐰
Focusing

49 coconut49

🐰
Focusing
View GitHub Profile
@coconut49
coconut49 / immortalwrt-vm.sh
Last active March 3, 2026 08:07
One-click ImmortalWrt VM installer for Proxmox VE (based on community-scripts/ProxmoxVE)
#!/usr/bin/env bash
# Copyright (c) 2021-2026 tteck
# Author: tteck (tteckster)
# Jon Spriggs (jontheniceguy)
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Based on work from https://i12bretro.github.io/tutorials/0405.html
source /dev/stdin <<<$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
@coconut49
coconut49 / main.go
Created August 21, 2019 03:23
Golang SSL Pinning
package main
import (
"context"
"crypto/sha256"
"crypto/tls"
"crypto/x509"
"encoding/pem"
"errors"
"fmt"
@coconut49
coconut49 / SimpleHTTPServerWithUpload.py
Created September 9, 2018 09:54 — forked from UniIsland/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.
"""
@coconut49
coconut49 / 85-yubikey-screen-lock.rules
Last active November 4, 2017 18:19
a tiny script to auto lock and unlock gnome session
SUBSYSTEM=="usb", ACTION=="remove", ENV{ID_VENDOR_ID}=="1050", ENV{ID_MODEL_ID}="0407", RUN+="/usr/local/bin/yubikeylocker.sh"
SUBSYSTEM=="usb", ACTION=="add", ENV{ID_VENDOR_ID}=="1050", ENV{ID_MODEL_ID}=="0407", RUN+="/usr/local/bin/yubikeylocker.sh"
@coconut49
coconut49 / bird.conf
Created October 24, 2017 13:56
school ospf bird
router id 33.44.0.1;
protocol device {
scan time 10;
}
protocol kernel {
metric 64; # Use explicit kernel route metric to avoid collisions
# with non-BIRD routes in the kernel routing table
import none;
@coconut49
coconut49 / gpg-agent-forward.sh
Created May 15, 2017 07:10
Cygwin GPG Agent Forwarding Script (for use with Gpg4Win 3, requires openssh and ssh-pageant)
#!/bin/bash -e
remote="$1@$2"
echo -ne '\e]0;wait... '"$remote"'\a'
eval $(/usr/bin/ssh-pageant -r -a "/tmp/.ssh-pageant-$USERNAME")
localdir="$(cygpath -u "$APPDATA")/gnupg"
extrasock="$localdir/S.gpg-agent.extra" # file containing "PORT\nNONCE"
rdir='$HOME/.gnupg' # remote prefix
rinsock="$rdir/S.gpg-agent" # listen on this socket on server
@coconut49
coconut49 / timeout.py
Last active December 15, 2017 15:22
直接用,但不会抛异常,稳如狗
from contextlib import contextmanager
import signal
@contextmanager
def timeout(seconds=3):
class TimeoutError(Exception):
pass
def handler(*args,**kwargs):
print("[-] Timeout!")
raise TimeoutError
@coconut49
coconut49 / retry.py
Last active December 15, 2017 15:22
def ignore_error_and_retry(times=3):
def real_decorator(fn):
def warpper(*args, **kwargs):
try:
fn(*args, **kwargs)
except Exception as e:
print(str(e))
if not hasattr(warpper, "counter"):
warpper.counter = 1
else:
@coconut49
coconut49 / ipsecctl
Last active February 6, 2017 16:13 — forked from shankerwangmiao/ipsecctl
微小改动坏人 ipsecctl 使用 gretap 替代 ipip
#!/bin/bash
function load_var {
eval $(cat ${1} <( echo -e '\nset -o posix;set\n') | env - bash --noprofile --norc --posix | sed 's/^/'$2'_/')
if [ -n "$IF_IPSEC6" ]; then
PEER_ENDPOINT=$PEER_ENDPOINT6
SELF_ENDPOINT=$SELF_ENDPOINT6
fi
}
#!/bin/bash
function gen {
dd if=/dev/urandom bs=1 count=10000 2>/dev/null | tr -dc a-f0-9 | fold -w $1 | sed 's/^/0x/' | head -n 1
}
spi=`gen 8`
reqid=`gen 8`
auth_key=`gen 64`
enc_key=`gen 64`