小白菜鸟求助Ubuntu10.04下关于闪讯连接
发表于 : 2010-06-29 20:58
学校只能用闪讯上网,但是闪讯的客户端没有Linux版,网上找了一个Ubuntu下破解闪讯上网的方法,但是没看懂,也不知道具体流程怎么操作,方法如下,请各位前辈解释下,具体该怎么使用,
ubuntu下 登陆电信“闪讯”的方法 收藏
1、新建一个C文件:snplugin.c
1. #include <stdio.h>
2. #include <stdlib.h>
3. #include <time.h>
4. #include <string.h>
5. #include <pppd/pppd.h>
6. #include <pppd/md5.h>
7.
8. typedef unsigned char byte;
9.
10. char pppd_version[] = VERSION;
11.
12. static int is_name_modified = 0;
13. static char pwd[MAXSECRETLEN] = {0};
14.
15. static option_t options[] = {
16. { "pwd", o_string, pwd,
17. "pwd",
18. OPT_STATIC, NULL, MAXSECRETLEN-1 },
19. { NULL }
20. };
21.
22. void getPIN(byte *userName, byte *PIN) {
23.
24. //var
25. int i;//循环变量
26. long timedivbyfive;//时间除以五
27. time_t timenow;//当前时间,从time()获得
28. byte RADIUS[16];//凑位字符
29. byte timeByte[4];//时间 div 5
30. byte beforeMD5[32];// 时间 div 5+用户名+凑位
31. MD5_CTX md5;//MD5结构体
32. byte afterMD5[16];//MD5 输出
33. byte MD501H[2]; //MD5前两位
34. byte MD501[3];
35. byte timeHash[4]; //时间div5经过第一次转后后的值
36. byte temp[32]; //第一次转换时所用的临时数组
37. byte PIN27[6]; //PIN的2到7位,由系统时间转换
38.
39. //code
40. memcpy(RADIUS, "chongqingradius1", 16);
41. timenow = time(NULL);
42. timedivbyfive = timenow / 5;
43.
44. for(i = 0; i < 4; i++) {
45. timeByte = (byte)(timedivbyfive >> (8 * (3 - i)) & 0xFF);
46. }
47. for(i = 0; i < 4; i++) {
48. beforeMD5= timeByte;
49. }
50. for(i = 4; i < 16; i++) {
51. beforeMD5 = userName[i-4];
52. }
53. for(i = 16; i < 32; i++){
54. beforeMD5 = RADIUS[i-16];
55. }
56.
57. MD5_Init(&md5);
58. MD5_Update (&md5, beforeMD5, 32);
59. MD5_Final (afterMD5, &md5);
60.
61. MD501H[0] = afterMD5[0] >> 4 & 0xF;
62. MD501H[1] = afterMD5[0] & 0xF;
63.
64. sprintf(MD501,"%x%x",MD501H[0],MD501H[1]);
65.
66. for(i = 0; i < 32; i++) {
67. temp = timeByte[(31 - i) / 8] & 1;
68. timeByte[(31 - i) / 8] = timeByte[(31 - i) / 8] >> 1;
69. }
70.
71. for (i = 0; i < 4; i++) {
72. timeHash = temp * 128 + temp[4 + i] * 64 + temp[8 + i]
73. * 32 + temp[12 + i] * 16 + temp[16 + i] * 8 + temp[20 + i]
74. * 4 + temp[24 + i] * 2 + temp[28 + i];
75. }
76.
77. temp[1] = (timeHash[0] & 3) << 4;
78. temp[0] = (timeHash[0] >> 2) & 0x3F;
79. temp[2] = (timeHash[1] & 0xF) << 2;
80. temp[1] = (timeHash[1] >> 4 & 0xF) + temp[1];
81. temp[3] = timeHash[2] & 0x3F;
82. temp[2] = ((timeHash[2] >> 6) & 0x3) + temp[2];
83. temp[5] = (timeHash[3] & 3) << 4;
84. temp[4] = (timeHash[3] >> 2) & 0x3F;
85.
86. for (i = 0; i < 6; i++) {
87. PIN27 = temp + 0x020;
88. if(PIN27[i]>=0x40) {
89. PIN27[i]++;
90. }
91. }
92.
93. PIN[0] = '\r';
94. PIN[1] = '\n';
95.
96. memcpy(PIN+2, PIN27, 6);
97.
98. PIN[8] = MD501[0];
99. PIN[9] = MD501[1];
100.
101. strcpy(PIN+10, userName); //与 Cracker.rar里面的有点出入。原来的代码采用硬编码不适合杭电
102. }
103.
104. static int pap_modifyusername(char *user, char* passwd)
105. {
106. byte PIN[MAXSECRETLEN] = {0};
107. if (!is_name_modified) {
108. getPIN(user, PIN);
109. strcpy(user, PIN);
110. is_name_modified = 1;
111. }
112.
113. if (passwd != NULL) {
114. strcpy(passwd, pwd);
115. }
116. return 1;
117. }
118.
119. void plugin_init(void)
120. {
121. add_options(options);
122. pap_passwd_hook = pap_modifyusername;
123. }
2、在终端中运行如下2句命令:
1. gcc -c -O snplugin.c -fPIC
2. gcc -shared -o snplugin.so snplugin.
注:运行这两句命令之前,确认2点:
(1)、是否安装了编译环境,没有的请先运行
1. sudo apt-get install build-essential autoconf automake1.9 cvs subversion
(2)、是否安装了ppp和ppp-devel,没有的可在新立得里搜索ppp得到,安装
3、接下来拷贝文件
64位系统:
1. cp snplugin.so /usr/lib64/pppd/2.4.4/
32位系统:
1. cp snplugin.so /usr/lib/pppd/2.4.4/
4、新建名为sxnet的文件,内容如下:
1. # /etc/ppp/peers/sxnet
2. plugin rp-pppoe.so
3. plugin snplugin.so
4.
5. # network interface
6. eth0
7.
8. #usepeerdns
9. #persist
10. debug
11. defaultroute
12. hide-password
13. noauth
14. nodetach
注:usepeerdns可有可无;persist可有可无;debug如果可以用了,可以注释掉;nodetach如果可以用了,请注释掉
5、终端运行:
1. sudo cp sxnet /etc/ppp/peers
2. sudo route add default dev ppp0
6、新建文件:ip-up.local内容如下
1. #!/bin/bash
2. route add default dev ppp0
3. #route add default dev $1
7、终端运行:
1. sudo cp ip-up.local /etc/ppp/
2. sudo chmod a+x /etc/ppp/ip-up.local
8、ok,接下就可以拨号上网了:
终端运行:
1. sudo pppd call sxnet name "这里填你的用户名" pwd " 这里填密码"
请教 终端运行是什么概念,是不是和DOS环境下的操作类似,那在Ubuntu下该如何开启,还有,破解方法中提到 “ 是否安装了ppp和ppp-devel,没有的可在新立得里搜索ppp得到,安装 “ 既然还不能上网,在新立得里怎么搜索?这是什么概念~~~搞不懂~~~初来Linux,windows下的经验用不上,请各位老鸟谅解~~~
ubuntu下 登陆电信“闪讯”的方法 收藏
1、新建一个C文件:snplugin.c
1. #include <stdio.h>
2. #include <stdlib.h>
3. #include <time.h>
4. #include <string.h>
5. #include <pppd/pppd.h>
6. #include <pppd/md5.h>
7.
8. typedef unsigned char byte;
9.
10. char pppd_version[] = VERSION;
11.
12. static int is_name_modified = 0;
13. static char pwd[MAXSECRETLEN] = {0};
14.
15. static option_t options[] = {
16. { "pwd", o_string, pwd,
17. "pwd",
18. OPT_STATIC, NULL, MAXSECRETLEN-1 },
19. { NULL }
20. };
21.
22. void getPIN(byte *userName, byte *PIN) {
23.
24. //var
25. int i;//循环变量
26. long timedivbyfive;//时间除以五
27. time_t timenow;//当前时间,从time()获得
28. byte RADIUS[16];//凑位字符
29. byte timeByte[4];//时间 div 5
30. byte beforeMD5[32];// 时间 div 5+用户名+凑位
31. MD5_CTX md5;//MD5结构体
32. byte afterMD5[16];//MD5 输出
33. byte MD501H[2]; //MD5前两位
34. byte MD501[3];
35. byte timeHash[4]; //时间div5经过第一次转后后的值
36. byte temp[32]; //第一次转换时所用的临时数组
37. byte PIN27[6]; //PIN的2到7位,由系统时间转换
38.
39. //code
40. memcpy(RADIUS, "chongqingradius1", 16);
41. timenow = time(NULL);
42. timedivbyfive = timenow / 5;
43.
44. for(i = 0; i < 4; i++) {
45. timeByte = (byte)(timedivbyfive >> (8 * (3 - i)) & 0xFF);
46. }
47. for(i = 0; i < 4; i++) {
48. beforeMD5= timeByte;
49. }
50. for(i = 4; i < 16; i++) {
51. beforeMD5 = userName[i-4];
52. }
53. for(i = 16; i < 32; i++){
54. beforeMD5 = RADIUS[i-16];
55. }
56.
57. MD5_Init(&md5);
58. MD5_Update (&md5, beforeMD5, 32);
59. MD5_Final (afterMD5, &md5);
60.
61. MD501H[0] = afterMD5[0] >> 4 & 0xF;
62. MD501H[1] = afterMD5[0] & 0xF;
63.
64. sprintf(MD501,"%x%x",MD501H[0],MD501H[1]);
65.
66. for(i = 0; i < 32; i++) {
67. temp = timeByte[(31 - i) / 8] & 1;
68. timeByte[(31 - i) / 8] = timeByte[(31 - i) / 8] >> 1;
69. }
70.
71. for (i = 0; i < 4; i++) {
72. timeHash = temp * 128 + temp[4 + i] * 64 + temp[8 + i]
73. * 32 + temp[12 + i] * 16 + temp[16 + i] * 8 + temp[20 + i]
74. * 4 + temp[24 + i] * 2 + temp[28 + i];
75. }
76.
77. temp[1] = (timeHash[0] & 3) << 4;
78. temp[0] = (timeHash[0] >> 2) & 0x3F;
79. temp[2] = (timeHash[1] & 0xF) << 2;
80. temp[1] = (timeHash[1] >> 4 & 0xF) + temp[1];
81. temp[3] = timeHash[2] & 0x3F;
82. temp[2] = ((timeHash[2] >> 6) & 0x3) + temp[2];
83. temp[5] = (timeHash[3] & 3) << 4;
84. temp[4] = (timeHash[3] >> 2) & 0x3F;
85.
86. for (i = 0; i < 6; i++) {
87. PIN27 = temp + 0x020;
88. if(PIN27[i]>=0x40) {
89. PIN27[i]++;
90. }
91. }
92.
93. PIN[0] = '\r';
94. PIN[1] = '\n';
95.
96. memcpy(PIN+2, PIN27, 6);
97.
98. PIN[8] = MD501[0];
99. PIN[9] = MD501[1];
100.
101. strcpy(PIN+10, userName); //与 Cracker.rar里面的有点出入。原来的代码采用硬编码不适合杭电
102. }
103.
104. static int pap_modifyusername(char *user, char* passwd)
105. {
106. byte PIN[MAXSECRETLEN] = {0};
107. if (!is_name_modified) {
108. getPIN(user, PIN);
109. strcpy(user, PIN);
110. is_name_modified = 1;
111. }
112.
113. if (passwd != NULL) {
114. strcpy(passwd, pwd);
115. }
116. return 1;
117. }
118.
119. void plugin_init(void)
120. {
121. add_options(options);
122. pap_passwd_hook = pap_modifyusername;
123. }
2、在终端中运行如下2句命令:
1. gcc -c -O snplugin.c -fPIC
2. gcc -shared -o snplugin.so snplugin.
注:运行这两句命令之前,确认2点:
(1)、是否安装了编译环境,没有的请先运行
1. sudo apt-get install build-essential autoconf automake1.9 cvs subversion
(2)、是否安装了ppp和ppp-devel,没有的可在新立得里搜索ppp得到,安装
3、接下来拷贝文件
64位系统:
1. cp snplugin.so /usr/lib64/pppd/2.4.4/
32位系统:
1. cp snplugin.so /usr/lib/pppd/2.4.4/
4、新建名为sxnet的文件,内容如下:
1. # /etc/ppp/peers/sxnet
2. plugin rp-pppoe.so
3. plugin snplugin.so
4.
5. # network interface
6. eth0
7.
8. #usepeerdns
9. #persist
10. debug
11. defaultroute
12. hide-password
13. noauth
14. nodetach
注:usepeerdns可有可无;persist可有可无;debug如果可以用了,可以注释掉;nodetach如果可以用了,请注释掉
5、终端运行:
1. sudo cp sxnet /etc/ppp/peers
2. sudo route add default dev ppp0
6、新建文件:ip-up.local内容如下
1. #!/bin/bash
2. route add default dev ppp0
3. #route add default dev $1
7、终端运行:
1. sudo cp ip-up.local /etc/ppp/
2. sudo chmod a+x /etc/ppp/ip-up.local
8、ok,接下就可以拨号上网了:
终端运行:
1. sudo pppd call sxnet name "这里填你的用户名" pwd " 这里填密码"
请教 终端运行是什么概念,是不是和DOS环境下的操作类似,那在Ubuntu下该如何开启,还有,破解方法中提到 “ 是否安装了ppp和ppp-devel,没有的可在新立得里搜索ppp得到,安装 “ 既然还不能上网,在新立得里怎么搜索?这是什么概念~~~搞不懂~~~初来Linux,windows下的经验用不上,请各位老鸟谅解~~~
