在 Python 用scapy 实作西厢计划的可行性

100 views
Skip to first unread message

cheshirecat

unread,
Mar 27, 2010, 1:31:13 AM3/27/10
to scholarzhang-dev
以我理解,西厢计划( zhang 模组)的原理是接收到伺服器端的 SYN/ACK 封包后返回两个定制的封包,而用user space 的
libpcap 已经足够达到这个目的。我知道西厢计划之前也是 user space 的,后来才改成 kernel extension,所以我想
了解用 netfilter 的kernel extension 除了效能上的优势外,有没有其他技术上的须要?

user space 程序在部署、开发和移植上都方便得多,也易于加入新功能。本著学习的情神,我用 Python 上的 Twisted 和
scapy 写了一个简单的西厢 HTTP proxy。用普通的 browser 指向这个 proxy 就可以模仿 zhang 模组的作用,而又
不影响系统的其他连接。因为 Twisted 和 scapy 都是跨平台的,应该不用移植就可以在 linux、mac 和 windows 上使
用。往后只要用 scapy 实作低阶的 DNS client来解除 DNS 污染,就成了完整的翻墙 proxy。

不过我身在墙外,没有方法确认它的功能,只能用 wireshark 观察封包传送,所以我不知道这种做法实际上可行否。希望和大家探讨一下用
Python 实作西厢计划的可行性。

源码我已放在 Google Groups 的文件夹

崔莺莺

unread,
Mar 27, 2010, 5:43:31 AM3/27/10
to scholarz...@googlegroups.com
在 2010年3月27日 下午1:31,cheshirecat <chesh...@riseup.net> 写道:
> 了解用 netfilter 的kernel extension 除了效能上的优势外,有没有其他技术上的须要?

伪造的包如果发出的比真实的包完,就失败了。

Stony

unread,
Mar 27, 2010, 6:17:06 AM3/27/10
to scholarz...@googlegroups.com
按照我的理解,用proxy的形式实现有意义的,因为可以放在出口的机器上,而客户端本身不需要再安装zhang模块。

--
Stony Wang
Software Design Engineer in Test

2010/3/27 cheshirecat <chesh...@riseup.net>:

> --
> You received this message because you are subscribed to "scholarzhang-dev".
> To post to this group, send email to scholarz...@googlegroups.com
> To unsubscribe from this group, send email to
> scholarzhang-d...@googlegroups.com
>
> To unsubscribe from this group, send email to scholarzhang-dev+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
>

崔莺莺

unread,
Mar 27, 2010, 11:07:12 AM3/27/10
to scholarz...@googlegroups.com
对大家的二次是鼓励的,只是我最近没有闲暇看代码,就仅对原理上面的问题作回答了。

在 2010年3月27日 下午6:17,Stony <sto...@gmail.com> 写道:
> 按照我的理解,用proxy的形式实现有意义的,因为可以放在出口的机器上,而客户端本身不需要再安装zhang模块。
客户端本身不要装zhang,这不就是cui的功能么,怎么大家都只看见了zhang没有看见cui。

cheshirecat

unread,
Mar 28, 2010, 8:25:49 AM3/28/10
to scholarzhang-dev
我没理解错的话cui 是安装在伺服器端让墙内的人可以免去 keyword filter吧,这工具对服务提供者会很有用,不过这样一来只能等伺服器
自愿安装,要待常去的网站都安装 cui 也不是短期内可以实行的。如果是proxy 形式我想有几点好处:1. 易于开发 2. 安装在一部电脑就可
以让不同subnet的其他人翻墙(如朋友) 3. 不影响没有用 proxy 的程序 4. 不影响系统稳定性 5. 方便整合其他翻墙工具,甚至是
自动选取合适的工具

技术上的问题我是明白的,我会想想看。不过我身在墙外不能实际测试,希望有志愿者可以提供国内的 virtual server (须要 root)作
测试之用。

Darasion!

unread,
Mar 28, 2010, 8:48:55 AM3/28/10
to scholarz...@googlegroups.com
twitter上好像有人提供墙内vpn的,据说是提供了一个模拟墙内的环境,让墙外的人体验用的。



2010/3/28 cheshirecat <chesh...@riseup.net>
>
> 客户端本身不要装zhang,这不就是cui的功能么,怎么大家都只看见了zhang没有看见cui。

Message has been deleted
Message has been deleted

Chunlin Zhang

unread,
Mar 28, 2010, 9:30:24 PM3/28/10
to scholarz...@googlegroups.com
scapy 在 win32 下装很麻烦,我现在还没搞定

2010/3/27 cheshirecat <chesh...@riseup.net>:

Message has been deleted
Message has been deleted

ext-

unread,
Mar 28, 2010, 9:59:48 PM3/28/10
to scholarz...@googlegroups.com
昨天在win7x64下实验该版本,无效;NAT环境,linux/win32移植版均无效,所以也无法说明什么。

2010/3/29 Chunlin Zhang <zhangc...@gmail.com>:

Message has been deleted

崔莺莺

unread,
Mar 29, 2010, 1:33:24 AM3/29/10
to scholarz...@googlegroups.com
该版本是什么?
Message has been deleted

崔莺莺

unread,
Mar 29, 2010, 1:35:39 AM3/29/10
to scholarz...@googlegroups.com
墙现在还是双向的。要测试就把www.douban.com:80当HTTP代理挂着就好。

ext-

unread,
Mar 29, 2010, 4:23:37 AM3/29/10
to scholarz...@googlegroups.com
LZ的python版本。

2010/3/29 崔莺莺 <yingyingcui....@gmail.com>:

Darasion!

unread,
Mar 29, 2010, 7:08:34 AM3/29/10
to scholarz...@googlegroups.com
large_Screen_shot_2010-03-27_at_下午01.28.22.png

2010/3/29 ext- <ptp...@gmail.com>
Reply all
Reply to author
Forward
0 new messages