Henry's Notebook
Many strange things
搜索
菜单
导航
首页
最近更改
随机页面
帮助
Henry's Home
个人资料
个人资料
创建账户
登录
消息
目前您没有通知。请访问您的
讨论页
以查看过去消息。
页面工具
内容页面
讨论
查看源代码
历史
首页
»
页面s
查看“Wlangate”的源代码
←
Wlangate
页面上次由
HenryHu
编辑于13年前
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:emailconfirmed
您可以查看与复制此页面的源代码。
[[Category:脚本]] 一个和[[wlanauth]]同源的脚本,连上无线网之后,将当前有线连接在无线网上共享的脚本。 其中的[[fwder]]是一个程序,非常简单,主要是用来在HTTP proxy支持CONNECT的情况下,实现透明HTTPS代理的。用这个搞的HTTPS代理连证书都没问题…… <source lang="bash"> #!/bin/sh if [ "`ifconfig | grep wlan0 | grep -v grep`" = "" ]; then echo "Loading driver and creating device..." kldload if_wpi ifconfig wlan0 create wlandev wpi0 ifconfig wlan0 up ifconfig wlan0 bmiss 255 fi if [ "`ifconfig wlan0 | grep status | grep running`" = "" ]; then wpa_supplicant -B -iwlan0 -c/home/henryhu/conf/wpa_supplicant.conf fi echo -n "Waiting to be associated " MY_ID=`wpa_cli list | grep henryhu | cut -f 1` while true; do echo -n .; if [ "`ifconfig wlan0 | grep -E '(associated|running)' | grep -v grep`" != "" ]; then SID_NAME=`ifconfig wlan0 | grep ssid | cut -f 2 -d \ ` echo "Associated with $SID_NAME." if [ "$SID_NAME" = "henryhu" ]; then break; else echo "Associated with other's wlan, reassociate"; wpa_cli select_network $MY_ID wpa_cli reassoc fi fi; sleep 1; done echo "Setting IP to 192.168.137.1 ..." ifconfig wlan0 192.168.137.1 echo "Enable forwarding..." sysctl net.inet.ip.forwarding=1 echo "Modify firewall..." #ipfw add 1050 divert 8668 ip4 from any to any via ue0 kldload ipfw_nat pkill fwder /home/henryhu/src/fwder & ipfw nat 1 config if ue0 log same_ports reset ipfw add 1030 allow tcp from me to any via wlan0 ipfw add 1040 allow tcp from any to me via wlan0 ipfw add 1050 nat 1 ip4 from any to any via ue0 ipfw add 1060 nat 1 ip4 from any to any via wlan0 ipfw add 1070 fwd 192.168.137.1,3128 tcp from any to any dst-port 80 via wlan0 ipfw add 1080 fwd 192.168.137.1,8443 tcp from any to any dst-port 443 via wlan0 ipfw add 1090 allow ip from not me to not me echo "Starting DHCP server..." /usr/local/etc/rc.d/isc-dhcpd onestart echo "Done!" </source>
返回至
Wlangate
。