Skip to content

Instantly share code, notes, and snippets.

View am009's full-sized avatar

am009 am009

  • Huazhong University of Science and Technology
  • Wuhan, China
  • 12:48 (UTC +08:00)
View GitHub Profile
@am009
am009 / DLL_Injector.cpp
Created December 6, 2021 12:44
Process hide by injecting to taskmgr.exe (Task Manager)
#include <Windows.h>
#include <iostream>
#include <TlHelp32.h>
#include <string>
WCHAR module_path[MAX_PATH + 1];
// case insensitive
DWORD GetPIDByName(LPCWSTR name)
{
@am009
am009 / wasm_instruction_offset_printer.py
Last active January 28, 2022 05:43
Print instruction offset(definition at DWARF for WebAssembly https://yurydelendik.github.io/webassembly-dwarf/) within a webassembly module(a .wasm file). Based on https://github.com/mohanson/pywasm/blob/master/pywasm/binary.py
import io
import typing
# from . import convention
class convention:
pass
convention.i32 = 0x7f
convention.i64 = 0x7e
convention.f32 = 0x7d
@am009
am009 / queue_log.py
Created May 28, 2023 15:20
multiprocessing download, log to one file.
from multiprocessing import Pool, Manager
import os
import subprocess
import pickle
import signal
def big_query_info_analysis(arg):
res_list, result_queue = arg
for res in res_list:
key, value = do_something()
PROGRESS_FILENAME = f"{BRAND}.progress"
# 全局状态,通过pickel实现持久化
GLOBAL_STATE = {
'progress': set(), # filenames that finished analyzing
'stats': dict() # 从文件名映射到一个Tuple,依次是分析时间,返回值
}
def set_exc_hook(path):
import sys
def my_except_hook(exctype, value, traceback):
@am009
am009 / frpc.service
Last active October 13, 2024 13:22
Systemd service template that always restart when fails. Set StartLimitIntervalSec=0 to disable any rate limit. Add RestartSec=5 to restart after 5s if failure instead of 100ms (default value).
# /etc/systemd/system/frpc.service
[Unit]
# 服务名称,可自定义
Description = frp client
After = network.target syslog.target
Wants = network.target
StartLimitIntervalSec=0
[Service]
Type = simple
@am009
am009 / createAliases.sh
Created January 7, 2025 07:37 — forked from tokatoka/createAliases.sh
This scripts creates symlinks for llvm/clang tools so that their version number is removed from executables.
#!/bin/bash
# creates a symbolic link from bin-x.x to bin
# This just strips off last 3 characters when creating a link
LLVMFILES=/usr/bin/llvm*
CLANGFILES=/usr/bin/clang*
LLC=/usr/bin/llc-17
OPT=/usr/bin/opt-17
LLD=/usr/bin/lld-17
@am009
am009 / convertDict.py
Last active April 4, 2025 02:43
Convert exported honggfuzz feedback dict to AFL++ dict format
import struct
import sys
def parse_hex_data(file_path):
entries = []
try:
with open(file_path, 'rb') as f:
data = f.read()
if len(data) < 4:
@am009
am009 / dpull.sh
Last active May 16, 2025 13:06
docker pull using proxy. (Use skopeo)
#!/bin/bash
export HTTP_PROXY=http://10.12.190.56:8010
export HTTPS_PROXY=http://10.12.190.56:8010
if [ $# -ne 1 ]; then
echo "用法: $0 <image_name[:tag]>"
exit 1
fi
@am009
am009 / wrap-https.sh
Last active May 16, 2025 17:25
Wrap a http port to an https port. Simple reverse proxy and will change Host header. Simple bash script. Using https://github.com/go-gost/gost.
#!/bin/bash
cd /tmp
# argument 1 local url
# argument 2 port
if [ -z "$1" ]; then
echo "Please give the script first argument: IP:port to the http site. Do not add http:// prefix. For example: ./wrap-https.sh 127.0.0.1:7865 5002"
exit -1
fi
@am009
am009 / wait-docker.sh
Created August 11, 2025 02:56
Wait till all docker containers are stopped.
#!/bin/bash
set -e
# 每3分钟循环检测
while true; do
running_containers=$(docker ps -q) # 获取所有正在运行的容器ID
if [ -z "$running_containers" ]; then
echo "没有正在运行的容器,跳出循环"