Skip to content

Instantly share code, notes, and snippets.

View Arnie97's full-sized avatar

Arnie97

View GitHub Profile
@fqrouter
fqrouter / dns_hijacking_obversation.py
Last active September 4, 2019 10:22
让DNS查询经由python代码之手
from netfilterqueue import NetfilterQueue
import subprocess
import signal
def observe_dns_hijacking(nfqueue_element):
print('packet past through me')
nfqueue_element.accept()
nfqueue = NetfilterQueue()
nfqueue.bind(0, observe_dns_hijacking)
def clean_up(*args):
subprocess.call('iptables -D OUTPUT -p udp --dst 8.8.8.8 -j QUEUE', shell=True)
@fqrouter
fqrouter / dns_hijacking_obversation.py
Created January 13, 2013 14:15
打印DNS对话的内容
from netfilterqueue import NetfilterQueue
import subprocess
import signal
import dpkt
import traceback
import socket
def observe_dns_hijacking(nfqueue_element):
try:
ip_packet = dpkt.ip.IP(nfqueue_element.get_payload())
@fqrouter
fqrouter / dns_hijacking_locator.py
Last active June 18, 2024 08:08
结果的前三行已隐去
from netfilterqueue import NetfilterQueue
import subprocess
import signal
import dpkt
import traceback
import socket
import sys
DNS_IP = '8.8.8.8'
@ufologist
ufologist / get12306RemainTicket.js
Created January 17, 2013 08:06
获取12306余票信息
/**
* 获取12306余票信息
*
* 查询列车的余票信息
* GET https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=getQueueCount&train_date=2013-02-05&train_no=240000D31307&station=D313&from=VNP&to=SHH
*
* URL参数解析
* train_date // 不用说了吧
* train_no // 列车ID, 在余票查询结果车次的span中可以得到
* station // 车次
@drewolson
drewolson / reflection.go
Last active November 21, 2024 15:11
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
@Stanback
Stanback / nginx.conf
Last active August 21, 2025 07:32 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@ironpinguin
ironpinguin / FreeType2_Mono.c
Last active July 23, 2021 09:52
Simple example to use FreeType for get a monochrome text output rendering. build linux: gcc -g -o freeTypeDemo FreeType2_Mono.c -I/usr/include/freetype2 -L/usr/lib/x86_64-linux-gnu -lz -lfreetype -lm
/* First test with FreeType2 library */
/* Output to console of mono rendered font */
/*
* FreeType2_Mono.c
*
* Created by Michele Catalano <[email protected]>.
*
* Copyright (c) 2013 Michele Catalano
* All rights reserved.
*
@gear11
gear11 / main.py
Created December 17, 2013 14:54
Simple Python proxy server based on Flask and Requests. See: http:/python-proxy-server/gear11.com/2013/12/python-proxy-server/
"""
A simple proxy server. Usage:
http://hostname:port/p/(URL to be proxied, minus protocol)
For example:
http://localhost:8080/p/www.google.com
"""
@L422Y
L422Y / osx_automount_nfs.md
Last active September 6, 2025 03:43
Automounting NFS share in OS X into /Volumes

I have spent quite a bit of time figuring out automounts of NFS shares in OS X...

Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:

/etc/auto_master (see last line):

#
# Automounter master map
#

+auto_master # Use directory service

@nonakap
nonakap / dump_uart_crossbar_regs.cpp
Last active October 22, 2022 01:19
86Duino Sketch: Dump UART and CrossBar registers
/*
* vortex86ex internal pcidevs
* dev#0 func#0: NB0
* dev#0 func#1: NB1
* dev#1 func#0: PCI-E
* dev#7 func#0: SB0
* dev#7 func#1: SB1
*/
void