Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.
####1. anchor file
Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:
| package me.madeye; | |
| import java.lang.reflect.Constructor; | |
| import java.lang.reflect.Field; | |
| import java.lang.reflect.InvocationTargetException; | |
| import java.lang.reflect.Method; | |
| import org.apache.http.HttpHost; | |
| import android.content.Context; |
| #include <sys/socket.h> | |
| #include <netinet/in.h> | |
| #include <iostream> | |
| #include <string.h> | |
| int main() | |
| { | |
| // -------------------------------------------- | |
| struct sockaddr_in addr; |
| func urlencode(s string) (result string){ | |
| for _, c := range(s) { | |
| if c <= 0x7f { // single byte | |
| result += fmt.Sprintf("%%%X", c) | |
| } else if c > 0x1fffff {// quaternary byte | |
| result += fmt.Sprintf("%%%X%%%X%%%X%%%X", | |
| 0xf0 + ((c & 0x1c0000) >> 18), | |
| 0x80 + ((c & 0x3f000) >> 12), | |
| 0x80 + ((c & 0xfc0) >> 6), | |
| 0x80 + (c & 0x3f), |
| #!/usr/bin/env python | |
| __copyright__ = 'Yuanxuan Wang <zellux at gmail dot com>' | |
| from calibre.web.feeds.news import BasicNewsRecipe | |
| from calibre.ebooks.BeautifulSoup import Tag, NavigableString | |
| from collections import OrderedDict | |
| from contextlib import nested, closing | |
| import json |
| #=============================================================================== | |
| # Filename: boost.sh | |
| # Author: Pete Goodliffe | |
| # Copyright: (c) Copyright 2009 Pete Goodliffe | |
| # Licence: Please feel free to use this, with attribution | |
| # Modified version | |
| #=============================================================================== | |
| # | |
| # Builds a Boost framework for the iPhone. | |
| # Creates a set of universal libraries that can be used on an iPhone and in the |
| #=============================================================================== | |
| # Filename: boost.sh | |
| # Author: Pete Goodliffe | |
| # Copyright: (c) Copyright 2009 Pete Goodliffe | |
| # Licence: Please feel free to use this, with attribution | |
| # Modified version | |
| #=============================================================================== | |
| # | |
| # Builds a Boost framework for iOS, iOS Simulator, and OSX. | |
| # Creates a set of universal libraries that can be used on an iOS and in the |
由于路由管控系统的建立,实时动态黑洞路由已成为最有效的封锁手段,TCP连接重置和DNS污染成为次要手段,利用漏洞的穿墙方法已不再具有普遍意义。对此应对方法是多样化协议的VPN来抵抗识别。这里介绍一种太简单、有时很朴素的“穷人VPN”。
朴素VPN只需要一次内核配置(Linux内核),即可永久稳定运行,不需要任何用户态守护进程。所有流量转换和加密全部由内核完成,原生性能,开销几乎没有。静态配置,避免动态握手和参数协商产生指纹特征导致被识别。并且支持NAT,移动的内网用户可以使用此方法。支持广泛,基于L2TPv3标准,Linux内核3.2+都有支持,其他操作系统原则上也能支持。但有两个局限:需要root权限;一个隧道只支持一个用户。
朴素VPN利用UDP封装的静态L2TP隧道实现VPN,内核XFRM实现静态IPsec。实际上IP-in-IP隧道即可实现VPN,但是这种协议无法穿越NAT,因此必须利用UDP封装。内核3.18将支持Foo-over-UDP,在UDP里面直接封装IP,与静态的L2TP-over-UDP很类似。
| // A small SSH daemon providing bash sessions | |
| // | |
| // Server: | |
| // cd my/new/dir/ | |
| // #generate server keypair | |
| // ssh-keygen -t rsa | |
| // go get -v . | |
| // go run sshd.go | |
| // | |
| // Client: |