├── .gitignore
├── Android Version
├── .gitignore
├── .idea
│ ├── .name
│ ├── compiler.xml
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── encodings.xml
│ ├── gradle.xml
│ ├── libraries
│ │ ├── appcompat_v7_22_0_0.xml
│ │ ├── support_annotations_22_0_0.xml
│ │ └── support_v4_22_0_0.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── runConfigurations.xml
│ ├── vcs.xml
│ └── workspace.xml
├── LICENSE
├── SimpleNetkeeper.iml
├── app
│ ├── .gitignore
│ ├── app.iml
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── cn
│ │ │ └── sunflyer
│ │ │ └── simplenetkeeper
│ │ │ └── ApplicationTest.java
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── cn
│ │ │ └── sunflyer
│ │ │ ├── simplenetkeeper
│ │ │ ├── AccountActivity.java
│ │ │ ├── BackgroundDialerReceiver.java
│ │ │ ├── ConfigRouter.java
│ │ │ ├── FirstRun.java
│ │ │ ├── OntimeDial.java
│ │ │ ├── Options.java
│ │ │ ├── ui
│ │ │ │ ├── SDialog.java
│ │ │ │ └── WaitingUi.java
│ │ │ └── util
│ │ │ │ ├── AndroidTools.java
│ │ │ │ └── WifiAdmin.java
│ │ │ └── simpnk
│ │ │ ├── annotation
│ │ │ ├── Config.java
│ │ │ └── ConfigLoad.java
│ │ │ ├── control
│ │ │ ├── AccountController.java
│ │ │ ├── AppInfo.java
│ │ │ ├── Base64.java
│ │ │ ├── ConfigController.java
│ │ │ ├── DialController.java
│ │ │ ├── Log.java
│ │ │ ├── MessageHandler.java
│ │ │ └── StatusController.java
│ │ │ ├── netkeeper
│ │ │ ├── CXKUsername.java
│ │ │ └── MD5.java
│ │ │ └── obj
│ │ │ ├── Router.java
│ │ │ ├── RouterMecuryTPF.java
│ │ │ ├── RouterMecuryTpNew.java
│ │ │ ├── RouterTpLinkNew.java
│ │ │ └── WiFiInfo.java
│ │ └── res
│ │ ├── anim
│ │ └── rotate_repeat.xml
│ │ ├── drawable
│ │ ├── aperture.png
│ │ ├── arrowtop.png
│ │ ├── badge.png
│ │ ├── button.xml
│ │ ├── button_list_a.xml
│ │ ├── button_qd.xml
│ │ ├── error.png
│ │ ├── file.png
│ │ ├── input.xml
│ │ ├── input_bottom.xml
│ │ ├── input_middle.xml
│ │ ├── load.gif
│ │ ├── ok.png
│ │ ├── spinner.xml
│ │ ├── w1.png
│ │ ├── w10.png
│ │ ├── w11.png
│ │ ├── w2.png
│ │ ├── w3.png
│ │ ├── w4.png
│ │ ├── w5.png
│ │ ├── w6.png
│ │ ├── w7.png
│ │ ├── w8.png
│ │ ├── w9.png
│ │ ├── wait_anim.xml
│ │ └── wifi.png
│ │ ├── layout
│ │ ├── activity_account.xml
│ │ ├── activity_config_router.xml
│ │ ├── activity_first_run.xml
│ │ ├── activity_ontime_dial.xml
│ │ ├── activity_options.xml
│ │ ├── ques_dialog.xml
│ │ ├── spinner_list.xml
│ │ └── waiting_layout.xml
│ │ ├── menu
│ │ ├── menu_config_router.xml
│ │ ├── menu_first_run.xml
│ │ └── menu_options.xml
│ │ ├── mipmap-hdpi
│ │ ├── applogo.jpg
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ ├── applogo.jpg
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ ├── applogo.jpg
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ ├── applogo.jpg
│ │ └── ic_launcher.png
│ │ ├── values-v11
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ ├── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ ├── strings_activity_options.xml
│ │ └── styles.xml
│ │ └── xml
│ │ ├── pref_data_sync.xml
│ │ ├── pref_general.xml
│ │ ├── pref_headers.xml
│ │ └── pref_notification.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── ChangeLog.txt
├── DialLib
├── SimpNKRasDialLib.cpp
├── SimpNKRasDialLib.rc
├── SimpNKRasDialLibx64.dll
├── SimpNKRasDialLibx86.dll
├── cqxinli_ClickDial.h
├── dllmain.cpp
├── resource.h
├── stdafx.cpp
├── stdafx.h
└── targetver.h
├── Netkeeper For Router使用文档.docx
├── PinCodeReverse.cs
├── README.md
├── UDP心跳计算.php
├── src
├── ExportHeadFile.bat
├── cn
│ └── sunflyer
│ │ └── simpnk
│ │ ├── annotation
│ │ └── Config.java
│ │ ├── control
│ │ ├── AppInfo.java
│ │ ├── Base64.java
│ │ ├── ConfigController.java
│ │ ├── DialController.java
│ │ ├── Log.java
│ │ ├── MainClass.java
│ │ ├── MessageController.java
│ │ ├── PluginController.java
│ │ ├── StatusController.java
│ │ └── UIController.java
│ │ ├── model
│ │ └── AppEntry.java
│ │ ├── netkeeper
│ │ ├── CXKUsername.java
│ │ └── MD5.java
│ │ ├── obj
│ │ ├── Bundle.java
│ │ ├── Message.java
│ │ ├── PluginConfig.java
│ │ ├── PluginDial.java
│ │ ├── PluginRouter.java
│ │ ├── Router.java
│ │ ├── RouterMecuryTPF.java
│ │ ├── RouterMecuryTpNew.java
│ │ └── WiFiInfo.java
│ │ └── ui
│ │ ├── FrameRouter.java
│ │ ├── PanelDialLocal.java
│ │ ├── PanelInput.java
│ │ ├── PanelOperation.java
│ │ └── PanelPassword.java
└── cqxinli
│ └── ClickDial.java
├── 使用说明.txt
├── 关于路由器的使用办法.pdf
├── 湖北掌大宽带密码获取协议
├── 湖北电信免心跳不限时长登录.cs
├── 点击我运行.bat
└── 重庆电信动态密码.php
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | # Mobile Tools for Java (J2ME)
4 | .mtj.tmp/
5 |
6 | # Package Files #
7 | *.jar
8 | *.war
9 | *.ear
10 |
11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12 | hs_err_pid*
13 |
--------------------------------------------------------------------------------
/Android Version/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 |
15 | # Gradle files
16 | .gradle/
17 | build/
18 |
19 | # Local configuration file (sdk path, etc)
20 | local.properties
21 |
22 | # Proguard folder generated by Eclipse
23 | proguard/
24 |
25 | # Log Files
26 | *.log
27 |
28 | # Android Studio Navigation editor temp files
29 | .navigation/
30 |
31 | # Android Studio captures folder
32 | captures/
33 |
--------------------------------------------------------------------------------
/Android Version/.idea/.name:
--------------------------------------------------------------------------------
1 | SimpleNetkeeper
--------------------------------------------------------------------------------
/Android Version/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Android Version/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Android Version/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Android Version/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/Android Version/.idea/libraries/appcompat_v7_22_0_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Android Version/.idea/libraries/support_annotations_22_0_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Android Version/.idea/libraries/support_v4_22_0_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Android Version/.idea/misc.xml:
--------------------------------------------------------------------------------
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 | Android Lint
39 |
40 |
41 | Internationalization issues
42 |
43 |
44 | Internationalization issuesJava
45 |
46 |
47 | Java
48 |
49 |
50 |
51 |
52 | Android
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/Android Version/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Android Version/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Android Version/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Android Version/SimpleNetkeeper.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Android Version/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Android Version/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | generateDebugAndroidTestSources
19 | generateDebugSources
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 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/Android Version/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 22
5 | buildToolsVersion "21.1.2"
6 |
7 | defaultConfig {
8 | applicationId "cn.sunflyer.simplenetkeeper"
9 | minSdkVersion 15
10 | targetSdkVersion 22
11 | versionCode 68
12 | versionName "1.3.3.68"
13 | }
14 | buildTypes {
15 | release {
16 | // 不显示Log
17 | buildConfigField "boolean", "LOG_DEBUG", "false"
18 | //混淆
19 | minifyEnabled true
20 | //Zipalign优化
21 | zipAlignEnabled true
22 |
23 | // 移除无用的resource文件
24 | shrinkResources true
25 | //前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明
26 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
27 | }
28 | }
29 | }
30 |
31 | dependencies {
32 | compile fileTree(dir: 'libs', include: ['*.jar'])
33 | compile 'com.android.support:appcompat-v7:22.0.0'
34 | compile 'com.android.support:support-v4:22.0.0'
35 | }
36 |
--------------------------------------------------------------------------------
/Android Version/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 | -keep class cn.sunflyer.simpnk.control.AccountController{ *;}
19 | -keep class cn.sunflyer.simpnk.control.StatusController{ *;}
--------------------------------------------------------------------------------
/Android Version/app/src/androidTest/java/cn/sunflyer/simplenetkeeper/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simplenetkeeper;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/Android Version/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
33 |
34 |
38 |
39 |
43 |
44 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/java/cn/sunflyer/simplenetkeeper/ConfigRouter.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simplenetkeeper;
2 |
3 | import android.content.Intent;
4 | import android.graphics.Color;
5 | import android.app.Activity;
6 | import android.os.Bundle;
7 | import android.os.Environment;
8 | import android.os.Handler;
9 | import android.os.Message;
10 | import android.view.Menu;
11 | import android.view.MenuItem;
12 | import android.view.View;
13 | import android.widget.Button;
14 | import android.widget.TextView;
15 |
16 | import cn.sunflyer.simplenetkeeper.util.AndroidTools;
17 | import cn.sunflyer.simpnk.annotation.Config;
18 | import cn.sunflyer.simpnk.control.ConfigController;
19 | import cn.sunflyer.simpnk.control.DialController;
20 | import cn.sunflyer.simpnk.control.Log;
21 | import cn.sunflyer.simpnk.control.MessageHandler;
22 | import cn.sunflyer.simpnk.control.StatusController;
23 |
24 |
25 | public class ConfigRouter extends Activity {
26 |
27 | //控件组
28 | private Button mButConnect ;
29 | private Button mButGuide;
30 | private TextView mTvConnect;
31 | private TextView mTvGuide;
32 | private Button mButHelp;
33 | private Button mButOnTimeDial;
34 | private Button mButChangeInfo;
35 |
36 | @Override
37 | protected void onCreate(Bundle savedInstanceState) {
38 | super.onCreate(savedInstanceState);
39 |
40 | setContentView(R.layout.activity_config_router);
41 |
42 | ConfigController.setConfigPath(this.getFilesDir().toString());
43 | //加载配置文件状态
44 | StatusController.initStatus(this.getFilesDir().toString());
45 |
46 | this.initComponent();
47 | this.initComponentEvent();
48 | this.initStateHandler();
49 | }
50 |
51 |
52 | /**
53 | * 初始化组件连接
54 | * */
55 | private void initComponent(){
56 | this.mButConnect = (Button)findViewById(R.id.but_connect);
57 | this.mButGuide = (Button)findViewById(R.id.but_guide);
58 | this.mTvConnect = (TextView)findViewById(R.id.str_main_tip_connect);
59 | this.mTvGuide = (TextView)findViewById(R.id.main_view_tip_guide);
60 | this.mButHelp = (Button)findViewById(R.id.but_about);
61 | this.mButOnTimeDial=(Button)findViewById(R.id.but_ontime);
62 | this.mButChangeInfo = (Button)findViewById(R.id.but_changeinfo);
63 |
64 | if(!StatusController.isConfigExists){
65 | this.mTvConnect.setVisibility(View.INVISIBLE);
66 | this.mButConnect.setEnabled(false);
67 | this.mButConnect.setBackgroundColor(Color.GRAY);
68 | this.mButChangeInfo.setVisibility(View.INVISIBLE);
69 | this.mTvGuide.setText("这是你首次使用,请从设置向导开始");
70 | }else{
71 | this.mTvGuide.setText("Wifi状态:" + (!AndroidTools.isWifiNetwork(this) ? "未连接到无线网络" : "已连接到无线网络 " + AndroidTools.getWifiName(this)));
72 | }
73 | }
74 |
75 | /**
76 | * 初始化组件的事件
77 | * */
78 | private void initComponentEvent(){
79 |
80 | //一键连接的操作
81 | this.mButConnect.setOnClickListener(new View.OnClickListener() {
82 | @Override
83 | public void onClick(View v) {
84 | Intent pActIntent = new Intent();
85 | pActIntent.setClass(ConfigRouter.this,AccountActivity.class);
86 | pActIntent.putExtra("from", "index");
87 | pActIntent.putExtra("autodial",true);
88 | startActivity(pActIntent);
89 | }
90 | });
91 |
92 | this.mButGuide.setOnClickListener(new View.OnClickListener() {
93 | @Override
94 | public void onClick(View v) {
95 | Intent pActIntent = new Intent();
96 | pActIntent.setClass(ConfigRouter.this, FirstRun.class);
97 | pActIntent.putExtra("isFirstRun", !StatusController.isConfigExists);
98 | startActivity(pActIntent);
99 | }
100 | });
101 |
102 | this.mButOnTimeDial.setOnClickListener(new View.OnClickListener() {
103 | @Override
104 | public void onClick(View v) {
105 | Intent pActIntent = new Intent();
106 | pActIntent.setClass(ConfigRouter.this,OntimeDial.class);
107 | pActIntent.putExtra("isFirstRun",!StatusController.isConfigExists);
108 | startActivity(pActIntent);
109 | }
110 | });
111 |
112 | this.mButChangeInfo.setOnClickListener(new View.OnClickListener() {
113 | @Override
114 | public void onClick(View v) {
115 | Intent pActIntent = new Intent();
116 | pActIntent.setClass(ConfigRouter.this, AccountActivity.class);
117 | pActIntent.putExtra("from", "index");
118 | startActivity(pActIntent);
119 | }
120 | });
121 |
122 | this.mButHelp.setOnClickListener(new View.OnClickListener() {
123 | @Override
124 | public void onClick(View v) {
125 | Intent pActIntent = new Intent();
126 | pActIntent.setClass(ConfigRouter.this, Options.class);
127 | pActIntent.putExtra("from", "index");
128 | startActivity(pActIntent);
129 | }
130 | });
131 | }
132 |
133 | /**
134 | * 初始化处理程序
135 | * */
136 | private void initStateHandler(){
137 |
138 | }
139 |
140 |
141 | }
142 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/java/cn/sunflyer/simplenetkeeper/ui/SDialog.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simplenetkeeper.ui;
2 |
3 | import android.app.Dialog;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 | import android.view.KeyEvent;
8 | import android.view.View;
9 | import android.view.Window;
10 | import android.widget.Button;
11 | import android.widget.LinearLayout;
12 | import android.widget.TextView;
13 |
14 | import cn.sunflyer.simplenetkeeper.R;
15 |
16 | /**
17 | * Created by 陈耀璇 on 2015/5/24.
18 | * 继承自Dialog类,由于个人水平问题,因此这个对话框在消失后会被释放(dismiss)掉。除非手动指定每个按钮的监听事件处理过程。
19 | * 为了修改这个窗口的标题和文本内容,请使用 setWindowTitle 和 setWindowContent 方法。
20 | * 请注意:请在调用show()方法后再设置文本内容,否则会提示空指针错误,这个操作与onCreate方法调用时机有关
21 | */
22 | public class SDialog extends Dialog{
23 |
24 | Context context;
25 |
26 | private TextView mTvTitle;
27 | private TextView mTvContent;
28 |
29 | private Button mButOk;
30 | private Button mButNo;
31 |
32 | public SDialog(Context c) {
33 | super(c , R.style.SDialog);
34 | this.context = c;
35 | super.onStart();
36 | }
37 |
38 | public void onCreate(Bundle savedInstanceState) {
39 | requestWindowFeature(Window.FEATURE_NO_TITLE);
40 | requestWindowFeature(Window.PROGRESS_VISIBILITY_ON);
41 | super.onCreate(savedInstanceState);
42 |
43 | setContentView(R.layout.ques_dialog);
44 | /**私有变量初始化*/
45 | this.initComponentVar();
46 | }
47 |
48 | /**初始化组件变量*/
49 | private void initComponentVar(){
50 | this.mTvTitle = (TextView)findViewById(R.id.qd_title);
51 | this.mTvContent = (TextView)findViewById(R.id.qd_con);
52 |
53 | this.mButNo = (Button)findViewById(R.id.qd_but_no);
54 | this.mButOk = (Button)findViewById(R.id.qd_but_ok);
55 |
56 | this.setOnTouchOutsideCloseWindow(false);
57 | }
58 |
59 | private final View.OnClickListener DEFAULT_LISTENER = new View.OnClickListener(){
60 |
61 | @Override
62 | public void onClick(View v) {
63 | hide();
64 | dismiss();
65 | }
66 | };
67 |
68 | public SDialog setPositiveListener(View.OnClickListener i){
69 | this.mButOk.setOnClickListener(i == null ? DEFAULT_LISTENER : i);
70 | return this;
71 | }
72 |
73 | public SDialog setNegativeListener(View.OnClickListener i){
74 | this.mButNo.setOnClickListener(i == null ? DEFAULT_LISTENER : i);
75 | return this;
76 | }
77 |
78 | public SDialog setWindowTitle(CharSequence t){
79 | if(t != null)
80 | this.mTvTitle.setText(t);
81 | return this;
82 | }
83 |
84 | public SDialog setWindowContent(CharSequence t){
85 | if(t != null)
86 | this.mTvContent.setText(t);
87 | return this;
88 | }
89 |
90 | public SDialog setOnTouchOutsideCloseWindow(boolean i){
91 | this.setCanceledOnTouchOutside(i);
92 | return this;
93 | }
94 |
95 | public SDialog setPositiveText(CharSequence i){
96 | if( i != null && !i.equals("")){
97 | this.mButOk.setText(i);
98 | this.mButOk.setVisibility(View.VISIBLE);
99 | }
100 | return this;
101 | }
102 |
103 | public SDialog setNegativeText(CharSequence i){
104 | if( i != null && !i.equals("")){
105 | this.mButNo.setText(i);
106 | this.mButNo.setVisibility(View.VISIBLE);
107 | }
108 | return this;
109 | }
110 |
111 | public SDialog setPositiveButton(CharSequence i,View.OnClickListener c){
112 | this.setPositiveText(i);
113 | this.setPositiveListener(c);
114 | return this;
115 | }
116 |
117 | public SDialog setNegativeButton(CharSequence i,View.OnClickListener c){
118 | this.setNegativeText(i);
119 | this.setNegativeListener(c);
120 | return this;
121 | }
122 |
123 | public boolean onKeyDown(int keyCode, KeyEvent event) {
124 | if (keyCode == KeyEvent.KEYCODE_BACK) {
125 | // 按下了键盘上返回按钮
126 | this.hide();
127 | return true;
128 | }
129 | return false;
130 | }
131 |
132 | public void show(){
133 | super.show();
134 | }
135 |
136 | public void hide(){
137 | super.hide();
138 | }
139 |
140 | }
141 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/java/cn/sunflyer/simplenetkeeper/ui/WaitingUi.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simplenetkeeper.ui;
2 |
3 | import android.app.Dialog;
4 | import android.content.Context;
5 | import android.graphics.Bitmap;
6 | import android.graphics.Color;
7 | import android.graphics.drawable.AnimationDrawable;
8 | import android.os.Bundle;
9 | import android.view.Gravity;
10 | import android.view.KeyEvent;
11 | import android.view.Window;
12 | import android.view.animation.Animation;
13 | import android.view.animation.AnimationUtils;
14 | import android.view.animation.LinearInterpolator;
15 | import android.widget.FrameLayout;
16 | import android.widget.ImageView;
17 | import android.widget.TextView;
18 |
19 | import org.w3c.dom.Text;
20 |
21 | import cn.sunflyer.simplenetkeeper.R;
22 |
23 | /**
24 | * Created by 陈耀璇 on 2015/4/15.
25 | */
26 | public class WaitingUi extends Dialog {
27 | Context context;
28 |
29 | private ImageView mLoading;
30 | private TextView mText;
31 | private AnimationDrawable pAnimDraw;
32 |
33 | private CharSequence mInitText ;
34 |
35 | public WaitingUi(Context context) {
36 | this(context,"请稍候......");
37 | }
38 |
39 | public WaitingUi(Context c,CharSequence x){
40 | super(c, R.style.SelfDialog);
41 | this.context = c;
42 | this.mInitText = x;
43 | }
44 |
45 | public void setTips(CharSequence x){
46 | if(this.mText != null) mText.setText(x);
47 | }
48 |
49 | public void onCreate(Bundle savedInstanceState) {
50 | requestWindowFeature(Window.FEATURE_NO_TITLE);
51 | requestWindowFeature(Window.PROGRESS_VISIBILITY_ON);
52 | super.onCreate(savedInstanceState);
53 |
54 | setContentView(R.layout.waiting_layout);
55 | this.mText = (TextView)findViewById(R.id.wl_text);
56 | setTips(this.mInitText);
57 | this.mLoading = (ImageView)findViewById(R.id.wl_pic);
58 |
59 | mLoading.setBackgroundResource(R.drawable.wait_anim);
60 |
61 | pAnimDraw = (AnimationDrawable)mLoading.getBackground();
62 |
63 | setCanceledOnTouchOutside(false);
64 | }
65 |
66 | @Override
67 | public boolean onKeyDown(int keyCode, KeyEvent event) {
68 | if (keyCode == KeyEvent.KEYCODE_BACK) {
69 | this.hide();
70 | pAnimDraw.stop();
71 | return true;
72 | }
73 | return false;
74 | }
75 |
76 | @Override
77 | public void show() {
78 | this.setTips(mInitText);
79 | super.show();
80 | pAnimDraw.start();
81 | }
82 | }
--------------------------------------------------------------------------------
/Android Version/app/src/main/java/cn/sunflyer/simpnk/annotation/Config.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Target(ElementType.FIELD)
10 | public @interface Config {
11 | public static final String CONFIG_STRING = "String";
12 | public static final String CONFIG_NUMBER_INT = "Integer";
13 | public static final String CONFIG_NUMBER_DOUBLE = "Double";
14 | public static final String CONFIG_NUMBER_LONG = "Long";
15 | public static final String CONFIG_CHAR = "Character";
16 | public static final String CONFIG_BOOLEAN = "Boolean";
17 | public static final String CONFIG_CHARSEQUENCE = "CharSequence";
18 |
19 | public String configName();
20 | public String configType() default CONFIG_STRING;
21 | public boolean base64() default false;
22 | }
23 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/java/cn/sunflyer/simpnk/annotation/ConfigLoad.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.annotation;
2 |
3 | /**
4 | * Created by 陈耀璇 on 2015/5/13.
5 | */
6 | import java.lang.annotation.ElementType;
7 | import java.lang.annotation.Retention;
8 | import java.lang.annotation.RetentionPolicy;
9 | import java.lang.annotation.Target;
10 |
11 | @Retention(RetentionPolicy.RUNTIME)
12 | @Target(ElementType.FIELD)
13 | public @interface ConfigLoad {
14 |
15 | /**
16 | * 注解请求字段
17 | * */
18 | public String req();
19 |
20 | /**
21 | * 请求字段的类型,默认为String
22 | * */
23 | public String type() default Config.CONFIG_STRING;
24 |
25 | /**
26 | * 请求来源类,默认StatusController
27 | * */
28 | public String sourceClass() default "StatusController";
29 |
30 | /**
31 | * 本地方法名称
32 | * */
33 | public String methodName() default "setText";
34 |
35 | /**
36 | * 本地方法需求类型
37 | * */
38 | public String methodType() default Config.CONFIG_CHARSEQUENCE;
39 |
40 | /**
41 | * 如果本地方法需求布尔型参数,需要在这里给定真值
42 | * */
43 | public String reqVal() default "";
44 |
45 | public static final String sourcePrefix = "cn.sunflyer.simpnk.control.";
46 | }
47 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/java/cn/sunflyer/simpnk/control/AccountController.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.control;
2 |
3 | import java.util.Date;
4 |
5 | import cn.sunflyer.simpnk.annotation.Config;
6 | import cn.sunflyer.simpnk.netkeeper.CXKUsername;
7 |
8 | /**
9 | * Created by 陈耀璇 on 2015/5/6.
10 | * 真实帐号控制类。
11 | */
12 | public class AccountController {
13 |
14 | public static final CharSequence[] RADIUS_NAME = {
15 | "家用模式","重庆 Netkeeper 2.5.0055 - 0092","湖北 E信","浙江 闪讯","重庆 Netkeeper 2.5.0094","江西 星空极速 v32","山东移动 Netkeeper 0094","河北联通 Netkeeper",
16 | "陕西翼讯 3.7.3" , "山东电信 3.7.3 8月17日版本" , "山东电信 3.7.3 10月27日版本" , "甘肃电信 3.7.1"
17 | };
18 |
19 | public static final String[] RADIUS = {
20 | "",
21 | "cqxinliradius002", //重庆地区Netkeeper2.5
22 | "hubtxinli01", //湖北E信
23 | "singlenet01", //杭州地区
24 | "xianxinli1radius",
25 | "jiangxi4.0",
26 | "shandongmobile13",
27 | "hebeicncxinli002",
28 | "sh_xi@xiaoyuan01",
29 | "560Ox!a0yuanOlIz",
30 | "shdOx!a0yuan01lz",
31 | "xiaoyuanyixun001"
32 | };
33 |
34 | public static final String[] RADIUS_PREFIX = {
35 | "",
36 | "\r\n",
37 | "\r\n",
38 | "\r\n",
39 | "\r\n",
40 | "\r1",
41 | "\r\n",
42 | "\r\n",
43 | "\r\n",
44 | "\r\n",
45 | "\r\n",
46 | "\r\n"
47 | };
48 |
49 | public static final int RADIUS_HOME = 0,
50 | RADIUS_CHONGQING = 1,
51 | RADIUS_HUBEI = 2,
52 | RADIUS_HANGZHOU = 3,
53 | RADIUS_CHONGQING_NEW = 4 ,
54 | RADIUS_JIANGXI = 5,
55 | RADIUS_SHANDONG = 6,
56 | RADIUS_HEBEI = 7,
57 | RADIUS_SHANXI = 8,
58 | RADIUS_SHANDONG_AUG = 9,
59 | RADIUS_SHANDONG_OCT = 10 ,
60 | RADIUS_GANSU = 11,
61 | RADIUS_SELF = 1000;
62 |
63 | @Config(configName = ConfigController.Config_Router_DialRadiusPrefix)
64 | public static String mCurrentRadiusPrefix = null;
65 |
66 | @Config(configName = ConfigController.Config_Router_DialRadiusDefined )
67 | public static String mCurrentRadiusStr = null;
68 |
69 | /**RADIUS标识*/
70 | @Config(configName = ConfigController.Config_Router_DialPlace , configType = Config.CONFIG_NUMBER_INT)
71 | public static int mCurrentRadius = RADIUS_CHONGQING_NEW;
72 |
73 | public static String getRealAccount(String username){
74 | return getRealAccount(username , (new Date()).getTime());
75 | }
76 |
77 | public static String getRealAccount(String username,long time){
78 | if(username == null) return null;
79 | if(time > 0 && mCurrentRadius != RADIUS_HOME && (mCurrentRadius < RADIUS.length || mCurrentRadius == RADIUS_SELF) && mCurrentRadius >= 0){
80 | Log.log("Real Acc : using " + getCurrentRadius());
81 | return new CXKUsername(getCurrentRadiusPrefix() , username,getCurrentRadius()).Realusername(time);
82 | }
83 | return username;
84 | }
85 |
86 | public static String getCurrentRadius(){
87 | return mCurrentRadius == RADIUS_SELF ? mCurrentRadiusStr : RADIUS[mCurrentRadius];
88 | }
89 |
90 | public static String getCurrentRadiusPrefix(){
91 | return mCurrentRadius == RADIUS_SELF ? mCurrentRadiusPrefix.replace("\\r", "\r").replace("\\n", "\n") : RADIUS_PREFIX[mCurrentRadius];
92 | }
93 |
94 | }
95 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/java/cn/sunflyer/simpnk/control/AppInfo.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.control;
2 |
3 | public class AppInfo {
4 |
5 | public static final int APP_VERSION_MAIN = 1 ; //主版本号
6 | public static final int APP_VERSION_SUB = 2 ; //子版本号
7 | public static final int APP_VERSION_FIX = 0 ; //修正版本
8 | public static final String APP_VERSION_BUILD = "56" ; //build
9 |
10 | public static String getVersionString(){
11 | return APP_VERSION_MAIN+"."+APP_VERSION_SUB+"."+APP_VERSION_FIX+"."+APP_VERSION_BUILD;
12 | }
13 |
14 | public static final String APP_VERSION_ST[] = {"正式版本","测试版本"};
15 |
16 | public static final int APP_VERSION_ST_CODE = 1 ;
17 |
18 | public static String getVersionStringWithRel(){
19 | return getVersionString() + (APP_VERSION_ST_CODE >= APP_VERSION_ST.length ? "Unknown" : APP_VERSION_ST[APP_VERSION_ST_CODE]);
20 | }
21 |
22 |
23 | public static final String APP_VERSION_DATE = "2015-03-20 13:00"; //版本日期
24 |
25 | /**
26 | * 程序集信息
27 | * */
28 | public static final String APP_NAME = "Simple Netkeeper";
29 | public static final String APP_DES = "";
30 |
31 | public static final String APP_WEB_UPDATE = "http://www.sunflyer.cn/archives/8";
32 | public static final String APP_WEB_HELP = "http://www.sunflyer.cn/";
33 | public static final String APP_WEB_DEV = "http://www.sunflyer.cn/";
34 |
35 |
36 | /**
37 | * 作者信息
38 | * */
39 | public static final String APP_AUTHOR_NAME = "CrazyChen @ CQUT";
40 | public static final String APP_AUTHOR_MAIL = "cx@itncre.com";
41 | public static final String APP_AUTHOR_WEB = "http://www.sunflyer.cn";
42 |
43 | public static final String APP_AUTHOR_DES = "程序源代码已经公开在 https://github.com/sunflyer/simplenetkeeper ";
44 |
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/java/cn/sunflyer/simpnk/control/Base64.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.control;
2 |
3 | /********************************************************************************************************************
4 | * $Id: Base64.java,v 1.4 2002/12/24 15:17:17 russgold Exp $
5 | *
6 | * Copyright (c) 2000-2002 by Russell Gold
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
9 | * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
11 | * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 | * of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
17 | * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | *
22 | *******************************************************************************************************************/
23 |
24 | /**
25 | * A utility class to convert to and from base 64 encoding.
26 | *
27 | * @author Russell Gold
28 | **/
29 | public class Base64 {
30 |
31 | final static String encodingChar = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
32 |
33 |
34 | /**
35 | * Returns the base 64 encoded equivalent of a supplied string.
36 | * @param source the string to encode
37 | */
38 | public static String encode( String source ) {
39 | char[] sourceBytes = getPaddedBytes( source );
40 | int numGroups = (sourceBytes.length + 2) / 3;
41 | char[] targetBytes = new char[4];
42 | char[] target = new char[ 4 * numGroups ];
43 |
44 | for (int group = 0; group < numGroups; group++) {
45 | convert3To4( sourceBytes, group*3, targetBytes );
46 | for (int i = 0; i < targetBytes.length; i++) {
47 | target[ i + 4*group ] = encodingChar.charAt( targetBytes[i] );
48 | }
49 | }
50 |
51 | int numPadBytes = sourceBytes.length - source.length();
52 |
53 | for (int i = target.length-numPadBytes; i < target.length; i++) target[i] = '=';
54 | return new String( target );
55 | }
56 |
57 |
58 | private static char[] getPaddedBytes( String source ) {
59 | char[] converted = source.toCharArray();
60 | int requiredLength = 3 * ((converted.length+2) /3);
61 | char[] result = new char[ requiredLength ];
62 | System.arraycopy( converted, 0, result, 0, converted.length );
63 | return result;
64 | }
65 |
66 |
67 | private static void convert3To4( char[] source, int sourceIndex, char[] target ) {
68 | target[0] = (char) ( source[ sourceIndex ] >>> 2);
69 | target[1] = (char) (((source[ sourceIndex ] & 0x03) << 4) | (source[ sourceIndex+1 ] >>> 4));
70 | target[2] = (char) (((source[ sourceIndex+1 ] & 0x0f) << 2) | (source[ sourceIndex+2 ] >>> 6));
71 | target[3] = (char) ( source[ sourceIndex+2 ] & 0x3f);
72 | }
73 |
74 |
75 | /**
76 | * Returns the plaintext equivalent of a base 64-encoded string.
77 | * @param source a base 64 string (which must have a multiple of 4 characters)
78 | */
79 | public static String decode( String source ) {
80 | if (source.length()%4 != 0) throw new RuntimeException( "valid Base64 codes have a multiple of 4 characters" );
81 | int numGroups = source.length() / 4;
82 | int numExtraBytes = source.endsWith( "==" ) ? 2 : (source.endsWith( "=" ) ? 1 : 0);
83 | byte[] targetBytes = new byte[ 3*numGroups ];
84 | byte[] sourceBytes = new byte[4];
85 | for (int group = 0; group < numGroups; group++) {
86 | for (int i = 0; i < sourceBytes.length; i++) {
87 | sourceBytes[i] = (byte) Math.max( 0, encodingChar.indexOf( source.charAt( 4*group+i ) ) );
88 | }
89 | convert4To3( sourceBytes, targetBytes, group*3 );
90 | }
91 | return new String( targetBytes, 0, targetBytes.length - numExtraBytes );
92 | }
93 |
94 |
95 | private static void convert4To3( byte[] source, byte[] target, int targetIndex ) {
96 | target[ targetIndex ] = (byte) (( source[0] << 2) | (source[1] >>> 4));
97 | target[ targetIndex+1 ] = (byte) (((source[1] & 0x0f) << 4) | (source[2] >>> 2));
98 | target[ targetIndex+2 ] = (byte) (((source[2] & 0x03) << 6) | (source[3]));
99 | }
100 |
101 | }
--------------------------------------------------------------------------------
/Android Version/app/src/main/java/cn/sunflyer/simpnk/control/ConfigController.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.control;
2 |
3 | import android.app.Application;
4 |
5 | import java.io.File;
6 | import java.io.FileInputStream;
7 | import java.io.FileOutputStream;
8 | import java.io.IOException;
9 | import java.util.Properties;
10 |
11 | /**
12 | * 配置文件控制类
13 | * @version 1.5.0
14 | * @author CrazyChen
15 | * @since Simple Netkeeper 1.5.0
16 | * */
17 | public class ConfigController {
18 |
19 | /**
20 | * properties
21 | * */
22 | private static Properties gPro = null ;
23 |
24 | /**配置文件版本*/
25 | private static int gProVersion = 6;
26 |
27 | /**
28 | * 返回配置文件版本号
29 | * */
30 | public static int getConfigVersion(){
31 | return gProVersion;
32 | }
33 |
34 | /**
35 | * 配置文件位置
36 | * */
37 | private static String gConfigPath = "";
38 |
39 | public static void setConfigPath(String szPath){
40 | gConfigPath = szPath;
41 | }
42 |
43 | /**
44 | * 获取制定的配置数据。如果不存在会返回空字符串
45 | * */
46 | public static String getConfig(String szConfigName){
47 | return (gPro!=null && !gPro.isEmpty()) ? (gPro.getProperty(szConfigName) == null ? "" : gPro.getProperty(szConfigName)) : "";
48 | }
49 |
50 | /**
51 | * 获取制定配置数值
52 | * @param szConfigName 配置项目名称
53 | * @param defVal 默认值,如果没有找到该项,则返回这个默认值
54 | * */
55 | public static int getConfig(String szConfigName,int defVal){
56 | if(szConfigName != null && !szConfigName.equals("")){
57 | try{
58 | return Integer.parseInt(ConfigController.getConfig(szConfigName));
59 | }catch(Exception e){
60 | Log.log("尝试转换配置文件数值出现错误");
61 | }
62 | }
63 | return defVal;
64 | }
65 |
66 | /**
67 | * 制定配置文件的值是否与给定的值相等。如果配置不存在,返回给定的默认值
68 | * @param szConfigName 配置项目名称
69 | * @param szCompareData 比较数据
70 | * @param defVal 默认值
71 | * */
72 | public static boolean getConfig(String szConfigName, String szCompareData,boolean defVal ){
73 | if(szConfigName != null && !szConfigName.equals("")){
74 | String pConfig = getConfig(szConfigName);
75 | return pConfig == null ? szCompareData == null : pConfig.equals(szCompareData);
76 | }
77 | return defVal;
78 | }
79 |
80 | /**
81 | * 更新配置项目
82 | * @param szConfigName
83 | * @param szConfigVal
84 | * @return
85 | * */
86 | public static boolean updateConfig(String szConfigName,String szConfigVal){
87 | if(gPro!=null && szConfigName!=null && szConfigVal!=null && !szConfigName.equals("")){
88 | gPro.setProperty(szConfigName, szConfigVal);
89 |
90 | return true;
91 | }
92 | return false;
93 | }
94 |
95 | public static boolean saveConfig(String szFileName){
96 | StatusController.saveConfig();
97 |
98 | if(gPro!=null && !gPro.isEmpty()){
99 | try {
100 | updateConfig(Config_Application_ConfVer, Config_Application_CurrentVersion);
101 | gPro.store(new FileOutputStream(new File(szFileName)), Config_Comment);
102 | return true;
103 | } catch (IOException e) {
104 | Log.logE(e);
105 | }
106 | }
107 | return false;
108 | }
109 |
110 | public static boolean loadConfig(String szFileName){
111 | if(szFileName!=null && !szFileName.equals("")){
112 | File pConfigFile = new File(szFileName);
113 | if(pConfigFile.exists()){
114 | gPro = new Properties();
115 | try {
116 | gPro.load(new FileInputStream(pConfigFile));
117 | if(!gPro.isEmpty()){
118 | String pConVer = gPro.getProperty(Config_Application_ConfVer);
119 |
120 | if(pConVer != null){
121 | gProVersion = Integer.parseInt(pConVer);
122 | return true;
123 | }
124 | }
125 | } catch (Exception e) {
126 | Log.logE(e);
127 | }
128 | }
129 | }
130 | gPro = new Properties();
131 |
132 | return false;
133 | }
134 |
135 | public static boolean saveConfig(){
136 | return saveConfig(gConfigPath+"/"+CONFIG_FILE);
137 | }
138 |
139 | public static boolean loadConfig(){
140 | return loadConfig(gConfigPath+"/"+CONFIG_FILE);
141 | }
142 |
143 | private static boolean removeConfigFile(String szFileName){
144 | if(szFileName!=null && !szFileName.equals("")){
145 | File pFile = new File(szFileName);
146 | if(pFile.exists()){
147 | return pFile.delete();
148 | }
149 | return true;
150 | }
151 | return false;
152 | }
153 |
154 | public static boolean clearConfig(){
155 | if(gPro!=null){
156 | gPro.clear();
157 | removeConfigFile(gConfigPath+"/"+CONFIG_FILE);
158 | return gPro.isEmpty();
159 | }
160 | return true;
161 | }
162 |
163 | //========================================================================
164 |
165 | private static final String Config_Comment = "Simple Netkeeper User Configuaration Files";
166 |
167 | public static final String Config_Acc_Name="AccName";
168 | public static final String Config_Acc_Password="AccPassword";
169 | public static final String Config_Router_IP="RouterIP";
170 | public static final String Config_Router_Name="RouterAdmin";
171 | public static final String Config_Router_Password="RouterPassword";
172 | public static final String Config_Router_AuthMethod="AuthMethod";
173 | public static final String Config_Router_DialMode="DialMode";
174 | public static final String Config_Router_DialPlace="DialPlace";
175 | public static final String Config_Router_DialRadiusDefined = "enc.radius";
176 | public static final String Config_Router_DialRadiusPrefix = "enc.prefix";
177 | public static final String Config_Router_Encrypt="Encrypt";
178 | public static final String Config_Router_Manufactor="Manufactor";
179 |
180 | private static final String Config_Application_ConfVer="ConfigVersion";
181 |
182 | public static final String Config_Dial_Acc_Name="DialAccName";
183 | public static final String Config_Dial_Acc_Password="DialAccPassword";
184 | public static final String Config_Dial_is_Rem="DialAccRem";
185 | public static final String Config_Dial_is_HeartBeat="DialHeartBeat";
186 | public static final String Config_Dial_is_AutoDial="DialAuto";
187 |
188 | public static final String Config_Wifi_SSID="WifiSSID";
189 | public static final String Config_Wifi_Password="WifiPassword";
190 |
191 | public static final String Config_Ontime_Mode = "ontime.mode",
192 | Config_Ontime_SH = "ontime.starthour",
193 | Config_Ontime_SM = "ontime.startmin",
194 | Config_Ontime_EH = "ontime.endhour",
195 | Config_Ontime_EM = "ontime.endmin",
196 | Config_Ontime_SD = "ontime.startday",
197 | Config_Ontime_ED = "ontime.endday",
198 | Config_Ontime_WifiName = "ontime.wifiname",
199 | Config_Ontime_WifiKey = "ontime.wifikey";
200 |
201 |
202 | public static final String Config_Application_CurrentVersion="6";
203 |
204 | //========================================================================
205 | public static final String CONFIG_FILE = "SimpleNetkeeper.conf";
206 | }
207 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/java/cn/sunflyer/simpnk/control/DialController.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.control;
2 |
3 | import android.os.Bundle;
4 | import android.os.Message;
5 |
6 | import java.util.HashMap;
7 |
8 | import cn.sunflyer.simpnk.obj.Router;
9 | import cn.sunflyer.simpnk.obj.RouterMecuryTPF;
10 | import cn.sunflyer.simpnk.obj.RouterMecuryTpNew;
11 | import cn.sunflyer.simpnk.obj.RouterTpLinkNew;
12 |
13 | /**
14 | * @author CrazyChen
15 | * @version 1.5.0
16 | * @since Simple Netkeeper 1.5.0
17 | * */
18 | public class DialController {
19 |
20 |
21 | public static void dialRouter(){
22 | new Thread(new Runnable(){
23 |
24 | @Override
25 | public void run() {
26 |
27 | int pDialMod = StatusController.getStateRouterAuthMethod() != Router.AUTH_NOT_AVALIABLE ? StatusController.getStateRouterAuthMethod() : Router.getRouterAccessMethod(StatusController.sRouterAdd);
28 | if(pDialMod == Router.AUTH_NOT_AVALIABLE){
29 |
30 | HashMap routerList = new HashMap<>();
31 | //401 First
32 | StatusController.setStateRouterAuthMethod(Router.AUTH_OLD);
33 | Router r = new RouterMecuryTPF();
34 | if(StatusController.getStateRouterAuthMethod() != Router.AUTH_NOT_AVALIABLE){
35 | DialController.dialRouter();
36 | }else{
37 | StatusController.setStateRouterAuthMethod(Router.AUTH_DYNAMIC_ID);
38 | r = new RouterMecuryTpNew();
39 | if(StatusController.getStateRouterAuthMethod() != Router.AUTH_NOT_AVALIABLE){
40 | DialController.dialRouter();
41 | }else{
42 | sendMessage("没有访问路由器的方式。请检查路由器是否被支持。此外,如果你使用TP-LINK系列新版路由器(TP-LINK 886N等),请在设置向导修改路由器品牌为“TP-LINK”新版本后重试。");
43 | StatusController.setStateRouterDial(false);
44 | }
45 | }
46 | }
47 | else{
48 | //设置验证方式
49 | StatusController.setStateRouterAuthMethod(pDialMod);
50 | StatusController.setStateRouterDial(true);
51 | //保存配置文件
52 | ConfigController.saveConfig();
53 |
54 | switch(pDialMod){
55 | case Router.AUTH_OLD:
56 | case Router.AUTH_PASSWORD_ONLY:
57 | case Router.AUTH_WEB:{
58 | final RouterMecuryTPF pRou = new RouterMecuryTPF();
59 | new Thread(new DialThread(pRou,pDialMod)).start();
60 | }break;
61 | case Router.AUTH_DYNAMIC_ID:{
62 | final RouterMecuryTpNew pRou = new RouterMecuryTpNew();
63 | new Thread(new DialThread(pRou,Router.AUTH_DYNAMIC_ID)).start();
64 | }break;
65 | case Router.AUTH_DYNAMIC_ID_TP:{
66 | new Thread(new DialThread(new RouterTpLinkNew() , Router.AUTH_DYNAMIC_ID_TP)).start();
67 | }break;
68 | default:
69 | sendMessage("验证方式存在错误,无法执行操作");
70 | StatusController.setStateRouterDial(false);
71 | }
72 |
73 | }
74 | }
75 |
76 |
77 | }).start();
78 |
79 | }
80 |
81 |
82 |
83 | public static void sendMessage(String pMsg){
84 | MessageHandler.sendMessage(MessageHandler.MSG_ACTION_LOG_AND_REFRESH , pMsg);
85 | }
86 |
87 | public static void sendMessageCompleteDial(){
88 | MessageHandler.sendMessage(MessageHandler.MSG_ACTION_DIAL_COMPLETE , "");
89 | }
90 |
91 | public static void sendMessageCompleteTrack(){
92 | MessageHandler.sendMessage(MessageHandler.MSG_ACTION_TRACK_COMPLETE , "");
93 | }
94 |
95 | static class DialThread implements Runnable{
96 |
97 | private Router m = null;
98 | private int am = Router.AUTH_NOT_AVALIABLE;
99 |
100 | public DialThread(Router r,int am){
101 | this.m = r;
102 | this.am = am;
103 | }
104 | @Override
105 | public void run() {
106 |
107 | int pDialRes = Router.RES_NO_DIAL_MODE;
108 |
109 | pDialRes = m.connect();
110 |
111 | DialController.sendMessage(pDialRes == Router.RES_IO_EXCEPTION ? Router.RES_TIPS[pDialRes] + m.LAST_EXCEPTION_STRING : Router.RES_TIPS[pDialRes]);
112 | //发送拨号完毕的消息
113 | DialController.sendMessageCompleteDial();
114 | //如果拨号成功,启动追踪
115 | if(pDialRes == Router.RES_SUCCESS){
116 | m.trackLink();
117 | //发送追踪完毕
118 | DialController.sendMessageCompleteTrack();
119 | }
120 | //隐藏BLOCK
121 | MessageHandler.sendMessage(MessageHandler.MSG_ACTION_HIDE_BLOCK,"");
122 | //取消状态
123 | StatusController.setStateRouterDial(false);
124 | }
125 |
126 |
127 | }
128 |
129 | }
130 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/java/cn/sunflyer/simpnk/control/Log.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.control;
2 |
3 | import android.os.Environment;
4 |
5 | import java.io.File;
6 | import java.io.FileWriter;
7 | import java.io.IOException;
8 | import java.util.Date;
9 | import java.util.Properties;
10 |
11 | public class Log {
12 | public static final String gLogFileName="NetkeeperLog.log";
13 | public static final String gLogFilePathWindows="C:\\";
14 | public static final String gLogFilePathLinux="/usr/share/";
15 | public static final String gLogFilePathAndroid = Environment.getExternalStorageDirectory().toString();
16 | public static final String nLine=System.getProperties().getProperty("line.separator");
17 | private static File gLogFile=null;
18 |
19 | private static boolean gIsInit=false;
20 |
21 | private static FileWriter mLogger=null;
22 | private static String gLogPath=null;
23 | private static int gInitErrorTime=0;
24 | public static final int gInitErrorTimeLimit=6;
25 |
26 | public static void initLogger(String FilePath){
27 | gLogPath=FilePath;
28 | gLogFile=new File(gLogPath,Log.gLogFileName);
29 | try{
30 | if(!gLogFile.exists()){
31 | gLogFile.createNewFile();
32 | }
33 | mLogger = new FileWriter(Log.gLogFile,true);
34 | gIsInit=true;
35 | }
36 | catch(Exception ex){
37 | ex.printStackTrace();
38 | gIsInit=false;
39 | Log.gInitErrorTime++;
40 | }
41 | }
42 |
43 | public static boolean isInit(){
44 | return gIsInit;
45 | }
46 |
47 | public static void log(String pCon){
48 | if(isInit()){
49 | try {
50 | mLogger.write(new Date()+" - "+pCon+Log.nLine);
51 | mLogger.flush();
52 | } catch (IOException e) {
53 | e.printStackTrace();
54 | }
55 | }else{
56 | if(Log.gInitErrorTime>= 0x20; //右移32位
64 | t >>= 0x01; //右移1位
65 | m_time1c = (long) t; //强制转换
66 |
67 | m_lasttimec = m_time1c;
68 |
69 | t = m_time1c;
70 | by2[3] = intToByte(t & 0xFF);
71 | by2[2] = intToByte((t & 0xFF00) / 0x100) ;
72 | by2[1] = intToByte((t & 0xFF0000) / 0x10000);
73 | by2[0] = intToByte((t & 0xFF000000) / 0x1000000);
74 |
75 | //System.out.println(by2[3]+" "+by2[2]+" "+by2[1]+" "+by2[0]);
76 |
77 | /**
78 | * 倒置过程m_time1convert为结果
79 | */
80 | int t0=0, t1, t2, t3;
81 | t0 = (int) m_time1c;
82 | t1 = t0;
83 | t2 = t0;
84 | t3 = t0;
85 | t3 = t3 << 0x10;
86 | t1 = t1 & 0x0FF00;
87 | t1 = t1 | t3;
88 | t3 = t0;
89 | t3 = t3 & 0x0FF0000;
90 | t2 = t2 >> 0x10;
91 | t3 = t3 | t2;
92 | t1 = t1 << 0x08;
93 | t3 = t3 >> 0x08;
94 | t1 = t1 | t3;
95 | m_time1convert = t1;
96 |
97 | //System.out.println(m_time1convert);
98 |
99 | /**
100 | * 源数据1,对m_time1convert进行计算得到格式符源数据
101 | */
102 |
103 | long tc=0;
104 | tc = m_time1convert;
105 | ss[3] = trans(tc & 0xFF);
106 | ss[2] = trans((tc & 0xFF00) / 0x100) ;
107 | ss[1] = trans((tc & 0xFF0000) / 0x10000);
108 | ss[0] = trans((tc & 0xFF000000) / 0x1000000);
109 |
110 | //System.out.println(ss[3]+" "+ss[2]+ " "+ss[1]+ " "+ss[0]);
111 | /**
112 | * 格式符初加密
113 | */
114 | char pp[] ={0,0,0,0};
115 | int i = 0, j = 0, k = 0;
116 | for (i = 0; i < 0x20; i++){
117 | j = i / 0x8;
118 | k = 3 - (i % 0x4);
119 | pp[k] *= 0x2;
120 | if (ss[j] % 2 == 1){
121 | pp[k]++;
122 | }
123 | ss[j] /= 2;
124 | }
125 |
126 | /**
127 | * 格式符计算,m_formatsring为结果
128 | */
129 | char pf[] ={0,0,0,0,0,0};
130 | short st1,st2 ;
131 | st1 = (short) pp[3];
132 | st1 /= 0x4;
133 | pf[0] = trans(st1);
134 | st1 = (short) pp[3];
135 | st1 = (short) (st1 & 0x3);
136 | st1 *= 0x10;
137 | pf[1] = trans(st1);
138 | st2 = (short) pp[2];
139 | st2 /= 0x10;
140 | st2 = (short) (st2 | st1);
141 | pf[1] = trans(st2);
142 | st1 = (short) pp[2];
143 | st1 = (short) (st1 & 0x0F);
144 | st1 *= 0x04;
145 | pf[2] = trans(st1);
146 | st2 = (short) pp[1];
147 | st2 /= 0x40;
148 | st2 = (short) (st2 | st1);
149 | pf[2] = trans(st2);
150 | st1 = (short) pp[1];
151 | st1 = (short) (st1 & 0x3F);
152 | pf[3] = trans(st1);
153 | st2 = (short) pp[0];
154 | st2 /= 0x04;
155 | pf[4] = trans(st2);
156 | st1 = (short) pp[0];
157 | st1 = (short) (st1 & 0x03);
158 | st1 *= 0x10;
159 | pf[5] = trans(st1);
160 |
161 | /* String arr="";
162 | for(int x=0;x<6;x++){
163 | arr+=(pf[x]+" ");
164 | }
165 | System.out.println(arr);*/
166 |
167 | for (int n = 0; n < 6; n++){
168 | pf[n] += 0x20;
169 | if ((pf[n]) >= 0x40){
170 | pf[n]++;
171 | }
172 | }
173 |
174 | //System.out.println("m_f"+m_formatsring);
175 |
176 | for (int m = 0; m < 6; m++){
177 | m_formatsring += pf[m];
178 | }
179 |
180 | //System.out.println("m_f"+m_formatsring);
181 |
182 | String strInput;
183 | String strtem;
184 | if(m_username.contains("@")){
185 | strtem=m_username.substring(0, m_username.indexOf("@"));
186 | }else{
187 | strtem=m_username;
188 | }
189 | strInput = strtem + RADIUS;
190 | byte[] temp=new byte[by2.length+strInput.getBytes().length];
191 | System.arraycopy(by2, 0, temp, 0, by2.length);
192 | System.arraycopy(strInput.getBytes(),0,temp,by2.length,strInput.getBytes().length);
193 | m_md5 = MD5.getMD5(temp);
194 |
195 | //System.out.println("m5:"+m_md5);
196 | m_md5use = m_md5.substring(0, 2);
197 | m_realusername = m_formatsring + m_md5use + m_username;
198 | m_realusername = prefix + m_realusername;//前面两位为回车换行0D0A,接着再是后续的
199 |
200 | return m_realusername;
201 | }
202 |
203 | /**获取即时账号*/
204 | public String Realusername(){
205 | long time=(new Date()).getTime();//得到系统时间,从1970.01.01.00:00:00 开始的秒数
206 | return this.Realusername(time);
207 | }
208 |
209 |
210 | }
211 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/java/cn/sunflyer/simpnk/netkeeper/MD5.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.netkeeper;
2 |
3 | /**
4 | * MD5的算法在RFC1321 中定义
5 | * 在RFC 1321中,给出了Test suite用来检验你的实现是否正确:
6 | * MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
7 | * MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661
8 | * MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72
9 | * MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0
10 | * MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b
11 | *
12 | * @author haogj
13 | *
14 | * 传入参数:一个字节数组
15 | * 传出参数:字节数组的 MD5 结果字符串
16 | */
17 | public class MD5 {
18 | public static String getMD5(byte[] source) {
19 | String s = null;
20 | char hexDigits[] = { // 用来将字节转换成 16 进制表示的字符
21 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
22 | try
23 | {
24 | java.security.MessageDigest md = java.security.MessageDigest.getInstance( "MD5" );
25 | md.update( source );
26 | byte tmp[] = md.digest(); // MD5 的计算结果是一个 128 位的长整数,
27 | // 用字节表示就是 16 个字节
28 | char str[] = new char[16 * 2]; // 每个字节用 16 进制表示的话,使用两个字符,
29 | // 所以表示成 16 进制需要 32 个字符
30 | int k = 0; // 表示转换结果中对应的字符位置
31 | for (int i = 0; i < 16; i++) { // 从第一个字节开始,对 MD5 的每一个字节
32 | // 转换成 16 进制字符的转换
33 | byte byte0 = tmp[i]; // 取第 i 个字节
34 | str[k++] = hexDigits[byte0 >>> 4 & 0xf]; // 取字节中高 4 位的数字转换,
35 | // >>> 为逻辑右移,将符号位一起右移
36 | str[k++] = hexDigits[byte0 & 0xf]; // 取字节中低 4 位的数字转换
37 | }
38 | s = new String(str); // 换后的结果转换为字符串
39 |
40 | }catch( Exception e )
41 | {
42 | e.printStackTrace();
43 | }
44 | return s;
45 | }
46 | }
--------------------------------------------------------------------------------
/Android Version/app/src/main/java/cn/sunflyer/simpnk/obj/WiFiInfo.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.obj;
2 |
3 | public class WiFiInfo {
4 | private String gWifiName;
5 | private String gWifiPassword;
6 | private boolean gWifiBroadCast;
7 |
8 | public WiFiInfo(String name,String key,boolean allowBroadCast){
9 | this.setWifiName(name);
10 | this.setWifiBroadCast(allowBroadCast);
11 | this.setWifiPassword(key);
12 | }
13 |
14 | public WiFiInfo(String name,String key){
15 | this(name,key,true);
16 | }
17 |
18 | public String getWifiName() {
19 | return gWifiName;
20 | }
21 |
22 | public void setWifiName(String gWifiName) {
23 | this.gWifiName = gWifiName;
24 | }
25 |
26 | public String getWifiPassword() {
27 | return gWifiPassword;
28 | }
29 |
30 | public void setWifiPassword(String gWifiPassword) {
31 | this.gWifiPassword = gWifiPassword;
32 | }
33 |
34 | public boolean isWifiBroadCast() {
35 | return gWifiBroadCast;
36 | }
37 |
38 | public void setWifiBroadCast(boolean gWifiBroadCast) {
39 | this.gWifiBroadCast = gWifiBroadCast;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/anim/rotate_repeat.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
13 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/aperture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/aperture.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/arrowtop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/arrowtop.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/badge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/badge.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 | -
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/button_list_a.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/button_qd.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 | -
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/error.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/file.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/input.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | -
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/input_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | -
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/input_middle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | -
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/load.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/load.gif
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/ok.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/ok.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/spinner.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | -
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/w1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/w1.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/w10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/w10.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/w11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/w11.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/w2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/w2.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/w3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/w3.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/w4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/w4.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/w5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/w5.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/w6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/w6.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/w7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/w7.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/w8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/w8.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/w9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/w9.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/wait_anim.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/drawable/wifi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/drawable/wifi.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/layout/activity_config_router.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
20 |
21 |
28 |
29 |
35 |
36 |
44 |
45 |
56 |
57 |
67 |
68 |
69 |
70 |
78 |
79 |
88 |
89 |
96 |
97 |
107 |
108 |
119 |
120 |
130 |
131 |
132 |
133 |
134 |
135 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/layout/activity_first_run.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
19 |
20 |
24 |
25 |
30 |
31 |
39 |
40 |
41 |
52 |
53 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/layout/activity_options.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
18 |
19 |
24 |
25 |
29 |
30 |
39 |
40 |
41 |
42 |
46 |
47 |
51 |
52 |
59 |
60 |
67 |
68 |
74 |
75 |
86 |
87 |
98 |
99 |
111 |
112 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/layout/ques_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
26 |
27 |
31 |
32 |
42 |
43 |
44 |
45 |
52 |
53 |
63 |
64 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/layout/spinner_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/layout/waiting_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
27 |
28 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/menu/menu_config_router.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/menu/menu_first_run.xml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/menu/menu_options.xml:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/mipmap-hdpi/applogo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/mipmap-hdpi/applogo.jpg
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/mipmap-mdpi/applogo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/mipmap-mdpi/applogo.jpg
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/mipmap-xhdpi/applogo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/mipmap-xhdpi/applogo.jpg
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/mipmap-xxhdpi/applogo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/mipmap-xxhdpi/applogo.jpg
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Android Version/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #66000000
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Simple Netkeeper
3 | 欢迎使用Simple Netkeeper
4 | 现在连接
5 | 设置向导
6 | 用户信息
7 | 若需要设置新的路由器,请点击“设置向导”。\n免费软件,拿来卖路由器或者"技术"的请自重。
8 | WIFI网络状态:未连接
9 | 设置向导
10 | 定时连接
11 | ?
12 | By CrazyChen @ CQUT https://sunflyer.cn
13 |
14 | 定时拨号设置
15 | 请选择设置方式:
16 | 预设置模式 - 由我的路由器定时连接
17 | 提醒模式 - 由我的安卓设备定时连接
18 | 设置定时拨号的时间:\n请设置拨号时间。如果你使用提醒模式,则可以不用设置断网时间。
19 | 保存设置
20 | 现在设置
21 | 拨号时间
22 | 时
23 | 分
24 | 断网时间
25 | 时
26 | 分
27 | 设置后台拨号时间段(提醒模式):\n(以周日为第一天并用0表示,周一为1,周六则为6。\n例如,设置星期一到星期五,则输入1,5;设置整周都要拨号,输入0,6)
28 | 设置无线网络(提醒模式):
29 | WIFI名称(留空则为当前)
30 | WIFI的密码
31 | 起始日
32 | 结束日
33 | 使用须知:\n定时拨号功能可帮助你实现在指定时间段设置路由器拨号连接上网\n目前可选实现方式有两种:\n\n预设置模式 : 在断网后,由你手动设置路由器在指定时间自动拨号。在设置后现有网络连接会被立即断开。使用到了路由器拨号模式中的定时拨号功能(仅适用于TP/水星/FAST的旧版路由器),这项功能不需要你保持手机开机状态。但是由于使用此功能一般都在断网后,因此除非你是夜猫子,或者断网时你一般还没有休息,不然的话建议使用第二种模式。\n\n提醒模式 : 与你的闹钟类似,在你设置的时间由应用程序通过后台服务设置你的路由器,需要你的手机处于开机状态。你需要提供起始时间、设置的时间段(从星期x到星期y),以及要设置的无线网络名称和密码(这里是WiFi密码,请注意)。在连接成功后,程序会在通知栏显示一条提示信息,以告知最终连接结果。如果指定时间之后没有出现提示,一般是由于连接无线网出现错误,或者你的时间段设置有误。
34 |
35 | 路由器设置向导
36 | 欢迎使用Simple Netkeeper\n\n软件为免费软件,如果你是从某些“卖破解路由器”或者某些“技术人员”手中得到的,请立即退货!!!因为会导致各种情况比如坑爹啦坑钱啦等等。\n另外,如果这些人收了你20以上(带路由器收了70以上)的所谓“破解费用”的话,直接带刀砍奸商吧,骚年,你已经被坑惨了。\n\n在准备设置向导之前,请您确认:\n\n--本软件目前适用于 水星,TP-LINK,FAST 的大多数路由器,腾达,斐讯等路由器暂时不在支持范围\n\n--路由器的WAN口与墙上的网线已接好\n\n--路由器的管理密码(不是WIFI密码,而是你登录路由器管理界面的密码!)你已经设置好,而不是空密码\n\n--路由器的WIFI功能已经配置完毕(包括WIFI名称,密码,个人建议关闭路由器您的WPS功能,因为WPS功能容易导致蹭网发生)\n\n--这台设备已经连接到了你路由器的无线网络(也就是连接到了你的WIFI)\n\n--对于使用新版本固件的路由器(比如水星的MW313R,TP-LINK的部分TL-842N路由器):\n请在路由器管理界面,点击右上角“高级设置”\n然后点击左边的“网络设置”\n在右边选择“上网方式”为“宽带拨号上网”,账号和密码随便填写即可\n然后滚动到下方,拨号方式选择为“手动拨号”\n点击勾勾保存设置。\n\n在确认以上操作执行完成后,请在下方选择你的路由器型号,然后点击按钮开始操作
37 | 开始设置
38 | 选择你的路由器品牌
39 |
40 | 用户信息设置
41 | 宽带账号名称
42 | 宽带账号密码
43 | 路由器IP地址
44 | 路由器管理员用户名
45 | 路由器管理员密码
46 | 设置使用区域
47 | 立即设置
48 | 我所在的地区不在列表中
49 | 设置Radius
50 | 设置Prefix(默认请填写\\r\\n)
51 | 保存全部信息
52 | 准备就绪
53 | 切换内网
54 | 当前状态
55 | 使用说明:\n\n--从上到下的输入框分别为宽带账号,宽带密码,路由器地址,路由器账号,路由器密码\n\n--“切换内网”会将路由器连接转换为动态IP模式以使用内网,此时拨号连接会被断开。“当前状态”可以查询路由器当前连接状态。“内网切换”目前仅对2014年上半年及以前的水星/TP/FAST路由器有效\n\n--如果你使用了设置向导,一般情况下路由器管理员用户名和路由器地址是不需要你进行操作的,保持默认即可。\n\n--路由器密码是你登录路由器设置界面所需要的密码,而不是你的Wifi密码!\n\n--如果勾选了保存设置,则在你点击设置按钮以后,程序会将你所输入的信息保存到数据文件中,下次启动时会自动载入这些数据,而不需要你重复输入。\n\n--如果在设置路由器过程中出现了问题,比如提示连接失败,追踪错误,验证失败,一般情况下是因为路由器接线或者你所输入的信息错误导致。其他的错误提示请参见我个人博客中对错误内容的解释。
56 |
57 | 其他......
58 | Simple Netkeeper For Android
59 | 版权所有 2014~2015 CrazyChen@CQUT\n\n程序不得被用于任何形式的商业用途,拿来卖钱的奸商和所谓“技术人员”请自重,为了一点钱卖掉你的智商我也是不想说多话了。People is people , dog is dog。\n\n程序使用过程中不会有任何形式的收费存在,也不会收集任何隐私信息。\n\n由于个人对Android开发只是停留在“知道这个但是不知道那个”的情况,使用过程中难免会出现一些问题,还请理解!也欢迎访问我的个人博客提出意见与建议!
60 | 检查更新
61 | 发送错误日志
62 | 访问我的博客
63 | 访问 Crazy For Code 团队官网
64 | 版本。骚年,如果你是想着改这东西赚钱的话,别想了,回家种田去吧。people is people,dog is dog
65 |
66 | 请稍候......
67 |
68 | Simple Netkeeper
69 | This is a dialog for showing information,if you see this,pls tell me what you are doing when this happened so that I can fix it,thanks
70 | Ok
71 | No
72 |
73 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/values/strings_activity_options.xml:
--------------------------------------------------------------------------------
1 |
2 | 其他选项
3 |
4 |
5 |
6 |
7 | General
8 |
9 | Enable social recommendations
10 | Recommendations for people to contact
11 | based on your message history
12 |
13 |
14 | Display name
15 | John Smith
16 |
17 | Add friends to messages
18 |
19 | - Always
20 | - When possible
21 | - Never
22 |
23 |
24 | - 1
25 | - 0
26 | - -1
27 |
28 |
29 |
30 | Data & sync
31 |
32 | Sync frequency
33 |
34 | - 15 minutes
35 | - 30 minutes
36 | - 1 hour
37 | - 3 hours
38 | - 6 hours
39 | - Never
40 |
41 |
42 | - 15
43 | - 30
44 | - 60
45 | - 180
46 | - 360
47 | - -1
48 |
49 |
50 | System sync settings
51 |
52 |
53 | Notifications
54 |
55 | New message notifications
56 |
57 | Ringtone
58 | Silent
59 |
60 | Vibrate
61 |
62 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
14 |
15 |
16 |
23 |
24 |
25 |
26 |
27 |
34 |
35 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/xml/pref_data_sync.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/xml/pref_general.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
20 |
21 |
23 |
24 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/xml/pref_headers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
11 |
12 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Android Version/app/src/main/res/xml/pref_notification.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
9 |
10 |
11 |
12 |
13 |
19 |
20 |
21 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Android Version/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.3.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Android Version/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/Android Version/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
7 |
--------------------------------------------------------------------------------
/Android Version/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/Android Version/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/Android Version/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/ChangeLog.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/ChangeLog.txt
--------------------------------------------------------------------------------
/DialLib/SimpNKRasDialLib.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/DialLib/SimpNKRasDialLib.cpp
--------------------------------------------------------------------------------
/DialLib/SimpNKRasDialLib.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/DialLib/SimpNKRasDialLib.rc
--------------------------------------------------------------------------------
/DialLib/SimpNKRasDialLibx64.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/DialLib/SimpNKRasDialLibx64.dll
--------------------------------------------------------------------------------
/DialLib/SimpNKRasDialLibx86.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/DialLib/SimpNKRasDialLibx86.dll
--------------------------------------------------------------------------------
/DialLib/cqxinli_ClickDial.h:
--------------------------------------------------------------------------------
1 | /* DO NOT EDIT THIS FILE - it is machine generated */
2 | #include
3 | /* Header for class cqxinli_ClickDial */
4 |
5 | #ifndef _Included_cqxinli_ClickDial
6 | #define _Included_cqxinli_ClickDial
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 | /*
11 | * Class: cqxinli_ClickDial
12 | * Method: dialRasWindows
13 | * Signature: (Ljava/lang/String;Ljava/lang/String;)J
14 | */
15 | JNIEXPORT jlong JNICALL Java_cqxinli_ClickDial_dialRasWindows
16 | (JNIEnv *, jobject, jstring, jstring);
17 |
18 | /*
19 | * Class: cqxinli_ClickDial
20 | * Method: dialRasWindowsErrorStr
21 | * Signature: (J)Ljava/lang/String;
22 | */
23 | JNIEXPORT jstring JNICALL Java_cqxinli_ClickDial_dialRasWindowsErrorStr
24 | (JNIEnv *, jobject, jlong);
25 |
26 | #ifdef __cplusplus
27 | }
28 | #endif
29 | #endif
30 |
--------------------------------------------------------------------------------
/DialLib/dllmain.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/DialLib/dllmain.cpp
--------------------------------------------------------------------------------
/DialLib/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/DialLib/resource.h
--------------------------------------------------------------------------------
/DialLib/stdafx.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/DialLib/stdafx.cpp
--------------------------------------------------------------------------------
/DialLib/stdafx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/DialLib/stdafx.h
--------------------------------------------------------------------------------
/DialLib/targetver.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/DialLib/targetver.h
--------------------------------------------------------------------------------
/Netkeeper For Router使用文档.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/Netkeeper For Router使用文档.docx
--------------------------------------------------------------------------------
/PinCodeReverse.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SimpleNetkeeper_Tool {
4 |
5 | ///
6 | /// 转换Netkeeper账号PIN码中时间字符为实际时间戳
7 | /// 例如,加密后的账号为 \r1 ABCDEF ea 12345678@cqit
8 | /// 其中 \r1 为固定前缀 , ABCDEF为PIN码的时间戳(即使其中任意字符为空格) , ea为PIN码的MD5加密部分,后面的12345678@cqit为你本身的账号
9 | /// 用法 getTime("ABCDEF")
10 | /// 返回 时间戳的Int形式
11 | ///
12 | /// 此源代码基于GPL协议公开,请不要违反协议。虽然我知道多数中国人的劣根性本就如此。
13 | /// By CrazyChen , License under GPL
14 | class NKAcc {
15 | // 时间戳转为C#格式时间
16 | private static DateTime StampToDateTime(string timeStamp)
17 | {
18 | DateTime dateTimeStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
19 | long lTime = long.Parse(timeStamp + "0000000");
20 | TimeSpan toNow = new TimeSpan(lTime);
21 |
22 | return dateTimeStart.Add(toNow);
23 | }
24 |
25 | public static int toTime(byte[] x) {
26 | if (BitConverter.IsLittleEndian)
27 | Array.Reverse(x);
28 |
29 | return BitConverter.ToInt32(x, 0);
30 | }
31 |
32 | public static int getTime(string pinCode) {
33 | byte[] pin = Encoding.UTF8.GetBytes(pinCode);
34 |
35 | byte[] newpin = new byte[pin.Length];
36 |
37 | for (int i = 0; i < 6; i++)
38 | {
39 | if (pin[i] > 0x40)
40 | {
41 | newpin[i] = (byte)(pin[i] - 0x21);
42 | }
43 | else
44 | {
45 | newpin[i] = (byte)(pin[i] - 0x20);
46 | }
47 |
48 | }
49 | //Console.Write(BitConverter.ToString(newpin).Replace("-", " "));
50 |
51 | byte[] timeHash = new byte[4];
52 |
53 | //hash 0 高6
54 | timeHash[0] = (byte)(newpin[0] << 2);
55 | timeHash[0] = (byte)(((newpin[1] >> 4) & 0x3) | timeHash[0]);
56 |
57 |
58 | //hash 3 高6
59 | timeHash[3] = (byte)(newpin[4] << 2); //高6
60 | timeHash[3] = (byte)(timeHash[3] | (byte)(newpin[5] >> 4)); //低2
61 |
62 | //hash 2 低6
63 | timeHash[2] = newpin[3]; //低6
64 | timeHash[2] = (byte)(((newpin[2] & 0x3) << 6) | timeHash[2]); //高2
65 |
66 | //hash 1
67 | timeHash[1] = (byte)((newpin[2] >> 2) & 0xF); //低4
68 | timeHash[1] = (byte)(((newpin[1] & 0xF) << 4) | timeHash[1]); //高4
69 |
70 | int[] temp = new int[32];
71 | for (int i = 0; i < 4; i++)
72 | {
73 | temp[i] = (timeHash[i] & 128) == 0 ? 0 : 1;
74 | temp[4 + i] = (timeHash[i] & 64) == 0 ? 0 : 1;
75 | temp[8 + i] = (timeHash[i] & 32) == 0 ? 0 : 1;
76 | temp[12 + i] = (timeHash[i] & 16) == 0 ? 0 : 1;
77 | temp[16 + i] = (timeHash[i] & 8) == 0 ? 0 : 1;
78 | temp[20 + i] = (timeHash[i] & 4) == 0 ? 0 : 1;
79 | temp[24 + i] = (timeHash[i] & 2) == 0 ? 0 : 1;
80 | temp[28 + i] = (timeHash[i] & 1) == 0 ? 0 : 1;
81 | }
82 |
83 | /*
84 | for (int i = 0; i < 32; i++)
85 | {
86 | Console.Write(temp[i] + " ");
87 | }
88 | Console.WriteLine();
89 | */
90 | byte[] timestr = new byte[4];
91 | for (int i = 0; i < 4; i++)
92 | {
93 | for (int j = 0; j < 8; j++)
94 | {
95 | timestr[3 - i] += (byte)(temp[i * 8 + j] * Math.Pow(2, j));
96 | }
97 | }
98 |
99 | return toTime(timestr);
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Deprecated Project
2 |
3 | This project is no longer maintained and should be deprecated if Netkeeper client in the region you were is higher than 5.0.
4 |
5 | 此项目已过时,对于使用5.X或者更高版本的Netkeeper客户端的地区,此项目内的内容没有任何意义。
6 |
--------------------------------------------------------------------------------
/UDP心跳计算.php:
--------------------------------------------------------------------------------
1 | cas*>";
37 | $aes = new AES();
38 | $aes->set_key($key);
39 | $ret = $aes->encrypt($hrRaw );
40 |
41 | if($ret){
42 | $head = "HR70" ;
43 | $head = self::String2Hex($head);
44 | $head = $head . "0500";
45 |
46 | $len = strlen($ret) / 2;
47 | $len = dechex($len);
48 | while(strlen($len) < 8){
49 | $len = "0${len}";
50 | }
51 | //HEXed Heartbeat Raw
52 | $retData = $head . $len . $ret;
53 | return $retData;
54 | }
55 | return null;
56 | }
57 |
58 |
59 | }
60 |
61 | ?>
62 |
--------------------------------------------------------------------------------
/src/ExportHeadFile.bat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/src/ExportHeadFile.bat
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/annotation/Config.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Target(ElementType.TYPE)
10 | public @interface Config {
11 | public static final String CONFIG_STRING = "String";
12 | public static final String CONFIG_NUMBER_INT = "Integer";
13 | public static final String CONFIG_NUMBER_DOUBLE = "Double";
14 |
15 | String configName() default "New Config";
16 | String configVal() default "Null";
17 | String configType() default "String";
18 | }
19 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/control/AppInfo.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.control;
2 |
3 | public class AppInfo {
4 |
5 | /**
6 | * 版本和日期信息
7 | * */
8 | public static final int APP_VERSION_MAIN = 1 ; //主版本号
9 | public static final int APP_VERSION_SUB = 2 ; //子版本号
10 | public static final int APP_VERSION_FIX = 0 ; //修正版本
11 | public static final String APP_VERSION_BUILD = "56" ; //build
12 |
13 | public static String getVersionString(){
14 | return APP_VERSION_MAIN+"."+APP_VERSION_SUB+"."+APP_VERSION_FIX+"."+APP_VERSION_BUILD;
15 | }
16 |
17 | public static final String APP_VERSION_ST[] = {"正式版本","测试版本"};
18 |
19 | public static final int APP_VERSION_ST_CODE = 1 ;
20 |
21 | public static String getVersionStringWithRel(){
22 | return getVersionString() + (APP_VERSION_ST_CODE >= APP_VERSION_ST.length ? "Unknown" : APP_VERSION_ST[APP_VERSION_ST_CODE]);
23 | }
24 |
25 |
26 | public static final String APP_VERSION_DATE = "2015-03-20 13:00"; //版本时间
27 |
28 | /**
29 | * 程序信息
30 | * */
31 | public static final String APP_NAME = "Simple Netkeeper";
32 | public static final String APP_DES = "";
33 |
34 | public static final String APP_WEB_UPDATE = "http://www.sunflyer.cn/archives/8";
35 | public static final String APP_WEB_HELP = "http://www.sunflyer.cn/";
36 | public static final String APP_WEB_DEV = "http://www.sunflyer.cn/";
37 |
38 |
39 | /**
40 | * 作者信息
41 | * */
42 | public static final String APP_AUTHOR_NAME = "CrazyChen @ CQUT";
43 | public static final String APP_AUTHOR_MAIL = "cx@itncre.com";
44 | public static final String APP_AUTHOR_WEB = "http://www.sunflyer.cn";
45 |
46 | public static final String APP_AUTHOR_DES = "程序源代码已公开于 https://github.com/sunflyer/simplenetkeeper ";
47 |
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/control/Base64.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.control;
2 |
3 | /********************************************************************************************************************
4 | * $Id: Base64.java,v 1.4 2002/12/24 15:17:17 russgold Exp $
5 | *
6 | * Copyright (c) 2000-2002 by Russell Gold
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
9 | * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
11 | * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions
14 | * of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
17 | * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | *
22 | *******************************************************************************************************************/
23 |
24 | /**
25 | * A utility class to convert to and from base 64 encoding.
26 | *
27 | * @author Russell Gold
28 | **/
29 | public class Base64 {
30 |
31 | final static String encodingChar = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
32 |
33 |
34 | /**
35 | * Returns the base 64 encoded equivalent of a supplied string.
36 | * @param source the string to encode
37 | */
38 | public static String encode( String source ) {
39 | char[] sourceBytes = getPaddedBytes( source );
40 | int numGroups = (sourceBytes.length + 2) / 3;
41 | char[] targetBytes = new char[4];
42 | char[] target = new char[ 4 * numGroups ];
43 |
44 | for (int group = 0; group < numGroups; group++) {
45 | convert3To4( sourceBytes, group*3, targetBytes );
46 | for (int i = 0; i < targetBytes.length; i++) {
47 | target[ i + 4*group ] = encodingChar.charAt( targetBytes[i] );
48 | }
49 | }
50 |
51 | int numPadBytes = sourceBytes.length - source.length();
52 |
53 | for (int i = target.length-numPadBytes; i < target.length; i++) target[i] = '=';
54 | return new String( target );
55 | }
56 |
57 |
58 | private static char[] getPaddedBytes( String source ) {
59 | char[] converted = source.toCharArray();
60 | int requiredLength = 3 * ((converted.length+2) /3);
61 | char[] result = new char[ requiredLength ];
62 | System.arraycopy( converted, 0, result, 0, converted.length );
63 | return result;
64 | }
65 |
66 |
67 | private static void convert3To4( char[] source, int sourceIndex, char[] target ) {
68 | target[0] = (char) ( source[ sourceIndex ] >>> 2);
69 | target[1] = (char) (((source[ sourceIndex ] & 0x03) << 4) | (source[ sourceIndex+1 ] >>> 4));
70 | target[2] = (char) (((source[ sourceIndex+1 ] & 0x0f) << 2) | (source[ sourceIndex+2 ] >>> 6));
71 | target[3] = (char) ( source[ sourceIndex+2 ] & 0x3f);
72 | }
73 |
74 |
75 | /**
76 | * Returns the plaintext equivalent of a base 64-encoded string.
77 | * @param source a base 64 string (which must have a multiple of 4 characters)
78 | */
79 | public static String decode( String source ) {
80 | if (source.length()%4 != 0) throw new RuntimeException( "valid Base64 codes have a multiple of 4 characters" );
81 | int numGroups = source.length() / 4;
82 | int numExtraBytes = source.endsWith( "==" ) ? 2 : (source.endsWith( "=" ) ? 1 : 0);
83 | byte[] targetBytes = new byte[ 3*numGroups ];
84 | byte[] sourceBytes = new byte[4];
85 | for (int group = 0; group < numGroups; group++) {
86 | for (int i = 0; i < sourceBytes.length; i++) {
87 | sourceBytes[i] = (byte) Math.max( 0, encodingChar.indexOf( source.charAt( 4*group+i ) ) );
88 | }
89 | convert4To3( sourceBytes, targetBytes, group*3 );
90 | }
91 | return new String( targetBytes, 0, targetBytes.length - numExtraBytes );
92 | }
93 |
94 |
95 | private static void convert4To3( byte[] source, byte[] target, int targetIndex ) {
96 | target[ targetIndex ] = (byte) (( source[0] << 2) | (source[1] >>> 4));
97 | target[ targetIndex+1 ] = (byte) (((source[1] & 0x0f) << 4) | (source[2] >>> 2));
98 | target[ targetIndex+2 ] = (byte) (((source[2] & 0x03) << 6) | (source[3]));
99 | }
100 |
101 | }
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/control/ConfigController.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.control;
2 |
3 | import java.io.File;
4 | import java.io.FileInputStream;
5 | import java.io.FileOutputStream;
6 | import java.io.IOException;
7 | import java.util.Properties;
8 |
9 | /**
10 | * 配置文件控制器
11 | * @version 1.5.0
12 | * @author CrazyChen
13 | * @since Simple Netkeeper 1.5.0
14 | * */
15 | public class ConfigController {
16 |
17 | /**
18 | * 配置文件私有变量
19 | * */
20 | private static Properties gPro = null ;
21 |
22 | /**配置文件版本号*/
23 | private static int gProVersion = 6;
24 |
25 | /**
26 | * 获取已读取的配置文件的版本,如果版本为-1则表示读取失败
27 | * */
28 | public static int getConfigVersion(){
29 | return gProVersion;
30 | }
31 |
32 | /**
33 | * 返回对应参数名称的配置数值
34 | * 如果对应配置不存在,返回null
35 | * */
36 | public static String getConfig(String szConfigName){
37 | return (gPro!=null && !gPro.isEmpty()) ? (gPro.getProperty(szConfigName) == null ? "" : gPro.getProperty(szConfigName)) : "";
38 | }
39 |
40 | /**
41 | * 返回对应配置的整形数值
42 | * 如果数据无效,返回设置的默认值
43 | * @param szConfigName 参数名称
44 | * @param defVal 返回的默认值
45 | * */
46 | public static int getConfig(String szConfigName,int defVal){
47 | if(szConfigName != null && !szConfigName.equals("")){
48 | try{
49 | return Integer.parseInt(ConfigController.getConfig(szConfigName));
50 | }catch(Exception e){
51 | Log.log("尝试获取的参数无效");
52 | }
53 | }
54 | return defVal;
55 | }
56 |
57 | /**
58 | * 返回参数对应的布尔类型
59 | * 如果获取到的参数与指定值相同,则返回true,否则返回false。
60 | * 如果获取对应值失败,返回默认值
61 | * @param szConfigName 配置名称
62 | * @param szCompareData 对比值
63 | * @param defVal 返回的默认值
64 | * */
65 | public static boolean getConfig(String szConfigName, String szCompareData,boolean defVal ){
66 | if(szConfigName != null && !szConfigName.equals("")){
67 | String pConfig = getConfig(szConfigName);
68 | return pConfig == null ? szCompareData == null : pConfig.equals(szCompareData);
69 | }
70 | return defVal;
71 | }
72 |
73 | /**
74 | * 对特定参数设置配置数值
75 | * @param szConfigName 配置项目名称
76 | * @param szConfigVal 配置项目数值
77 | * @return 如果设置可用,返回true,否则返回false
78 | * */
79 | public static boolean updateConfig(String szConfigName,String szConfigVal){
80 | if(gPro!=null && szConfigName!=null && szConfigVal!=null && !szConfigName.equals("")){
81 | gPro.setProperty(szConfigName, szConfigVal);
82 |
83 | return true;
84 | }
85 | return false;
86 | }
87 |
88 | /**
89 | * 保存配置文件
90 | * @param szFileName 配置文件名称
91 | * */
92 | public static boolean saveConfig(String szFileName){
93 | StatusController.saveConfig();
94 |
95 | if(gPro!=null && !gPro.isEmpty()){
96 | try {
97 | updateConfig(Config_Application_ConfVer, Config_Application_CurrentVersion);
98 | gPro.store(new FileOutputStream(new File(szFileName)), Config_Comment);
99 | return true;
100 | } catch (IOException e) {
101 | Log.logE(e);
102 | }
103 | }
104 | return false;
105 | }
106 |
107 | /**
108 | * 将配置文件读取到类中
109 | * @param szFileName 文件名
110 | * */
111 | public static boolean loadConfig(String szFileName){
112 | if(szFileName!=null && !szFileName.equals("")){
113 | File pConfigFile = new File(szFileName);
114 | if(pConfigFile.exists()){
115 | gPro = new Properties();
116 | try {
117 | gPro.load(new FileInputStream(pConfigFile));
118 | if(!gPro.isEmpty()){
119 | String pConVer = gPro.getProperty(Config_Application_ConfVer);
120 |
121 | if(pConVer != null){
122 | gProVersion = Integer.parseInt(pConVer);
123 | return true;
124 | }
125 | }
126 | } catch (Exception e) {
127 | Log.logE(e);
128 | }
129 | }
130 | }
131 | gPro = new Properties();
132 |
133 | return false;
134 | }
135 |
136 | /**
137 | * 保存到默认的配置文件中
138 | * */
139 | public static boolean saveConfig(){
140 | return saveConfig(CONFIG_FILE);
141 | }
142 |
143 | /**
144 | * 读取默认配置文件
145 | * */
146 | public static boolean loadConfig(){
147 | return loadConfig(CONFIG_FILE);
148 | }
149 |
150 | /**
151 | * 删除配置文件私有方法。
152 | * */
153 | private static boolean removeConfigFile(String szFileName){
154 | if(szFileName!=null && !szFileName.equals("")){
155 | File pFile = new File(szFileName);
156 | if(pFile.exists()){
157 | return pFile.delete();
158 | }
159 | return true;
160 | }
161 | return false;
162 | }
163 |
164 | /**
165 | * 清空配置文件
166 | * */
167 | public static boolean clearConfig(){
168 | if(gPro!=null){
169 | gPro.clear();
170 | removeConfigFile(CONFIG_FILE);
171 | return gPro.isEmpty();
172 | }
173 | return true;
174 | }
175 |
176 | //========================================================================
177 | //注释
178 | private static final String Config_Comment = "Simple Netkeeper For Router User Configuaration Files\nAutomatic Generated By Simple Netkeeper";
179 |
180 | //配置文件项目名称
181 | public static final String Config_Application_DefaultMenu="AppDefaultMenu";
182 | //路由器面板数据
183 | public static final String Config_Acc_Name="AccName";
184 | public static final String Config_Acc_Password="AccPassword";
185 | public static final String Config_Router_IP="RouterIP";
186 | public static final String Config_Router_Name="RouterAdmin";
187 | public static final String Config_Router_Password="RouterPassword";
188 | public static final String Config_Router_AuthMethod="AuthMethod";
189 | public static final String Config_Router_DialMode="DialMode";
190 | public static final String Config_Router_DialPlace="DialPlace";
191 | public static final String Config_Router_Encrypt="Encrypt";
192 | public static final String Config_Router_Manufactor="Manufactor";
193 |
194 | private static final String Config_Application_ConfVer="ConfigVersion";
195 | //拨号面板数据
196 | public static final String Config_Dial_Acc_Name="DialAccName";
197 | public static final String Config_Dial_Acc_Password="DialAccPassword";
198 | public static final String Config_Dial_is_Rem="DialAccRem";
199 | public static final String Config_Dial_is_HeartBeat="DialHeartBeat";
200 | public static final String Config_Dial_is_AutoDial="DialAuto";
201 | //无线热点数据
202 | public static final String Config_Wifi_SSID="WifiSSID";
203 | public static final String Config_Wifi_Password="WifiPassword";
204 | //自定义配置文件库
205 |
206 |
207 | //配置文件版本变更请修改此项
208 | public static final String Config_Application_CurrentVersion="6";
209 |
210 | //========================================================================
211 | public static final String CONFIG_FILE = "SimpleNetkeeper.conf";
212 | }
213 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/control/DialController.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.control;
2 |
3 | import cn.sunflyer.simpnk.obj.Bundle;
4 | import cn.sunflyer.simpnk.obj.Message;
5 | import cn.sunflyer.simpnk.obj.Router;
6 | import cn.sunflyer.simpnk.obj.RouterMecuryTPF;
7 | import cn.sunflyer.simpnk.obj.RouterMecuryTpNew;
8 |
9 | /**
10 | * 拨号控制器。负责路由器拨号以及本地拨号功能实现
11 | *
12 | * @author CrazyChen
13 | * @version 1.5.0
14 | * @since Simple Netkeeper 1.5.0
15 | * */
16 | public class DialController {
17 |
18 | /**
19 | * 路由器拨号实现器
20 | * */
21 | public static void dialRouter(){
22 | StatusController.saveConfig();
23 |
24 | new Thread(new Runnable(){
25 |
26 | @Override
27 | public void run() {
28 |
29 | int pDialMod = StatusController.getStateRouterAuthMethod() != Router.AUTH_NOT_AVALIABLE ? StatusController.getStateRouterAuthMethod() : Router.getRouterAccessMethod(StatusController.sRouterAdd);
30 | if(pDialMod == Router.AUTH_NOT_AVALIABLE){
31 | sendMessage("没有可用的拨号连接模式");
32 | StatusController.setStateRouterDial(false);
33 | }
34 | else{
35 | StatusController.setStateRouterAuthMethod(pDialMod);
36 | StatusController.setStateRouterDial(true);
37 |
38 | switch(pDialMod){
39 | case Router.AUTH_OLD:
40 |
41 | case Router.AUTH_WEB:{
42 | final RouterMecuryTPF pRou = new RouterMecuryTPF();
43 | new Thread(new DialThread(pRou,pDialMod)).start();
44 | }break;
45 | case Router.AUTH_DYNAMIC_ID:{
46 | final RouterMecuryTpNew pRou = new RouterMecuryTpNew();
47 |
48 | new Thread(new DialThread(pRou,Router.AUTH_DYNAMIC_ID)).start();
49 |
50 | }break;
51 | default:
52 | sendMessage("");
53 | StatusController.setStateRouterDial(false);
54 | }
55 |
56 | }
57 | }
58 |
59 |
60 | }).start();
61 |
62 | }
63 |
64 | public static void sendMessage(String pMsg){
65 | MessageController.getInstance().sendMessage(MessageController.MessageCode.LOG_AND_TIPS_ROUTER,new Message(new Bundle("info",pMsg)));
66 | }
67 |
68 | /**
69 | * 用于路由器设置的执行类
70 | * @param r Router类
71 | * @param am 验证方式
72 | * */
73 | static class DialThread implements Runnable{
74 |
75 | private Router m = null;
76 | private int am = Router.AUTH_NOT_AVALIABLE;
77 |
78 | public DialThread(Router r,int am){
79 | this.m = r;
80 | this.am = am;
81 | }
82 | @Override
83 | public void run() {
84 |
85 | int pDialRes = Router.RES_NO_DIAL_MODE;
86 |
87 | switch(this.am){
88 | case Router.AUTH_DYNAMIC_ID:
89 | pDialRes = ((RouterMecuryTpNew)m).connect();
90 | break;
91 | case Router.AUTH_OLD:
92 | case Router.AUTH_WEB:
93 | pDialRes = ((RouterMecuryTPF)m).connect();
94 | break;
95 | default: {
96 | DialController.sendMessage("没有对应选项可用,无法执行拨号操作");
97 | return;
98 | }
99 | }
100 |
101 | switch(pDialRes){
102 | case Router.RES_SUCCESS:{
103 | DialController.sendMessage("路由器已经设置成功!现在开始追踪状态");
104 | if(this.m instanceof RouterMecuryTpNew)
105 | ((RouterMecuryTpNew)m).trackLink();
106 | else if(this.m instanceof RouterMecuryTPF)
107 | ((RouterMecuryTPF)m).trackLink();
108 | }break;
109 | case Router.RES_REQUIRE_LOGIN:
110 | DialController.sendMessage("路由器身份验证失败!");
111 | break;
112 | case Router.RES_META_DATA_NOT_INIT:
113 | DialController.sendMessage("身份验证显示您提供的信息有错误");
114 | break;
115 | case Router.RES_NO_AUTHORITY:
116 | DialController.sendMessage("无权限操作路由器,或者连接失败");
117 | break;
118 | case Router.RES_IO_EXCEPTION:
119 | DialController.sendMessage("出现了一些异常,请尝试重新设置");
120 | break;
121 | case Router.RES_UNABLE_ACCESS:
122 | DialController.sendMessage("无法访问路由器。(请确认路由器是否已经连接,或者请检查你的路由器连线是否正确)");
123 | break;
124 | default:DialController.sendMessage("未知错误,错误代码:"+pDialRes);
125 | }
126 |
127 | StatusController.setStateRouterDial(false);
128 | }
129 |
130 |
131 | }
132 |
133 | }
134 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/control/Log.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.control;
2 |
3 | import java.io.File;
4 | import java.io.FileWriter;
5 | import java.io.IOException;
6 | import java.util.Date;
7 | import java.util.Properties;
8 |
9 | public class Log {
10 | public static final String gLogFileName="NetkeeperLog.log";
11 | public static final String gLogFilePathWindows="C:\\";
12 | public static final String gLogFilePathLinux="/usr/share/";
13 | public static final String nLine=System.getProperties().getProperty("line.separator");
14 | private static File gLogFile=null;
15 | //初始化事件记录的标记
16 | private static boolean gIsInit=false;
17 |
18 | private static FileWriter mLogger=null;
19 | private static String gLogPath=null;
20 | private static int gInitErrorTime=0;
21 | public static final int gInitErrorTimeLimit=6;
22 |
23 | /**
24 | * 初始化当前记录器
25 | * @param FilePath 日志文件目录
26 | * */
27 | public static void initLogger(String FilePath){
28 | gLogPath=FilePath;
29 | gLogFile=new File(gLogPath,Log.gLogFileName);
30 | try{
31 | if(!gLogFile.exists()){
32 | gLogFile.createNewFile();
33 | }
34 | mLogger = new FileWriter(Log.gLogFile,true);
35 | gIsInit=true;
36 | }
37 | catch(Exception ex){
38 | ex.printStackTrace();
39 | gIsInit=false;
40 | Log.gInitErrorTime++;
41 | }
42 | }
43 |
44 | public static boolean isInit(){
45 | return gIsInit;
46 | }
47 |
48 | /**
49 | * 记录当前系统的部分信息,包括操作系统的名称以及JAVA版本
50 | * */
51 | public static void logSysInfo(){
52 | Properties pPro=System.getProperties();
53 | String pOsName=pPro.getProperty("os.name");
54 | String pOsVer=pPro.getProperty("os.version");
55 | String pJavaVer=pPro.getProperty("java.version");
56 | String pOsArch=pPro.getProperty("os.arch");
57 | String pJavaSpecVer=pPro.getProperty("java.specification.version");
58 | log("=========================System Information=======================");
59 | log("操作系统:"+pOsName+",版本:"+pOsVer+",架构:"+pOsArch);
60 | log("JAVA版本:"+pJavaVer+"(Spec:"+pJavaSpecVer+")");
61 | }
62 |
63 | /**
64 | * 记录一段文本。
65 | * */
66 | public static void log(String pCon){
67 | if(isInit()){
68 | try {
69 | mLogger.write(new Date()+":"+pCon+Log.nLine);
70 | mLogger.flush();
71 | } catch (IOException e) {
72 | e.printStackTrace();
73 | }
74 | }else{
75 | if(Log.gInitErrorTime mMessageList = null;
96 |
97 | public void sendMessage(MessageCode pMsgCode,Message pMsgInfo){
98 | this.mMessageCode = pMsgCode;
99 | this.mMessageInfo = pMsgInfo;
100 | this.processMessage(pMsgCode,pMsgInfo);
101 | }
102 |
103 | public void processMessage(MessageCode pMsgCode,Message pMsgInfo){
104 |
105 | }
106 |
107 | }
108 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/control/PluginController.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.control;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import cn.sunflyer.simpnk.obj.PluginDial;
7 | import cn.sunflyer.simpnk.obj.PluginRouter;
8 |
9 | public class PluginController {
10 |
11 | /**插件总目录*/
12 | public static final String PLUGIN_PATH = "plugin";
13 |
14 | /**拨号插件目录*/
15 | public static final String PLUGIN_DIAL = "dial";
16 |
17 | /**路由器插件总目录*/
18 | public static final String PLUGIN_ROUTER = "router";
19 |
20 | /**
21 | * 存放拨号插件列表
22 | * */
23 | private static List gPluginDial = new ArrayList();
24 |
25 | /**
26 | * 存放路由器插件列表
27 | * */
28 | private static List gPluginRouter = new ArrayList();
29 |
30 | /**
31 | * 注册一个拨号插件
32 | * */
33 | public static boolean addPluginDial(PluginDial x){
34 | if(x!=null){
35 |
36 | }
37 | return false;
38 | }
39 |
40 | /**
41 | * 注册一个路由器插件
42 | * */
43 | public static boolean addPluginRouter(PluginRouter x){
44 | if(x!=null){
45 |
46 | }
47 | return false;
48 | }
49 |
50 | /**
51 | * 获取可用拨号插件数目
52 | * */
53 | public static int getNumberOfDail(){
54 | return gPluginDial.size();
55 | }
56 |
57 | /**
58 | * 获取可用路由器插件数目
59 | * */
60 | public static int getNumberOfRouter(){
61 | return gPluginRouter.size();
62 | }
63 |
64 | /**
65 | * 获取拨号插件
66 | * @param path 下表
67 | * @return 如果制定下表可用,返回对象,否则返回null
68 | * */
69 | public static PluginDial getPluginDial(int path){
70 | return path >= 0 && path < getNumberOfDail() ? gPluginDial.get(path) : null;
71 | }
72 |
73 | /**
74 | * 获取路由器插件
75 | * @param path 下表
76 | * @return 如果制定下表可用,返回对象,否则返回null
77 | * */
78 | public static PluginRouter getPluginRouter(int path){
79 | return path >= 0 && path < getNumberOfRouter() ? gPluginRouter.get(path) : null;
80 | }
81 |
82 | /**
83 | * 删除指定插件
84 | * @param path
85 | * @return 如果删除成功或者不存在,返回true
86 | * */
87 | public static boolean removePluginDial(int path){
88 | if(path >= 0 && path < getNumberOfDail()){
89 | return gPluginDial.remove(path) == null;
90 | }
91 | return true;
92 | }
93 |
94 | /**
95 | * 删除指定插件
96 | * @param path
97 | * @return 如果删除成功或者不存在,返回true
98 | * */
99 | public static boolean removePluginRouter(int path){
100 | if(path >= 0 && path < getNumberOfRouter()){
101 | return gPluginRouter.remove(path) == null;
102 | }
103 | return true;
104 | }
105 |
106 | /**从文件夹读取并自动载入插件信息*/
107 | public static void loadPlugin(){
108 |
109 | }
110 |
111 |
112 | }
113 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/control/StatusController.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.control;
2 |
3 | import javax.swing.JLabel;
4 |
5 | /**
6 | * 程序状态控制器
7 | * @author CrazyChen
8 | * @version 1.5.0
9 | * @since Simple Netkeeper 1.5.0
10 | * */
11 | public class StatusController {
12 |
13 | //拨号状态
14 | private static boolean isOnDialing = false ;
15 |
16 | /**获取当前正在拨号状态,如果正在拨号,返回true*/
17 | public static boolean getStateDial(){return isOnDialing;}
18 | public static synchronized void setStateDial(boolean x){isOnDialing = x;};
19 | //========================================
20 | //路由器状态
21 | private static boolean isRouterDialed = false ;
22 |
23 | /**获取当前路由器是否正在拨号,如果是,返回true*/
24 | public static boolean getStateRouterDial(){return isRouterDialed ;}
25 | public static synchronized void setStateRouterDial(boolean x){isRouterDialed = x;}
26 | //========================================
27 | //是否启用账号加密
28 | private static boolean isEncrypt = true ;
29 |
30 | /**账号是否需要加密*/
31 | public static boolean getStateEncrypt(){return isEncrypt;}
32 | public static synchronized void setStateEncrypt(boolean x){isEncrypt = x ;}
33 | //========================================
34 | //验证方式
35 | private static int routerAuthMethod = 0;
36 |
37 | /**获取路由器的登录方式*/
38 | public static int getStateRouterAuthMethod(){return routerAuthMethod;}
39 | public static synchronized void setStateRouterAuthMethod(int a){routerAuthMethod = a;}
40 | //========================================
41 | //拨号模式
42 | private static int dialMode = 2 ;
43 |
44 | /**获取路由器拨号模式*/
45 | public static int getStateDialMode(){return dialMode ;}
46 | public static synchronized void setStateDialMode(int d){dialMode = d;}
47 |
48 | public static final int DIAL_AUTO = 1 ;
49 | public static final int DIAL_USER = 2 ;
50 |
51 | /*
52 | enum DialMode{
53 | DIAL_AUTO,
54 | DIAL_USER
55 | }*/
56 |
57 | //========================================
58 | //状态信息显示器
59 | private static JLabel routerConfigStatusBar = null ;
60 |
61 | public static void setComponentRouterConfigStatusBar(JLabel x){routerConfigStatusBar = x;}
62 | public static void setStatusRouterConfigStatusBar(CharSequence x){
63 | if(routerConfigStatusBar!=null) routerConfigStatusBar.setText(x.toString());
64 | }
65 |
66 | //========================================
67 | //本地拨号状态显示器
68 |
69 | private static JLabel dialStatusBar = null;
70 |
71 | public static void setComponentDialStatusBar(JLabel x){dialStatusBar = x;}
72 | public static void setStatusDial(CharSequence x){
73 | if(x!=null && dialStatusBar!=null) dialStatusBar.setText(x.toString());
74 | }
75 |
76 | //========================================
77 | //心跳状态
78 | private static boolean isHeartBeat = false ;
79 |
80 | /**返回是否正在心跳*/
81 | public static boolean getStateHeartBeat(){return isHeartBeat;}
82 | public static synchronized void setStateHeartBeat(boolean x){isHeartBeat = x;}
83 |
84 | //========================================
85 | //debug状态
86 | public static boolean isOnDebug = false;
87 |
88 |
89 | //========================================
90 |
91 | //账户信息
92 |
93 | public static String sAccName = "";
94 | public static String sAccPassword = "";
95 | public static String sRouterAdd = "192.168.1.1";
96 | public static String sRouterAcc = "admin";
97 | public static String sRouterPassword = "";
98 |
99 | public static String sLocalAccName = "";
100 | public static String sLocalAccPassword = "";
101 | /**
102 | * 将这里保存的状态变量转移到Properties
103 | * */
104 | public static void saveConfig(){
105 |
106 | //帐户名,密码,路由器IP/账号/密码,路由器设备名称/验证方式,本地拨号用户名/密码,使用模式
107 | String[] pSet = {ConfigController.Config_Dial_Acc_Name,ConfigController.Config_Dial_Acc_Password,
108 | ConfigController.Config_Router_IP,ConfigController.Config_Router_Name,ConfigController.Config_Router_Password,
109 | ConfigController.Config_Router_Manufactor,ConfigController.Config_Router_AuthMethod,
110 | ConfigController.Config_Acc_Name,ConfigController.Config_Acc_Password,
111 | ConfigController.Config_Router_Encrypt,ConfigController.Config_Router_DialMode};
112 |
113 | String[] pVal = {sAccName,Base64.encode(sAccPassword),
114 | sRouterAdd,sRouterAcc,Base64.encode(sRouterPassword),
115 | "TP-LINK/水星/FAST",String.valueOf(routerAuthMethod),
116 | sLocalAccName,Base64.encode(sLocalAccPassword),
117 | String.valueOf(isEncrypt),String.valueOf(dialMode)};
118 |
119 | for(int i=0;i>= 0x20; //右移32位
86 | t >>= 0x01; //右移1位
87 | m_time1c = (long) t; //强制转换
88 |
89 | m_lasttimec = m_time1c;
90 |
91 | t = m_time1c;
92 | by2[3] = intToByte(t & 0xFF);
93 | by2[2] = intToByte((t & 0xFF00) / 0x100) ;
94 | by2[1] = intToByte((t & 0xFF0000) / 0x10000);
95 | by2[0] = intToByte((t & 0xFF000000) / 0x1000000);
96 |
97 | //System.out.println(by2[3]+" "+by2[2]+" "+by2[1]+" "+by2[0]);
98 |
99 | /**
100 | * 倒置过程m_time1convert为结果
101 | */
102 | int t0=0, t1, t2, t3;
103 | t0 = (int) m_time1c;
104 | t1 = t0;
105 | t2 = t0;
106 | t3 = t0;
107 | t3 = t3 << 0x10;
108 | t1 = t1 & 0x0FF00;
109 | t1 = t1 | t3;
110 | t3 = t0;
111 | t3 = t3 & 0x0FF0000;
112 | t2 = t2 >> 0x10;
113 | t3 = t3 | t2;
114 | t1 = t1 << 0x08;
115 | t3 = t3 >> 0x08;
116 | t1 = t1 | t3;
117 | m_time1convert = t1;
118 |
119 | //System.out.println(m_time1convert);
120 |
121 | /**
122 | * 源数据1,对m_time1convert进行计算得到格式符源数据
123 | */
124 |
125 | long tc=0;
126 | tc = m_time1convert;
127 | ss[3] = trans(tc & 0xFF);
128 | ss[2] = trans((tc & 0xFF00) / 0x100) ;
129 | ss[1] = trans((tc & 0xFF0000) / 0x10000);
130 | ss[0] = trans((tc & 0xFF000000) / 0x1000000);
131 |
132 | //System.out.println(ss[3]+" "+ss[2]+ " "+ss[1]+ " "+ss[0]);
133 | /**
134 | * 格式符初加密
135 | */
136 | char pp[] ={0,0,0,0};
137 | int i = 0, j = 0, k = 0;
138 | for (i = 0; i < 0x20; i++){
139 | j = i / 0x8;
140 | k = 3 - (i % 0x4);
141 | pp[k] *= 0x2;
142 | if (ss[j] % 2 == 1){
143 | pp[k]++;
144 | }
145 | ss[j] /= 2;
146 | }
147 |
148 | /**
149 | * 格式符计算,m_formatsring为结果
150 | */
151 | char pf[] ={0,0,0,0,0,0};
152 | short st1,st2 ;
153 | st1 = (short) pp[3];
154 | st1 /= 0x4;
155 | pf[0] = trans(st1);
156 | st1 = (short) pp[3];
157 | st1 = (short) (st1 & 0x3);
158 | st1 *= 0x10;
159 | pf[1] = trans(st1);
160 | st2 = (short) pp[2];
161 | st2 /= 0x10;
162 | st2 = (short) (st2 | st1);
163 | pf[1] = trans(st2);
164 | st1 = (short) pp[2];
165 | st1 = (short) (st1 & 0x0F);
166 | st1 *= 0x04;
167 | pf[2] = trans(st1);
168 | st2 = (short) pp[1];
169 | st2 /= 0x40;
170 | st2 = (short) (st2 | st1);
171 | pf[2] = trans(st2);
172 | st1 = (short) pp[1];
173 | st1 = (short) (st1 & 0x3F);
174 | pf[3] = trans(st1);
175 | st2 = (short) pp[0];
176 | st2 /= 0x04;
177 | pf[4] = trans(st2);
178 | st1 = (short) pp[0];
179 | st1 = (short) (st1 & 0x03);
180 | st1 *= 0x10;
181 | pf[5] = trans(st1);
182 |
183 | /* String arr="";
184 | for(int x=0;x<6;x++){
185 | arr+=(pf[x]+" ");
186 | }
187 | System.out.println(arr);*/
188 |
189 | for (int n = 0; n < 6; n++){
190 | pf[n] += 0x20;
191 | if ((pf[n]) >= 0x40){
192 | pf[n]++;
193 | }
194 | }
195 |
196 | //System.out.println("m_f"+m_formatsring);
197 |
198 | for (int m = 0; m < 6; m++){
199 | m_formatsring += pf[m];
200 | }
201 |
202 | //System.out.println("m_f"+m_formatsring);
203 |
204 | String strInput;
205 | String strtem;
206 | if(m_username.contains("@")){
207 | strtem=m_username.substring(0, m_username.indexOf("@"));
208 | }else{
209 | strtem=m_username;
210 | }
211 | strInput = strtem + RADIUS;
212 | byte[] temp=new byte[by2.length+strInput.getBytes().length];
213 | System.arraycopy(by2, 0, temp, 0, by2.length);
214 | System.arraycopy(strInput.getBytes(),0,temp,by2.length,strInput.getBytes().length);
215 | m_md5 = MD5.getMD5(temp);
216 |
217 | //System.out.println("m5:"+m_md5);
218 | m_md5use = m_md5.substring(0, 2);
219 | m_realusername = m_formatsring + m_md5use + m_username;
220 | m_realusername = LR + m_realusername;//前面两位为回车换行0D0A,接着再是后续的
221 |
222 | return m_realusername;
223 | }
224 |
225 |
226 | }
227 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/netkeeper/MD5.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.netkeeper;
2 |
3 | /**
4 | * MD5的算法在RFC1321 中定义
5 | * 在RFC 1321中,给出了Test suite用来检验你的实现是否正确:
6 | * MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
7 | * MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661
8 | * MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72
9 | * MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0
10 | * MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b
11 | *
12 | * @author haogj
13 | *
14 | * 传入参数:一个字节数组
15 | * 传出参数:字节数组的 MD5 结果字符串
16 | */
17 | public class MD5 {
18 | public static String getMD5(byte[] source) {
19 | String s = null;
20 | char hexDigits[] = { // 用来将字节转换成 16 进制表示的字符
21 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
22 | try
23 | {
24 | java.security.MessageDigest md = java.security.MessageDigest.getInstance( "MD5" );
25 | md.update( source );
26 | byte tmp[] = md.digest(); // MD5 的计算结果是一个 128 位的长整数,
27 | // 用字节表示就是 16 个字节
28 | char str[] = new char[16 * 2]; // 每个字节用 16 进制表示的话,使用两个字符,
29 | // 所以表示成 16 进制需要 32 个字符
30 | int k = 0; // 表示转换结果中对应的字符位置
31 | for (int i = 0; i < 16; i++) { // 从第一个字节开始,对 MD5 的每一个字节
32 | // 转换成 16 进制字符的转换
33 | byte byte0 = tmp[i]; // 取第 i 个字节
34 | str[k++] = hexDigits[byte0 >>> 4 & 0xf]; // 取字节中高 4 位的数字转换,
35 | // >>> 为逻辑右移,将符号位一起右移
36 | str[k++] = hexDigits[byte0 & 0xf]; // 取字节中低 4 位的数字转换
37 | }
38 | s = new String(str); // 换后的结果转换为字符串
39 |
40 | }catch( Exception e )
41 | {
42 | e.printStackTrace();
43 | }
44 | return s;
45 | }
46 | }
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/obj/Bundle.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.obj;
2 |
3 | public class Bundle {
4 |
5 | /**
6 | * 组合消息的标识符源
7 | * */
8 | public String bundleSource ;
9 |
10 | /**
11 | * 组合消息的内容
12 | * */
13 | public Object bundleData;
14 |
15 | public Bundle(String source,Object data){
16 | this.bundleData = data;
17 | this.bundleSource = source;
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/obj/Message.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.obj;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | public class Message implements Iterator,Iterable{
8 |
9 | private List mList;
10 |
11 | public Message(){
12 | this.mList = new ArrayList();
13 | }
14 |
15 | public Message(Bundle x){
16 | this();
17 | this.mList.add(x);
18 | }
19 |
20 | public void add(Bundle p){
21 | if(p != null)
22 | mList.add(p);
23 | }
24 |
25 | public Iterator iterator(){
26 | return this.mList.iterator();
27 | }
28 |
29 | public Bundle getBundle(int index){
30 | return index >= 0 ? mList.get(index) : null ;
31 | }
32 |
33 | @Override
34 | public boolean hasNext() {
35 | return mList.iterator().hasNext();
36 | }
37 |
38 | @Override
39 | public Bundle next() {
40 | return mList.iterator().next();
41 | }
42 |
43 | @Override
44 | public void remove() {
45 | mList.iterator().remove();
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/obj/PluginConfig.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.obj;
2 |
3 | import java.io.File;
4 | import java.io.FileInputStream;
5 | import java.io.FileNotFoundException;
6 | import java.io.IOException;
7 | import java.util.Properties;
8 |
9 | public abstract class PluginConfig {
10 |
11 | //配置文件修饰符
12 | public static final String Config_Prefix_Conf = "conf",
13 | Config_Prefix_Dial = "dial",
14 | Config_Prefix_Router = "router";
15 |
16 |
17 | //配置文件项目//
18 | public static final String Conf_name = "name",
19 | Conf_author = "author",
20 | Conf_mail = "mail",
21 | Conf_version = "version",
22 | Conf_date = "date",
23 | Conf_type= "type";
24 |
25 | //拨号项目
26 | public static final String Dial_Libx86 = "libx86",
27 | Dial_Libx64 = "libx64",
28 | Dial_Platform = "platform",
29 | Dial_Heartbeat = "heartbeat",
30 | Dial_Entry = "entry",
31 | Dial_AccProvidor = "providor";
32 |
33 | //路由器项目
34 | public static final String Router_Libx86 = "libx86",
35 | Router_Libx64="libx64";
36 |
37 | //方法集合开始
38 |
39 | /**
40 | * 用于收集配置文件数据的Properties
41 | * */
42 | protected Properties gConfigData;
43 |
44 |
45 | public PluginConfig(String szFileName) throws FileNotFoundException, IOException{
46 | this.gConfigData = new Properties();
47 | File mConfig = new File(szFileName);
48 | if(mConfig.exists()){
49 | gConfigData.load(new FileInputStream(mConfig));
50 | if(gConfigData.isEmpty()) throw new FileNotFoundException("文件为空,不能创建");
51 | this.loadConf();
52 | }
53 | }
54 |
55 | public PluginConfig(Properties prop) throws FileNotFoundException{
56 | if(prop == null || prop.isEmpty()) throw new FileNotFoundException("文件为空,不能创建");
57 | this.gConfigData = prop;
58 | }
59 |
60 | /**获取指定项目,不存在则返回null字符串或者默认值*/
61 | public String get(String szName){
62 | return gConfigData.isEmpty() ? null : gConfigData.getProperty(szName);
63 | }
64 |
65 | /***/
66 | public String getDef(String szName,String def){
67 | String pRes = this.get(szName);
68 | return pRes == null ? def : pRes;
69 | }
70 |
71 | /**注册到插件控制器*/
72 | public abstract boolean register();
73 |
74 | /**是否合法配置*/
75 | public boolean isValid = false;
76 |
77 | /**配置文件基本属性表*/
78 | public String configName = "";
79 | public String configAuthor = "";
80 | public String configMail = "";
81 | public String configVersion = "";
82 | public String configDate = "";
83 | public String configType = "";
84 |
85 | protected void loadConf(){
86 | if(this.gConfigData!=null && !this.gConfigData.isEmpty()){
87 | this.configAuthor = this.getDef(Config_Prefix_Conf+"."+Conf_author, "未知作者");
88 | this.configDate = this.getDef(Config_Prefix_Conf+"."+Conf_date, "未知时间");
89 | this.configMail = this.getDef(Config_Prefix_Conf+"."+Conf_mail, "未知");
90 | this.configType = this.getDef(Config_Prefix_Conf+"."+Conf_type, "-1");
91 | this.configVersion = this.getDef(Config_Prefix_Conf+"."+Conf_version, "未知版本");
92 | this.configName = this.getDef(Config_Prefix_Conf+"."+Conf_author, "未命名配置文件");
93 |
94 | if(this.configType == null || this.configType.equals("-1")) this.isValid = false;
95 | }
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/obj/PluginDial.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.obj;
2 |
3 | import java.io.FileNotFoundException;
4 | import java.io.IOException;
5 |
6 | public class PluginDial extends PluginConfig{
7 |
8 | public PluginDial(String szFileName) throws FileNotFoundException,
9 | IOException {
10 | super(szFileName);
11 | }
12 |
13 | @Override
14 | public boolean register() {
15 | // TODO Auto-generated method stub
16 | return false;
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/obj/PluginRouter.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.obj;
2 |
3 | import java.io.FileNotFoundException;
4 | import java.io.IOException;
5 |
6 | public class PluginRouter extends PluginConfig{
7 |
8 | public PluginRouter(String szFileName) throws FileNotFoundException,
9 | IOException {
10 | super(szFileName);
11 | // TODO Auto-generated constructor stub
12 | }
13 |
14 | @Override
15 | public boolean register() {
16 | // TODO Auto-generated method stub
17 | return false;
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/obj/WiFiInfo.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.obj;
2 |
3 | public class WiFiInfo {
4 | private String gWifiName;
5 | private String gWifiPassword;
6 | private boolean gWifiBroadCast;
7 |
8 | public WiFiInfo(String name,String key,boolean allowBroadCast){
9 | this.setWifiName(name);
10 | this.setWifiBroadCast(allowBroadCast);
11 | this.setWifiPassword(key);
12 | }
13 |
14 | public WiFiInfo(String name,String key){
15 | this(name,key,true);
16 | }
17 |
18 | public String getWifiName() {
19 | return gWifiName;
20 | }
21 |
22 | public void setWifiName(String gWifiName) {
23 | this.gWifiName = gWifiName;
24 | }
25 |
26 | public String getWifiPassword() {
27 | return gWifiPassword;
28 | }
29 |
30 | public void setWifiPassword(String gWifiPassword) {
31 | this.gWifiPassword = gWifiPassword;
32 | }
33 |
34 | public boolean isWifiBroadCast() {
35 | return gWifiBroadCast;
36 | }
37 |
38 | public void setWifiBroadCast(boolean gWifiBroadCast) {
39 | this.gWifiBroadCast = gWifiBroadCast;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/ui/PanelDialLocal.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.ui;
2 |
3 | import java.awt.Color;
4 | import java.awt.GridLayout;
5 | import java.awt.event.ActionEvent;
6 | import java.awt.event.ActionListener;
7 | import java.awt.event.FocusEvent;
8 | import java.awt.event.FocusListener;
9 | import java.io.File;
10 |
11 | import javax.swing.BorderFactory;
12 | import javax.swing.JButton;
13 | import javax.swing.JCheckBox;
14 | import javax.swing.JLabel;
15 | import javax.swing.JPanel;
16 |
17 | import cqxinli.ClickDial;
18 | import cn.sunflyer.simpnk.control.StatusController;
19 | import cn.sunflyer.simpnk.netkeeper.CXKUsername;
20 |
21 | /**
22 | * 路由器本地拨号界面
23 | * @author CrazyChen
24 | * */
25 | public class PanelDialLocal extends JPanel{
26 |
27 | /**
28 | *
29 | */
30 | private static final long serialVersionUID = 1089909794048458208L;
31 |
32 | public PanelDialLocal(int width,int height){
33 | this.setLayout(null);
34 | this.setSize(width, height);
35 | this.setBounds(0, 0, width, height);
36 | JPanel pDial = this.initComponentDial();
37 |
38 | this.add(pDial);
39 | pDial.setBounds(0, 0, width, 180);
40 | }
41 |
42 | private JPanel initComponentDial(){
43 | JPanel pDial = new JPanel();
44 | pDial.setBorder(BorderFactory.createTitledBorder("本地拨号功能"));
45 |
46 | pDial.setLayout(new GridLayout(4,1));
47 |
48 | final PanelInput pLocalAcc = new PanelInput("宽带账号","",false,this.getWidth(),45);
49 | pLocalAcc.addFocusListenerForBox(new FocusListener(){
50 | @Override
51 | public void focusGained(FocusEvent arg0) {}
52 | @Override
53 | public void focusLost(FocusEvent arg0) {
54 | StatusController.sLocalAccName = pLocalAcc.getText();
55 | }
56 |
57 | });
58 | final PanelPassword pLocalPass = new PanelPassword("宽带密码","",false,this.getWidth(),45);
59 | pLocalPass.addFocusListenerForBox(new FocusListener(){
60 | @Override
61 | public void focusGained(FocusEvent arg0) {}
62 | @Override
63 | public void focusLost(FocusEvent arg0) {
64 | StatusController.sLocalAccPassword = pLocalPass.getPassword();
65 | }
66 |
67 | });
68 |
69 | //设置默认值
70 | pLocalAcc.setText(StatusController.sLocalAccName);
71 | pLocalPass.setPassword(StatusController.sLocalAccPassword);
72 |
73 | final JLabel pDialState = new JLabel("Ready");
74 | pDialState.setForeground(Color.RED);
75 | StatusController.setComponentDialStatusBar(pDialState);
76 |
77 | if (System.getProperty("os.name").startsWith("Windows")) {
78 | String libPath = System.getProperty("user.dir") + File.separator + "DialLib" + File.separator;
79 | try {
80 | System.load(libPath + "SimpNKRasDialLibx64.dll");
81 | } catch (UnsatisfiedLinkError e1) {
82 | try {
83 | System.load(libPath + "SimpNKRasDialLibx86.dll");
84 | } catch (UnsatisfiedLinkError e2) {
85 | pDialState.setText("DLL加载失败");
86 | }
87 | }
88 | } else {
89 | pDialState.setText("仅Windows可用");
90 | }
91 |
92 | JPanel pDialOpr = new JPanel();
93 |
94 | JButton pConnect = new JButton("现在连接");
95 | pConnect.addActionListener(new ActionListener(){
96 | @Override
97 | public void actionPerformed(ActionEvent arg0) {
98 | if (pLocalAcc.getText().isEmpty())
99 | return;
100 |
101 | String realUsername = (new CXKUsername(pLocalAcc.getText())).Realusername();
102 | String password = pLocalPass.getPassword();
103 |
104 | int err = ClickDial.dialRasWindows(realUsername, password, "ignored");
105 | if (err == 0) {
106 | pDialState.setText("拨号成功");
107 | } else {
108 | pDialState.setText(ClickDial.dialRasWindowsErrorStr(err) + "(Code: " + err + ")");
109 | }
110 | }
111 | });
112 |
113 | final JCheckBox pHeart = new JCheckBox("开启心跳模拟");
114 | pHeart.addActionListener(new ActionListener(){
115 | @Override
116 | public void actionPerformed(ActionEvent e) {
117 | pHeart.setSelected(false); // not implemented
118 | }
119 | });
120 |
121 | pDialOpr.add(pConnect);
122 | pDialOpr.add(pHeart);
123 |
124 | pDial.add(pLocalAcc);
125 | pDial.add(pLocalPass);
126 | pDial.add(pDialState);
127 | pDial.add(pDialOpr);
128 |
129 | return pDial;
130 | }
131 |
132 | }
133 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/ui/PanelInput.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.ui;
2 |
3 | import java.awt.Color;
4 | import java.awt.event.FocusListener;
5 |
6 | import javax.swing.JLabel;
7 | import javax.swing.JPanel;
8 | import javax.swing.JTextField;
9 |
10 | public class PanelInput extends JPanel{
11 |
12 | private static final long serialVersionUID = 1241310366546636676L;
13 |
14 | private JLabel gLabel = null;
15 | private JTextField gInput = null ;
16 |
17 | /**
18 | * 构造一个带标签输入框对象,默认宽500,高45
19 | * */
20 | public PanelInput(String szDataName,String szInitData,boolean isReadOnly){
21 | this(szDataName,szInitData,isReadOnly,500,45);
22 | }
23 |
24 | public PanelInput(String szDataName,String szInitData,boolean isReadOnly,int Width,int Height){
25 | String pLabelName = ( szDataName == null || szDataName.equals("") )? "Label" : szDataName ;
26 | String pInputData = ( szInitData == null )? "" : szInitData ;
27 | this.setLayout(null);
28 | this.setSize(Width, Height);
29 | this.initComponent(pLabelName,pInputData,isReadOnly);
30 | }
31 |
32 | private void initComponent(String szDataName,String szInitData,boolean isReadOnly){
33 | this.gInput = new JTextField();
34 | this.gInput.setText(szInitData);
35 | this.gInput.setEditable(!isReadOnly);
36 | this.gInput.setBackground(Color.WHITE);
37 |
38 | this.gLabel = new JLabel(szDataName);
39 | this.gLabel.setBackground(Color.WHITE);
40 | //设置布局
41 | this.gLabel.setSize((int)(this.getWidth() * 0.4), (int)(this.getHeight() * 0.8));
42 | this.gInput.setSize((int)(this.getWidth() * 0.55), (int)(this.getHeight() * 0.8));
43 |
44 | this.gLabel.setBounds(0 , 0, this.gLabel.getWidth(), this.gLabel.getHeight());
45 | this.gInput.setBounds(this.gLabel.getWidth(), 0 , this.gInput.getWidth(), this.gInput.getHeight());
46 |
47 | this.add(this.gLabel);
48 | this.add(this.gInput);
49 |
50 | this.setBackground(Color.WHITE);
51 | }
52 |
53 | public void setText(CharSequence c){
54 | if(this.gInput == null || c == null) return;
55 | this.gInput.setText(c.toString());
56 | }
57 |
58 | public String getText(){
59 | return this.gInput == null ? null : this.gInput.getText();
60 | }
61 |
62 | public void setLabel(CharSequence c){
63 | if(this.gLabel == null || c==null) return;
64 | this.gLabel.setText(c.toString());
65 | }
66 |
67 | public String getLabel(){
68 | return this.gLabel == null ? null : this.gLabel.getText();
69 | }
70 |
71 | public boolean getReadOnly(){
72 | return this.gInput == null ? true : !this.gInput.isEditable() ;
73 | }
74 |
75 | public void setReadOnly(boolean a){
76 | if(this.gInput == null) return ;
77 | this.gInput.setEditable(!a);
78 | }
79 |
80 | public void setInputHelp(CharSequence c){
81 | this.gInput.setToolTipText(c.toString());
82 | }
83 |
84 | public void addFocusListenerForBox(FocusListener x){
85 | this.gInput.addFocusListener(x);
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/ui/PanelOperation.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.ui;
2 |
3 | import javax.swing.JPanel;
4 |
5 | /**
6 | * 操作面板的UI部分
7 | * @author CrazyChen
8 | * @since 1.2.0
9 | * */
10 | public class PanelOperation extends JPanel{
11 |
12 | /**
13 | *
14 | */
15 | private static final long serialVersionUID = -6197201071911100124L;
16 |
17 | public PanelOperation(){
18 |
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/cn/sunflyer/simpnk/ui/PanelPassword.java:
--------------------------------------------------------------------------------
1 | package cn.sunflyer.simpnk.ui;
2 |
3 | import java.awt.Color;
4 | import java.awt.event.FocusListener;
5 |
6 | import javax.swing.JLabel;
7 | import javax.swing.JPanel;
8 | import javax.swing.JPasswordField;
9 |
10 | public class PanelPassword extends JPanel{
11 |
12 | private static final long serialVersionUID = 1241310366546636676L;
13 |
14 | private JLabel gLabel = null;
15 | private JPasswordField gInput = null ;
16 |
17 | /**
18 | * 构造一个带标签输入框对象,默认宽500,高45
19 | * */
20 | public PanelPassword(String szDataName,String szInitData,boolean isReadOnly){
21 | this(szDataName,szInitData,isReadOnly,500,45);
22 | }
23 |
24 | public PanelPassword(String szDataName,String szInitData,boolean isReadOnly,int Width,int Height){
25 | String pLabelName = ( szDataName == null || szDataName.equals("") )? "Label" : szDataName ;
26 | String pInputData = ( szInitData == null )? "" : szInitData ;
27 | this.setLayout(null);
28 | this.setSize(Width, Height);
29 | this.initComponent(pLabelName,pInputData,isReadOnly);
30 | }
31 |
32 | private void initComponent(String szDataName,String szInitData,boolean isReadOnly){
33 | this.gInput = new JPasswordField();
34 | this.gInput.setText(szInitData);
35 | this.gInput.setEditable(!isReadOnly);
36 | this.gInput.setBackground(Color.WHITE);
37 |
38 | this.gLabel = new JLabel(szDataName);
39 | this.gLabel.setBackground(Color.WHITE);
40 | //设置布局
41 | this.gLabel.setSize((int)(this.getWidth() * 0.4), (int)(this.getHeight() * 0.8));
42 | this.gInput.setSize((int)(this.getWidth() * 0.55), (int)(this.getHeight() * 0.8));
43 |
44 | this.gLabel.setBounds(0 , 0, this.gLabel.getWidth(), this.gLabel.getHeight());
45 | this.gInput.setBounds(this.gLabel.getWidth() , 0, this.gInput.getWidth(), this.gInput.getHeight());
46 |
47 | this.add(this.gLabel);
48 | this.add(this.gInput);
49 |
50 | this.setBackground(Color.WHITE);
51 | }
52 |
53 | public void setPassword(CharSequence c){
54 | if(this.gInput == null || c == null) return;
55 | this.gInput.setText(c.toString());
56 | }
57 |
58 | public String getPassword(){
59 | return this.gInput == null ? null : new String(this.gInput.getPassword());
60 |
61 | }
62 |
63 | public void setLabel(CharSequence c){
64 | if(this.gLabel == null || c==null) return;
65 | this.gLabel.setText(c.toString());
66 | }
67 |
68 | public String getLabel(){
69 | return this.gLabel == null ? null : this.gLabel.getText();
70 | }
71 |
72 | public boolean getReadOnly(){
73 | return this.gInput == null ? true : !this.gInput.isEditable() ;
74 | }
75 |
76 | public void setReadOnly(boolean a){
77 | if(this.gInput == null) return ;
78 | this.gInput.setEditable(!a);
79 | }
80 |
81 | public void setInputHelp(CharSequence c){
82 | this.gInput.setToolTipText(c.toString());
83 | }
84 |
85 | public void addFocusListenerForBox(FocusListener x){
86 | this.gInput.addFocusListener(x);
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/cqxinli/ClickDial.java:
--------------------------------------------------------------------------------
1 | package cqxinli;
2 |
3 |
4 | /**
5 | * Windows 拨号,JNI模块类
6 | * @author CrazyChen
7 | * @version 1.5.0
8 | * @since Simple Netkeeper 1.5.0
9 | *
10 | * */
11 | public class ClickDial {
12 | /**
13 | * 本地拨号功能实现,这是一个本地方法,需要库文件实现
14 | * @param szUsername 拨号用户名
15 | * @param szPassword 拨号密码
16 | * @param szDialEntry 拨号连接名称,暂时会被忽略
17 | * @return 返回连接错误代码
18 | * */
19 | public static synchronized native int dialRasWindows(String szUsername,String szPassword,String szDialEntry);
20 |
21 | /**
22 | * 返回拨号功能错误代码对应的提示文本,这是一个本地方法,需要库文件实现
23 | * @param intErrorCode 错误代码
24 | * @return 返回错误代码代表的提示文本
25 | * */
26 | public static native String dialRasWindowsErrorStr(int intErrorCode);
27 | }
28 |
--------------------------------------------------------------------------------
/使用说明.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/使用说明.txt
--------------------------------------------------------------------------------
/关于路由器的使用办法.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sunflyer/SimpleNetkeeper/e059e436d037439995cbe1e556a4f3dc7431c382/关于路由器的使用办法.pdf
--------------------------------------------------------------------------------
/湖北掌大宽带密码获取协议:
--------------------------------------------------------------------------------
1 | Server="hbsm.xinli.com.cn:8080"
2 | SessionId=System.currentTimeMillis()
3 | #请求原文: 手机号 $ ICCID $ SessionId
4 | RequestRaw="手机号$ICCID$SessionId"
5 | RequestAfterEncrypt = base64(AES_128_ECB_Enc(RequestRaw , "1234567890123456"))
6 | URL="http://%s/consent?entryptData=%s&userName=%s&sessionid=%s&KeyId=1&sim=%s&type=checkAuto" % (Server , RequestAfterEncrypt , 手机号 , SessionId , ICCID)
7 | Response = http.request(URL)
8 | if ( Response.HttpStatus == 200 )
9 | {
10 | jsonResp = json.loads(Response.HttpBody)
11 | if ( jsonResp["success"] == 1 )
12 | {
13 | ResponseRaw = AES_128_ECB_Dec(jsonResp["entryptData"] , "1234567890123456")
14 | print ResponseRaw
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/点击我运行.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | java -jar NetkeeperForRouter.jar
3 | exit
--------------------------------------------------------------------------------
/重庆电信动态密码.php:
--------------------------------------------------------------------------------
1 | set_key(DYNA_PASS_KEY);
40 | $origin = $aes->encrypt($origin);
41 |
42 |
43 | $len = strlen($origin) / 2;
44 |
45 | $len = base_convert($len, 10, 16);
46 | while(strlen($len) < 8){
47 | $len = "0".$len;
48 | }
49 |
50 | $origin = hex2bin($len.$origin);
51 |
52 | $client = stream_socket_client("udp://".DYNA_PASS_HOST.':'.DYNA_PASS_PORT);
53 | if($client && -1 !== stream_socket_sendto($client , $origin)) {
54 |
55 | $read_stream = array($client);
56 | $write_stream = NULL;
57 | $except = NULL;
58 | if (false === stream_select($read_stream, $write_stream, $except, 5)) {
59 | self::end(-4 , "等待超时");
60 | }else{
61 | self::end(0 , "已发送请求,请稍后查收短信。");
62 | }
63 | }else{
64 | self::end(-3 , "用户请求发送失败,请稍后重试");
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------