可恶的电信校园宽带,强制使用客户端限制共享。其实也没什么技术含量,还是PPPoE协议,就是把用户名按一定算法加密,客户端大部分功能都用在了限制共享上,搞得电脑都不正常了。问了电信工作人员,还说这客户端花了几百万呢,西安信利真能赚钱,还不支持非win的系统,呵呵。
加密用户名好办,客户端强行结束就能看到真实用户名了。可恶的是这宽带用户名前面加了回车换行符(\r\n),不仅windows自带拨号无法输入,一般的路由器也无法输入进去。经过google,发现tp-link的有办法,可以post数据或者直接把输用户名的表单改成textarea。但是tp-link原厂固件功能少,又经常死机,于是想用openwrt。仿照tp-link的方法无效,又找了改拨号脚本和修改ppp源码的方式,都没成功。最后无意中发现了可以通过ppp插件的方式修改用户名。通过参考此源码,成功解决了在openwrt中使用回车换行符。
将上述sxplugin.c文件的用户名加密部分删除掉就基本可以了,然后按照上述链接的说明编译并将so文件传到路由器上即可,拨号时就会在设定的用户名前加上回车换行符。
我这提供编译好了的bcm63xx和ar71xx的so文件,对应的openwrt版本是12.09,ppp是2.3.5,so文件放在/usr/lib/pppd/2.4.5/下。
另附修改后的源码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
//see https://github.com/miao1007/Openwrt-NetKeeper #include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> //TODO : you may obtaion it by git clone https://github.com/squadette/pppd.git #include "pppd.h" #include "md5.h" typedef unsigned char byte; //TODO : change the version here char pppd_version[] = "2.4.5"; static char saveuser[MAXNAMELEN] = {0}; static char savepwd[MAXSECRETLEN] = {0}; static void getPIN(byte *userName, byte *PIN) { //PIN PIN[0] = '\r'; PIN[1] = '\n'; strcpy(PIN+2, userName); } static int pap_modifyusername(char *user, char* passwd) { byte PIN[MAXSECRETLEN] = {0}; getPIN(saveuser, PIN); strcpy(user, PIN); info("sxplugin : user is <%s> ",user); } static int check(){ return 1; } void plugin_init(void) { info("sxplugin : init"); strcpy(saveuser,user); strcpy(savepwd,passwd); pap_modifyusername(user, saveuser); info("sxplugin : passwd loaded"); pap_check_hook=check; chap_check_hook=check; } |
博主也是石大的?