Skip to content

Instantly share code, notes, and snippets.

@hzshang
hzshang / socks5pipe.go
Created April 25, 2023 05:33
A socks5 wrapper without authentication
package main
import (
"log"
"os"
"context"
"github.com/things-go/go-socks5"
"golang.org/x/net/proxy"
"flag"
"net"
[SwitchyOmega Conditions]
; Require: SwitchyOmega >= 2.3.2
; cn域名都不走代理
*.cn
*.0daydown.com
qemu-system-mipsel -kernel kernel -hda rootfs.ext2 \
-append 'root=/dev/hda console=ttyS0 rw physmap.enabled=0 noapic' \
-net nic -net tap,ifname=tap0,script=no,downscript=no \
-m 256M -nographic -serial stdio -monitor null \
-no-reboot
@hzshang
hzshang / gist:b7b33f057313b5319aa788e9d96fe566
Created February 28, 2019 02:32 — forked from chrisdone/gist:02e165a0004be33734ac2334f215380e
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

insert into ctfd.users (id,name,email,password,created)
select id,name,email,password,joined from bak.teams;
update ctfd.users set type = "user",bracket = NULL,hidden=0,verified=0,banned=0;
insert into ctfd.challenges(id,name,description,max_attempts,value,category,type,state)
select id,name,description,max_attempts,value,category,"dynamic","visible" from bak.challenges;
insert into dynamic_challenge (id,initial,minimum,decay)
select id,value,value/10,15 from ctfd.challenges;
$ mkdir rootfs
$ mv rootfs.cpio ./rootfs/rootfs.cpio.gz
$ cd rootfs
$ gunzip rootfs.cpio.gz
$ cpio -idmv < rootfs.cpio
$ rm -rf rootfs.cpio
@hzshang
hzshang / example.py
Last active February 28, 2019 03:18
how to use pwntools
from pwn import *
#启用调试模式,会将以后的交互信息打印出来
context.log_level="debug"
# 连接
# 和127.0.0.1的9999端口建立tcp连接
r=remote("127.0.0.1",9999)
# 运行一个可执行程序,方便本地调试
from pwn import *
_IO_FILE_plus_size = {
'i386':0x98,
'amd64':0xe0
}
_IO_FILE_plus = {
'i386':{
0x0:'_flags',
0x4:'_IO_read_ptr',
0x8:'_IO_read_end',
def extend_gcd(a,b):
if b==0:
return a,1,0
else:
g,s,t=extend_gcd(b,a%b)
return g,t,s-a/b*t
def reverse(a,N):
return extend_gcd(a,N)[1]
#include "br-tree.h"
#include <stdlib.h>
int cmp(KEY_TYPE a, KEY_TYPE b) {
return a < b;
}
void init_tree(BR_Tree* tree) {
tree->end = (Node)malloc(sizeof(struct _Node));
tree->end->color = BLACK;