├── .gitignore
├── .idea
├── caches
│ └── build_file_checksums.ser
├── codeStyles
│ └── Project.xml
├── gradle.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── ddns
│ │ └── android
│ │ └── vuls
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── aidl
│ │ └── ddns
│ │ │ └── android
│ │ │ └── vuls
│ │ │ └── services
│ │ │ └── IGetNetStatusInterface.aidl
│ ├── java
│ │ └── ddns
│ │ │ └── android
│ │ │ └── vuls
│ │ │ ├── Beans
│ │ │ ├── LoginRequestOuterClass.java
│ │ │ ├── MessageOuterClass.java
│ │ │ └── User.java
│ │ │ ├── Common
│ │ │ ├── AntiTools.java
│ │ │ └── Utils.java
│ │ │ ├── ContentProviders
│ │ │ ├── AccountProvider.java
│ │ │ └── DBHelper.java
│ │ │ ├── MainActivity.java
│ │ │ ├── TokenReceiver.java
│ │ │ ├── activities
│ │ │ ├── Activity
│ │ │ │ ├── AccountActivity.java
│ │ │ │ ├── ActivityActivity.java
│ │ │ │ ├── Dos1Activity.java
│ │ │ │ ├── Dos2Activity.java
│ │ │ │ ├── FragmentActivity.java
│ │ │ │ ├── LoginActivity.java
│ │ │ │ ├── TargetFragment.java
│ │ │ │ ├── WebActivity.java
│ │ │ │ └── WebviewActivity.java
│ │ │ ├── Broadcast
│ │ │ │ ├── BroadcastActivity.java
│ │ │ │ ├── DosReceiver.java
│ │ │ │ └── LoginBroadcastActivity.java
│ │ │ ├── Services
│ │ │ │ └── ServiceActivity.java
│ │ │ ├── Webview
│ │ │ │ ├── CloneActivity.java
│ │ │ │ ├── WebviewSecActivity.java
│ │ │ │ ├── WvLoginActivity.java
│ │ │ │ └── WvNetActivity.java
│ │ │ ├── net
│ │ │ │ ├── AntiActivity.java
│ │ │ │ ├── HttpsURLConnectionActivity.java
│ │ │ │ ├── NetActivity.java
│ │ │ │ ├── NoProxyActivity.java
│ │ │ │ ├── ProtoActivity.java
│ │ │ │ ├── ProtoStuffActivity.java
│ │ │ │ └── SSLPinningActivity.java
│ │ │ └── storage
│ │ │ │ ├── ClipboardActivity.java
│ │ │ │ ├── ExternalFileActivity.java
│ │ │ │ ├── InternalFileActivity.java
│ │ │ │ ├── KeyboardCacheActivity.java
│ │ │ │ ├── LogcatActivity.java
│ │ │ │ ├── SQLiteActivity.java
│ │ │ │ ├── ScreenShotActivity.java
│ │ │ │ ├── SpActivity.java
│ │ │ │ ├── StorageActivity.java
│ │ │ │ └── UidActivity.java
│ │ │ └── services
│ │ │ ├── NetService.java
│ │ │ └── SMSService.java
│ ├── proto
│ │ ├── LoginRequest.proto
│ │ └── Message.proto
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_account.xml
│ │ ├── activity_activity.xml
│ │ ├── activity_anti.xml
│ │ ├── activity_broadcast.xml
│ │ ├── activity_clipboard.xml
│ │ ├── activity_clone.xml
│ │ ├── activity_dos.xml
│ │ ├── activity_dos2.xml
│ │ ├── activity_external_file.xml
│ │ ├── activity_fragement.xml
│ │ ├── activity_https_urlconnection.xml
│ │ ├── activity_internal_file.xml
│ │ ├── activity_keyboard_cache.xml
│ │ ├── activity_logcat.xml
│ │ ├── activity_login.xml
│ │ ├── activity_login_broadcast.xml
│ │ ├── activity_main.xml
│ │ ├── activity_net.xml
│ │ ├── activity_no_proxyf.xml
│ │ ├── activity_proto.xml
│ │ ├── activity_proto_stuff.xml
│ │ ├── activity_screen_shot.xml
│ │ ├── activity_service.xml
│ │ ├── activity_sp.xml
│ │ ├── activity_sqlite.xml
│ │ ├── activity_sslpinning.xml
│ │ ├── activity_storage.xml
│ │ ├── activity_uid.xml
│ │ ├── activity_web.xml
│ │ ├── activity_webview.xml
│ │ ├── activity_webview_sec.xml
│ │ ├── activity_wv_login.xml
│ │ ├── activity_wv_net.xml
│ │ └── fragment_target.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── ddns
│ └── android
│ └── vuls
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/libraries
5 | /.idea/modules.xml
6 | /.idea/workspace.xml
7 | .DS_Store
8 | /build
9 | /captures
10 | .externalNativeBuild
11 |
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidAppSec/vuls/8de4c638e7e9694daa8e18d6d2d53b25393b8e8e/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.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 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vuls
2 | 供测试的漏洞APP
3 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'com.google.protobuf'
3 |
4 | android {
5 |
6 | sourceSets {
7 | main {
8 | // 定义java文件目录
9 | java {
10 | srcDir 'src/main/java'
11 | }
12 | // 定义proto文件目录
13 | proto {
14 | srcDir 'src/main/proto'
15 | }
16 | }
17 | }
18 |
19 | compileSdkVersion 27
20 | defaultConfig {
21 | applicationId "ddns.android.vuls"
22 | minSdkVersion 15
23 | targetSdkVersion 27
24 | versionCode 1
25 | versionName "1.0"
26 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
27 | }
28 | buildTypes {
29 | debug {
30 | // zipAlignEnabled true
31 | // shrinkResources true
32 | // minifyEnabled true
33 | // proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
34 | }
35 | release {
36 | // zipAlignEnabled true
37 | // shrinkResources true
38 | minifyEnabled true
39 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
40 | }
41 | }
42 | }
43 |
44 | protobuf {
45 | //配置protoc编译器
46 | protoc {
47 | artifact = 'com.google.protobuf:protoc:3.6.1'
48 | }
49 | //这里配置生成目录,编译后会在build的目录下生成对应的java文件
50 | generateProtoTasks {
51 | all().each { task ->
52 | task.builtins {
53 | remove java
54 | }
55 | task.builtins {
56 | java {}
57 | }
58 | }
59 | }
60 | }
61 |
62 | dependencies {
63 | implementation fileTree(include: ['*.jar'], dir: 'libs')
64 | implementation 'com.android.support:appcompat-v7:27.1.1'
65 | implementation 'com.android.support.constraint:constraint-layout:1.1.2'
66 | implementation 'com.android.support:design:27.1.1'
67 | implementation 'com.android.support:support-v4:27.1.1'
68 | testImplementation 'junit:junit:4.12'
69 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
70 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
71 | implementation 'com.squareup.okhttp3:okhttp:3.11.0'
72 | implementation 'com.google.protobuf:protobuf-java:3.6.1'
73 | implementation 'com.google.protobuf:protoc:3.6.1'
74 | compile group: 'io.protostuff', name: 'protostuff-runtime', version: '1.6.0'
75 | compile group: 'io.protostuff', name: 'protostuff-core', version: '1.6.0'
76 | }
77 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 | -assumenosideeffects class android.util.Log{
23 | public static int v(...);
24 | public static int i(...);
25 | public static int w(...);
26 | public static int d(...);
27 | public static int e(...);
28 | public static int println(...);
29 | }
30 |
31 | -assumenosideeffects class java.io.PrintStream {
32 | public *** println(...);
33 | public *** print(...);
34 | }
35 |
36 | -dontwarn ***
--------------------------------------------------------------------------------
/app/src/androidTest/java/ddns/android/vuls/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("ddns.android.vuls", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
13 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
44 |
47 |
50 |
53 |
56 |
59 |
62 |
65 |
68 |
71 |
74 |
77 |
80 |
83 |
86 |
89 |
93 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
114 |
119 |
122 |
125 |
128 |
129 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
142 |
143 |
147 |
148 |
149 |
150 |
151 |
155 |
156 |
161 |
165 |
166 |
167 |
170 |
173 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
185 |
186 |
187 |
188 |
189 |
193 |
194 |
195 |
196 |
197 |
--------------------------------------------------------------------------------
/app/src/main/aidl/ddns/android/vuls/services/IGetNetStatusInterface.aidl:
--------------------------------------------------------------------------------
1 | // IGetNetStatusInterface.aidl
2 | package ddns.android.vuls.services;
3 |
4 | // Declare any non-default types here with import statements
5 |
6 | interface IGetNetStatusInterface {
7 | /**
8 | * Demonstrates some basic types that you can use as parameters
9 | * and return values in AIDL.
10 | */
11 | String getNetStatus(String host);
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/Beans/MessageOuterClass.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.Beans;// Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: Message.proto
3 |
4 | public final class MessageOuterClass {
5 | private MessageOuterClass() {}
6 | public static void registerAllExtensions(
7 | com.google.protobuf.ExtensionRegistryLite registry) {
8 | }
9 |
10 | public static void registerAllExtensions(
11 | com.google.protobuf.ExtensionRegistry registry) {
12 | registerAllExtensions(
13 | (com.google.protobuf.ExtensionRegistryLite) registry);
14 | }
15 | public interface MessageOrBuilder extends
16 | // @@protoc_insertion_point(interface_extends:Message)
17 | com.google.protobuf.MessageOrBuilder {
18 |
19 | /**
20 | * int32 id = 2;
21 | */
22 | int getId();
23 |
24 | /**
25 | * string content = 1;
26 | */
27 | String getContent();
28 | /**
29 | * string content = 1;
30 | */
31 | com.google.protobuf.ByteString
32 | getContentBytes();
33 | }
34 | /**
35 | *
36 | * 返回消息体
37 | *
38 | *
39 | * Protobuf type {@code Message}
40 | */
41 | public static final class Message extends
42 | com.google.protobuf.GeneratedMessageV3 implements
43 | // @@protoc_insertion_point(message_implements:Message)
44 | MessageOrBuilder {
45 | private static final long serialVersionUID = 0L;
46 | // Use Message.newBuilder() to construct.
47 | private Message(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
48 | super(builder);
49 | }
50 | private Message() {
51 | id_ = 0;
52 | content_ = "";
53 | }
54 |
55 | @Override
56 | public final com.google.protobuf.UnknownFieldSet
57 | getUnknownFields() {
58 | return this.unknownFields;
59 | }
60 | private Message(
61 | com.google.protobuf.CodedInputStream input,
62 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
63 | throws com.google.protobuf.InvalidProtocolBufferException {
64 | this();
65 | if (extensionRegistry == null) {
66 | throw new NullPointerException();
67 | }
68 | int mutable_bitField0_ = 0;
69 | com.google.protobuf.UnknownFieldSet.Builder unknownFields =
70 | com.google.protobuf.UnknownFieldSet.newBuilder();
71 | try {
72 | boolean done = false;
73 | while (!done) {
74 | int tag = input.readTag();
75 | switch (tag) {
76 | case 0:
77 | done = true;
78 | break;
79 | case 10: {
80 | String s = input.readStringRequireUtf8();
81 |
82 | content_ = s;
83 | break;
84 | }
85 | case 16: {
86 |
87 | id_ = input.readInt32();
88 | break;
89 | }
90 | default: {
91 | if (!parseUnknownFieldProto3(
92 | input, unknownFields, extensionRegistry, tag)) {
93 | done = true;
94 | }
95 | break;
96 | }
97 | }
98 | }
99 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
100 | throw e.setUnfinishedMessage(this);
101 | } catch (java.io.IOException e) {
102 | throw new com.google.protobuf.InvalidProtocolBufferException(
103 | e).setUnfinishedMessage(this);
104 | } finally {
105 | this.unknownFields = unknownFields.build();
106 | makeExtensionsImmutable();
107 | }
108 | }
109 | public static final com.google.protobuf.Descriptors.Descriptor
110 | getDescriptor() {
111 | return MessageOuterClass.internal_static_Message_descriptor;
112 | }
113 |
114 | @Override
115 | protected FieldAccessorTable
116 | internalGetFieldAccessorTable() {
117 | return MessageOuterClass.internal_static_Message_fieldAccessorTable
118 | .ensureFieldAccessorsInitialized(
119 | MessageOuterClass.Message.class, MessageOuterClass.Message.Builder.class);
120 | }
121 |
122 | public static final int ID_FIELD_NUMBER = 2;
123 | private int id_;
124 | /**
125 | * int32 id = 2;
126 | */
127 | public int getId() {
128 | return id_;
129 | }
130 |
131 | public static final int CONTENT_FIELD_NUMBER = 1;
132 | private volatile Object content_;
133 | /**
134 | * string content = 1;
135 | */
136 | public String getContent() {
137 | Object ref = content_;
138 | if (ref instanceof String) {
139 | return (String) ref;
140 | } else {
141 | com.google.protobuf.ByteString bs =
142 | (com.google.protobuf.ByteString) ref;
143 | String s = bs.toStringUtf8();
144 | content_ = s;
145 | return s;
146 | }
147 | }
148 | /**
149 | * string content = 1;
150 | */
151 | public com.google.protobuf.ByteString
152 | getContentBytes() {
153 | Object ref = content_;
154 | if (ref instanceof String) {
155 | com.google.protobuf.ByteString b =
156 | com.google.protobuf.ByteString.copyFromUtf8(
157 | (String) ref);
158 | content_ = b;
159 | return b;
160 | } else {
161 | return (com.google.protobuf.ByteString) ref;
162 | }
163 | }
164 |
165 | private byte memoizedIsInitialized = -1;
166 | @Override
167 | public final boolean isInitialized() {
168 | byte isInitialized = memoizedIsInitialized;
169 | if (isInitialized == 1) return true;
170 | if (isInitialized == 0) return false;
171 |
172 | memoizedIsInitialized = 1;
173 | return true;
174 | }
175 |
176 | @Override
177 | public void writeTo(com.google.protobuf.CodedOutputStream output)
178 | throws java.io.IOException {
179 | if (!getContentBytes().isEmpty()) {
180 | com.google.protobuf.GeneratedMessageV3.writeString(output, 1, content_);
181 | }
182 | if (id_ != 0) {
183 | output.writeInt32(2, id_);
184 | }
185 | unknownFields.writeTo(output);
186 | }
187 |
188 | @Override
189 | public int getSerializedSize() {
190 | int size = memoizedSize;
191 | if (size != -1) return size;
192 |
193 | size = 0;
194 | if (!getContentBytes().isEmpty()) {
195 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, content_);
196 | }
197 | if (id_ != 0) {
198 | size += com.google.protobuf.CodedOutputStream
199 | .computeInt32Size(2, id_);
200 | }
201 | size += unknownFields.getSerializedSize();
202 | memoizedSize = size;
203 | return size;
204 | }
205 |
206 | @Override
207 | public boolean equals(final Object obj) {
208 | if (obj == this) {
209 | return true;
210 | }
211 | if (!(obj instanceof MessageOuterClass.Message)) {
212 | return super.equals(obj);
213 | }
214 | MessageOuterClass.Message other = (MessageOuterClass.Message) obj;
215 |
216 | boolean result = true;
217 | result = result && (getId()
218 | == other.getId());
219 | result = result && getContent()
220 | .equals(other.getContent());
221 | result = result && unknownFields.equals(other.unknownFields);
222 | return result;
223 | }
224 |
225 | @Override
226 | public int hashCode() {
227 | if (memoizedHashCode != 0) {
228 | return memoizedHashCode;
229 | }
230 | int hash = 41;
231 | hash = (19 * hash) + getDescriptor().hashCode();
232 | hash = (37 * hash) + ID_FIELD_NUMBER;
233 | hash = (53 * hash) + getId();
234 | hash = (37 * hash) + CONTENT_FIELD_NUMBER;
235 | hash = (53 * hash) + getContent().hashCode();
236 | hash = (29 * hash) + unknownFields.hashCode();
237 | memoizedHashCode = hash;
238 | return hash;
239 | }
240 |
241 | public static MessageOuterClass.Message parseFrom(
242 | java.nio.ByteBuffer data)
243 | throws com.google.protobuf.InvalidProtocolBufferException {
244 | return PARSER.parseFrom(data);
245 | }
246 | public static MessageOuterClass.Message parseFrom(
247 | java.nio.ByteBuffer data,
248 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
249 | throws com.google.protobuf.InvalidProtocolBufferException {
250 | return PARSER.parseFrom(data, extensionRegistry);
251 | }
252 | public static MessageOuterClass.Message parseFrom(
253 | com.google.protobuf.ByteString data)
254 | throws com.google.protobuf.InvalidProtocolBufferException {
255 | return PARSER.parseFrom(data);
256 | }
257 | public static MessageOuterClass.Message parseFrom(
258 | com.google.protobuf.ByteString data,
259 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
260 | throws com.google.protobuf.InvalidProtocolBufferException {
261 | return PARSER.parseFrom(data, extensionRegistry);
262 | }
263 | public static MessageOuterClass.Message parseFrom(byte[] data)
264 | throws com.google.protobuf.InvalidProtocolBufferException {
265 | return PARSER.parseFrom(data);
266 | }
267 | public static MessageOuterClass.Message parseFrom(
268 | byte[] data,
269 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
270 | throws com.google.protobuf.InvalidProtocolBufferException {
271 | return PARSER.parseFrom(data, extensionRegistry);
272 | }
273 | public static MessageOuterClass.Message parseFrom(java.io.InputStream input)
274 | throws java.io.IOException {
275 | return com.google.protobuf.GeneratedMessageV3
276 | .parseWithIOException(PARSER, input);
277 | }
278 | public static MessageOuterClass.Message parseFrom(
279 | java.io.InputStream input,
280 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
281 | throws java.io.IOException {
282 | return com.google.protobuf.GeneratedMessageV3
283 | .parseWithIOException(PARSER, input, extensionRegistry);
284 | }
285 | public static MessageOuterClass.Message parseDelimitedFrom(java.io.InputStream input)
286 | throws java.io.IOException {
287 | return com.google.protobuf.GeneratedMessageV3
288 | .parseDelimitedWithIOException(PARSER, input);
289 | }
290 | public static MessageOuterClass.Message parseDelimitedFrom(
291 | java.io.InputStream input,
292 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
293 | throws java.io.IOException {
294 | return com.google.protobuf.GeneratedMessageV3
295 | .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
296 | }
297 | public static MessageOuterClass.Message parseFrom(
298 | com.google.protobuf.CodedInputStream input)
299 | throws java.io.IOException {
300 | return com.google.protobuf.GeneratedMessageV3
301 | .parseWithIOException(PARSER, input);
302 | }
303 | public static MessageOuterClass.Message parseFrom(
304 | com.google.protobuf.CodedInputStream input,
305 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
306 | throws java.io.IOException {
307 | return com.google.protobuf.GeneratedMessageV3
308 | .parseWithIOException(PARSER, input, extensionRegistry);
309 | }
310 |
311 | @Override
312 | public Builder newBuilderForType() { return newBuilder(); }
313 | public static Builder newBuilder() {
314 | return DEFAULT_INSTANCE.toBuilder();
315 | }
316 | public static Builder newBuilder(MessageOuterClass.Message prototype) {
317 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
318 | }
319 | @Override
320 | public Builder toBuilder() {
321 | return this == DEFAULT_INSTANCE
322 | ? new Builder() : new Builder().mergeFrom(this);
323 | }
324 |
325 | @Override
326 | protected Builder newBuilderForType(
327 | BuilderParent parent) {
328 | Builder builder = new Builder(parent);
329 | return builder;
330 | }
331 | /**
332 | *
333 | * 返回消息体
334 | *
335 | *
336 | * Protobuf type {@code Message}
337 | */
338 | public static final class Builder extends
339 | com.google.protobuf.GeneratedMessageV3.Builder implements
340 | // @@protoc_insertion_point(builder_implements:Message)
341 | MessageOuterClass.MessageOrBuilder {
342 | public static final com.google.protobuf.Descriptors.Descriptor
343 | getDescriptor() {
344 | return MessageOuterClass.internal_static_Message_descriptor;
345 | }
346 |
347 | @Override
348 | protected FieldAccessorTable
349 | internalGetFieldAccessorTable() {
350 | return MessageOuterClass.internal_static_Message_fieldAccessorTable
351 | .ensureFieldAccessorsInitialized(
352 | MessageOuterClass.Message.class, MessageOuterClass.Message.Builder.class);
353 | }
354 |
355 | // Construct using MessageOuterClass.Message.newBuilder()
356 | private Builder() {
357 | maybeForceBuilderInitialization();
358 | }
359 |
360 | private Builder(
361 | BuilderParent parent) {
362 | super(parent);
363 | maybeForceBuilderInitialization();
364 | }
365 | private void maybeForceBuilderInitialization() {
366 | if (com.google.protobuf.GeneratedMessageV3
367 | .alwaysUseFieldBuilders) {
368 | }
369 | }
370 | @Override
371 | public Builder clear() {
372 | super.clear();
373 | id_ = 0;
374 |
375 | content_ = "";
376 |
377 | return this;
378 | }
379 |
380 | @Override
381 | public com.google.protobuf.Descriptors.Descriptor
382 | getDescriptorForType() {
383 | return MessageOuterClass.internal_static_Message_descriptor;
384 | }
385 |
386 | @Override
387 | public MessageOuterClass.Message getDefaultInstanceForType() {
388 | return MessageOuterClass.Message.getDefaultInstance();
389 | }
390 |
391 | @Override
392 | public MessageOuterClass.Message build() {
393 | MessageOuterClass.Message result = buildPartial();
394 | if (!result.isInitialized()) {
395 | throw newUninitializedMessageException(result);
396 | }
397 | return result;
398 | }
399 |
400 | @Override
401 | public MessageOuterClass.Message buildPartial() {
402 | MessageOuterClass.Message result = new MessageOuterClass.Message(this);
403 | result.id_ = id_;
404 | result.content_ = content_;
405 | onBuilt();
406 | return result;
407 | }
408 |
409 | @Override
410 | public Builder clone() {
411 | return (Builder) super.clone();
412 | }
413 | @Override
414 | public Builder setField(
415 | com.google.protobuf.Descriptors.FieldDescriptor field,
416 | Object value) {
417 | return (Builder) super.setField(field, value);
418 | }
419 | @Override
420 | public Builder clearField(
421 | com.google.protobuf.Descriptors.FieldDescriptor field) {
422 | return (Builder) super.clearField(field);
423 | }
424 | @Override
425 | public Builder clearOneof(
426 | com.google.protobuf.Descriptors.OneofDescriptor oneof) {
427 | return (Builder) super.clearOneof(oneof);
428 | }
429 | @Override
430 | public Builder setRepeatedField(
431 | com.google.protobuf.Descriptors.FieldDescriptor field,
432 | int index, Object value) {
433 | return (Builder) super.setRepeatedField(field, index, value);
434 | }
435 | @Override
436 | public Builder addRepeatedField(
437 | com.google.protobuf.Descriptors.FieldDescriptor field,
438 | Object value) {
439 | return (Builder) super.addRepeatedField(field, value);
440 | }
441 | @Override
442 | public Builder mergeFrom(com.google.protobuf.Message other) {
443 | if (other instanceof MessageOuterClass.Message) {
444 | return mergeFrom((MessageOuterClass.Message)other);
445 | } else {
446 | super.mergeFrom(other);
447 | return this;
448 | }
449 | }
450 |
451 | public Builder mergeFrom(MessageOuterClass.Message other) {
452 | if (other == MessageOuterClass.Message.getDefaultInstance()) return this;
453 | if (other.getId() != 0) {
454 | setId(other.getId());
455 | }
456 | if (!other.getContent().isEmpty()) {
457 | content_ = other.content_;
458 | onChanged();
459 | }
460 | this.mergeUnknownFields(other.unknownFields);
461 | onChanged();
462 | return this;
463 | }
464 |
465 | @Override
466 | public final boolean isInitialized() {
467 | return true;
468 | }
469 |
470 | @Override
471 | public Builder mergeFrom(
472 | com.google.protobuf.CodedInputStream input,
473 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
474 | throws java.io.IOException {
475 | MessageOuterClass.Message parsedMessage = null;
476 | try {
477 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
478 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
479 | parsedMessage = (MessageOuterClass.Message) e.getUnfinishedMessage();
480 | throw e.unwrapIOException();
481 | } finally {
482 | if (parsedMessage != null) {
483 | mergeFrom(parsedMessage);
484 | }
485 | }
486 | return this;
487 | }
488 |
489 | private int id_ ;
490 | /**
491 | * int32 id = 2;
492 | */
493 | public int getId() {
494 | return id_;
495 | }
496 | /**
497 | * int32 id = 2;
498 | */
499 | public Builder setId(int value) {
500 |
501 | id_ = value;
502 | onChanged();
503 | return this;
504 | }
505 | /**
506 | * int32 id = 2;
507 | */
508 | public Builder clearId() {
509 |
510 | id_ = 0;
511 | onChanged();
512 | return this;
513 | }
514 |
515 | private Object content_ = "";
516 | /**
517 | * string content = 1;
518 | */
519 | public String getContent() {
520 | Object ref = content_;
521 | if (!(ref instanceof String)) {
522 | com.google.protobuf.ByteString bs =
523 | (com.google.protobuf.ByteString) ref;
524 | String s = bs.toStringUtf8();
525 | content_ = s;
526 | return s;
527 | } else {
528 | return (String) ref;
529 | }
530 | }
531 | /**
532 | * string content = 1;
533 | */
534 | public com.google.protobuf.ByteString
535 | getContentBytes() {
536 | Object ref = content_;
537 | if (ref instanceof String) {
538 | com.google.protobuf.ByteString b =
539 | com.google.protobuf.ByteString.copyFromUtf8(
540 | (String) ref);
541 | content_ = b;
542 | return b;
543 | } else {
544 | return (com.google.protobuf.ByteString) ref;
545 | }
546 | }
547 | /**
548 | * string content = 1;
549 | */
550 | public Builder setContent(
551 | String value) {
552 | if (value == null) {
553 | throw new NullPointerException();
554 | }
555 |
556 | content_ = value;
557 | onChanged();
558 | return this;
559 | }
560 | /**
561 | * string content = 1;
562 | */
563 | public Builder clearContent() {
564 |
565 | content_ = getDefaultInstance().getContent();
566 | onChanged();
567 | return this;
568 | }
569 | /**
570 | * string content = 1;
571 | */
572 | public Builder setContentBytes(
573 | com.google.protobuf.ByteString value) {
574 | if (value == null) {
575 | throw new NullPointerException();
576 | }
577 | checkByteStringIsUtf8(value);
578 |
579 | content_ = value;
580 | onChanged();
581 | return this;
582 | }
583 | @Override
584 | public final Builder setUnknownFields(
585 | final com.google.protobuf.UnknownFieldSet unknownFields) {
586 | return super.setUnknownFieldsProto3(unknownFields);
587 | }
588 |
589 | @Override
590 | public final Builder mergeUnknownFields(
591 | final com.google.protobuf.UnknownFieldSet unknownFields) {
592 | return super.mergeUnknownFields(unknownFields);
593 | }
594 |
595 |
596 | // @@protoc_insertion_point(builder_scope:Message)
597 | }
598 |
599 | // @@protoc_insertion_point(class_scope:Message)
600 | private static final MessageOuterClass.Message DEFAULT_INSTANCE;
601 | static {
602 | DEFAULT_INSTANCE = new MessageOuterClass.Message();
603 | }
604 |
605 | public static MessageOuterClass.Message getDefaultInstance() {
606 | return DEFAULT_INSTANCE;
607 | }
608 |
609 | private static final com.google.protobuf.Parser
610 | PARSER = new com.google.protobuf.AbstractParser() {
611 | @Override
612 | public Message parsePartialFrom(
613 | com.google.protobuf.CodedInputStream input,
614 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
615 | throws com.google.protobuf.InvalidProtocolBufferException {
616 | return new Message(input, extensionRegistry);
617 | }
618 | };
619 |
620 | public static com.google.protobuf.Parser parser() {
621 | return PARSER;
622 | }
623 |
624 | @Override
625 | public com.google.protobuf.Parser getParserForType() {
626 | return PARSER;
627 | }
628 |
629 | @Override
630 | public MessageOuterClass.Message getDefaultInstanceForType() {
631 | return DEFAULT_INSTANCE;
632 | }
633 |
634 | }
635 |
636 | private static final com.google.protobuf.Descriptors.Descriptor
637 | internal_static_Message_descriptor;
638 | private static final
639 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
640 | internal_static_Message_fieldAccessorTable;
641 |
642 | public static com.google.protobuf.Descriptors.FileDescriptor
643 | getDescriptor() {
644 | return descriptor;
645 | }
646 | private static com.google.protobuf.Descriptors.FileDescriptor
647 | descriptor;
648 | static {
649 | String[] descriptorData = {
650 | "\n\rMessage.proto\"&\n\007Message\022\n\n\002id\030\002 \001(\005\022\017" +
651 | "\n\007content\030\001 \001(\tb\006proto3"
652 | };
653 | com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
654 | new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
655 | public com.google.protobuf.ExtensionRegistry assignDescriptors(
656 | com.google.protobuf.Descriptors.FileDescriptor root) {
657 | descriptor = root;
658 | return null;
659 | }
660 | };
661 | com.google.protobuf.Descriptors.FileDescriptor
662 | .internalBuildGeneratedFileFrom(descriptorData,
663 | new com.google.protobuf.Descriptors.FileDescriptor[] {
664 | }, assigner);
665 | internal_static_Message_descriptor =
666 | getDescriptor().getMessageTypes().get(0);
667 | internal_static_Message_fieldAccessorTable = new
668 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
669 | internal_static_Message_descriptor,
670 | new String[] { "Id", "Content", });
671 | }
672 |
673 | // @@protoc_insertion_point(outer_class_scope)
674 | }
675 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/Beans/User.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.Beans;
2 |
3 | public class User {
4 |
5 | private Integer id;
6 | private String name;
7 | private int age;
8 | private String password;
9 |
10 | public User() {
11 | }
12 |
13 | public Integer getId() {
14 | return id;
15 | }
16 |
17 | public void setId(Integer id) {
18 | this.id = id;
19 | }
20 |
21 | public String getName() {
22 | return name;
23 | }
24 |
25 | public void setName(String name) {
26 | this.name = name;
27 | }
28 |
29 | public int getAge() {
30 | return age;
31 | }
32 |
33 | public void setAge(int age) {
34 | this.age = age;
35 | }
36 |
37 | public String getPassword() {
38 | return password;
39 | }
40 |
41 | public void setPassword(String password) {
42 | this.password = password;
43 | }
44 |
45 | @Override
46 | public String toString() {
47 | return "User{" +
48 | "id=" + id +
49 | ", name='" + name + '\'' +
50 | ", age=" + age +
51 | ", password='" + password + '\'' +
52 | '}';
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/Common/AntiTools.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.Common;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageInfo;
5 | import android.content.pm.PackageManager;
6 | import android.content.pm.Signature;
7 | import android.util.Log;
8 |
9 | import java.io.BufferedReader;
10 | import java.io.FileReader;
11 | import java.net.InetAddress;
12 | import java.net.Socket;
13 | import java.security.MessageDigest;
14 |
15 | public class AntiTools {
16 |
17 | private static String TAG = "AntiTools";
18 |
19 | public static boolean checkSignature(Context context, String hash){
20 | PackageManager packageManager = context.getPackageManager();
21 | String packageName = context.getPackageName();
22 | try{
23 | PackageInfo packageInfo = packageManager.getPackageInfo(packageName,
24 | PackageManager.GET_SIGNATURES);
25 | Signature signature = packageInfo.signatures[0];
26 | MessageDigest messageDigest = MessageDigest.getInstance("SHA1");
27 | byte[] signHash = messageDigest.digest(signature.toByteArray());
28 | if (hash.equalsIgnoreCase(toHex(signHash))){
29 | return true;
30 | }
31 | }catch (Exception e){
32 | e.printStackTrace();
33 | return false;
34 | }
35 | return false;
36 | }
37 |
38 | private static String toHex(byte[] bytes) {
39 |
40 | StringBuffer stringBuffer = new StringBuffer();
41 |
42 | for (int i = 0; i < bytes.length; i++) {
43 | if (Integer.toHexString(0xFF & bytes[i]).length() == 1) {
44 | stringBuffer.append("0").append(Integer.toHexString(0xFF & bytes[i]));
45 | } else {
46 | stringBuffer.append(Integer.toHexString(0xFF & bytes[i]));
47 | }
48 | }
49 | String result = stringBuffer.toString();
50 | Log.e(TAG, "signature: " + result);
51 | return result;
52 | }
53 |
54 | public static boolean checkProxy(){
55 | String proxyHost = System.getProperty("http.proxyHost");
56 | String proxyPort = System.getProperty("http.proxyPort");
57 | Log.e(TAG, "proxy info: " + proxyHost + ":" + proxyPort);
58 | if (proxyHost != null & proxyPort != null){
59 | return true;
60 | }
61 | return false;
62 | }
63 |
64 | public static boolean checkPort(int port){
65 | try {
66 | InetAddress inetAddress = InetAddress.getByName("127.0.0.1");
67 | Socket socket = new Socket(inetAddress, port);
68 | return true;
69 | } catch (Exception e) {
70 | e.printStackTrace();
71 | return false;
72 | }
73 | }
74 |
75 | public static boolean checkHook(){
76 | boolean flag = false;
77 | String mapsFilename="/proc/"+android.os.Process.myPid()+"/maps";
78 | Log.e(TAG, mapsFilename);
79 | try {
80 | BufferedReader reader = new BufferedReader(new FileReader(mapsFilename));
81 | String line;
82 | while((line=reader.readLine())!=null){
83 | if(line.contains("com.saurik.substrate")) {
84 | Log.e(TAG, "Substrate shared object found: " + line);
85 | flag = true;
86 | break;
87 | }
88 | if(line.contains("XposedBridge.jar")) {
89 | Log.e(TAG, "Xposed JAR found: " + line);
90 | flag = true;
91 | break;
92 | }
93 | }
94 | reader.close();
95 | } catch (Exception e) {
96 | Log.wtf("HookDetection", e.toString());
97 | }
98 | return flag;
99 | }
100 |
101 | }
102 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/Common/Utils.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.Common;
2 |
3 | import android.util.Log;
4 |
5 | import java.io.BufferedReader;
6 | import java.io.IOException;
7 | import java.io.InputStream;
8 | import java.io.InputStreamReader;
9 |
10 | public class Utils {
11 |
12 |
13 | public Utils() {
14 | Log.e("FragmentVuls", "Utils constructor");
15 | }
16 |
17 | public static String exec(String cmd){
18 |
19 | StringBuilder result = new StringBuilder();
20 |
21 | try{
22 | Process process = Runtime.getRuntime().exec(new String[]{"/system/bin/sh", "-c", cmd});
23 | InputStream inputStream = process.getInputStream();
24 | InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
25 | BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
26 | String line = null;
27 | while( (line = bufferedReader.readLine()) != null ){
28 | result.append(line);
29 | }
30 | }catch (IOException e){
31 | e.printStackTrace();
32 | }
33 |
34 | return result.toString();
35 | }
36 |
37 | public static final String byte2hex(byte b[]) {
38 | if (b == null) {
39 | throw new IllegalArgumentException(
40 | "Argument b ( byte array ) is null! ");
41 | }
42 | String hs = "";
43 | String stmp = "";
44 | for (int n = 0; n < b.length; n++) {
45 | stmp = Integer.toHexString(b[n] & 0xff);
46 | if (stmp.length() == 1) {
47 | hs = hs + "0" + stmp;
48 | } else {
49 | hs = hs + stmp;
50 | }
51 | }
52 | return hs.toUpperCase();
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/ContentProviders/AccountProvider.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.ContentProviders;
2 |
3 | import android.content.ContentProvider;
4 | import android.content.ContentUris;
5 | import android.content.ContentValues;
6 | import android.content.Context;
7 | import android.content.UriMatcher;
8 | import android.database.Cursor;
9 | import android.database.sqlite.SQLiteDatabase;
10 | import android.net.Uri;
11 | import android.os.ParcelFileDescriptor;
12 | import android.support.annotation.NonNull;
13 | import android.support.annotation.Nullable;
14 |
15 | import java.io.File;
16 | import java.io.FileNotFoundException;
17 | import java.io.FileOutputStream;
18 |
19 | public class AccountProvider extends ContentProvider {
20 |
21 | private static final int TYPE_ALL = 1;
22 | private static final int TYPE_SINGLE = 2;
23 | private static final int TYPE_QYERY = 3;
24 | private DBHelper dbHelper;
25 | private static UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
26 |
27 | static {
28 | matcher.addURI("ddns.vuls.AccountProvider", "/account", TYPE_ALL);
29 | matcher.addURI("ddns.vuls.AccountProvider", "/account/#", TYPE_SINGLE);
30 | matcher.addURI("ddns.vuls.AccountProvider", "/account/*", TYPE_QYERY);
31 | }
32 |
33 | public AccountProvider() {
34 | }
35 |
36 | @Override
37 | public int delete(Uri uri, String selection, String[] selectionArgs) {
38 | SQLiteDatabase database = dbHelper.getReadableDatabase();
39 | int deleteCount = -1;
40 |
41 | switch (matcher.match(uri)) {
42 | case TYPE_ALL:
43 | deleteCount = database.delete("account", selection, selectionArgs);
44 | break;
45 | case TYPE_SINGLE:
46 | long id = ContentUris.parseId(uri);
47 | deleteCount = database.delete("account", "_id=" + id, null);
48 | break;
49 | default:
50 | break;
51 | }
52 |
53 | database.close();
54 | return deleteCount;
55 | }
56 |
57 | @Override
58 | public String getType(Uri uri) {
59 | throw new UnsupportedOperationException("Not yet implemented");
60 | }
61 |
62 | @Override
63 | public Uri insert(Uri uri, ContentValues values) {
64 | SQLiteDatabase database = dbHelper.getReadableDatabase();
65 | Uri result = null;
66 |
67 | switch (matcher.match(uri)){
68 | case TYPE_ALL:
69 | long id = database.insert("account", null, values);
70 | result = ContentUris.withAppendedId(uri, id);
71 | database.close();
72 | break;
73 | default:
74 | database.close();
75 | break;
76 | }
77 |
78 | return result;
79 |
80 | }
81 |
82 | @Override
83 | public boolean onCreate() {
84 | dbHelper = new DBHelper(getContext());
85 | try {
86 | FileOutputStream fileOutputStream = getContext().openFileOutput("token.txt", Context.MODE_PRIVATE);
87 | fileOutputStream.write("token: THISISIMPORTENT".getBytes("utf-8"));
88 | fileOutputStream.close();
89 | } catch (Exception e) {
90 | e.printStackTrace();
91 | }
92 |
93 | return false;
94 | }
95 |
96 | @Override
97 | public Cursor query(Uri uri, String[] projection, String selection,
98 | String[] selectionArgs, String sortOrder) {
99 | SQLiteDatabase database = dbHelper.getReadableDatabase();
100 | Cursor result = null;
101 |
102 | switch (matcher.match(uri)){
103 | case TYPE_ALL:
104 | String name = uri.getQueryParameter("name");
105 | if (null != name){
106 | result = database.query("account", projection, "name='" + name + "'" , null, null, null, null);
107 | }else {
108 | result = database.query("account", projection, selection, selectionArgs, null, null, null);
109 | }
110 | break;
111 | case TYPE_SINGLE:
112 | long id = ContentUris.parseId(uri);
113 | result = database.query("account", projection, "_id=?", new String[]{id + ""}, null, null, null);
114 | break;
115 | default:
116 | break;
117 | }
118 |
119 | return result;
120 |
121 | }
122 |
123 | @Override
124 | public int update(Uri uri, ContentValues values, String selection,
125 | String[] selectionArgs) {
126 | SQLiteDatabase database = dbHelper.getReadableDatabase();
127 | int updateCount = -1;
128 |
129 | switch (matcher.match(uri)){
130 | case TYPE_ALL:
131 | updateCount = database.update("account", values, selection, selectionArgs);
132 | break;
133 | case TYPE_SINGLE:
134 | long id = ContentUris.parseId(uri);
135 | updateCount = database.update("account", values, "_id=" + id, null);
136 | break;
137 | default:
138 | break;
139 | }
140 |
141 | database.close();
142 | return updateCount;
143 | }
144 |
145 | @Nullable
146 | @Override
147 | public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode) throws FileNotFoundException {
148 | String file = uri.getPath();
149 | File filesDir = getContext().getFilesDir();
150 | file = filesDir + file;
151 |
152 | if ("w".equals(mode)){
153 | return ParcelFileDescriptor.open(
154 | new File(file),
155 | ParcelFileDescriptor.MODE_WRITE_ONLY);
156 | }else{
157 | return ParcelFileDescriptor.open(
158 | new File(file),
159 | ParcelFileDescriptor.MODE_READ_ONLY);
160 | }
161 |
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/ContentProviders/DBHelper.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.ContentProviders;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteOpenHelper;
6 |
7 | public class DBHelper extends SQLiteOpenHelper {
8 |
9 | public DBHelper(Context context) {
10 | super(context, "secure.db", null, 1);
11 | }
12 |
13 | @Override
14 | public void onCreate(SQLiteDatabase db) {
15 |
16 | db.execSQL("create table account(_id integer primary key autoincrement, name varchar, password varchar)");
17 | //插入初始化数据
18 | db.execSQL("insert into account (name, password) values ('Tom', '123456')");
19 |
20 | }
21 |
22 | @Override
23 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/MainActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 |
8 | import ddns.android.vuls.activities.Activity.ActivityActivity;
9 | import ddns.android.vuls.activities.Broadcast.BroadcastActivity;
10 | import ddns.android.vuls.activities.Broadcast.LoginBroadcastActivity;
11 | import ddns.android.vuls.activities.Services.ServiceActivity;
12 | import ddns.android.vuls.activities.Webview.WebviewSecActivity;
13 | import ddns.android.vuls.activities.net.NetActivity;
14 | import ddns.android.vuls.activities.storage.StorageActivity;
15 |
16 | public class MainActivity extends AppCompatActivity implements View.OnClickListener {
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_main);
22 | findViewById(R.id.btn_storage).setOnClickListener(this);
23 | findViewById(R.id.btn_net).setOnClickListener(this);
24 | findViewById(R.id.btn_activity).setOnClickListener(this);
25 | findViewById(R.id.btn_service).setOnClickListener(this);
26 | findViewById(R.id.btn_broadcast).setOnClickListener(this);
27 | findViewById(R.id.btn_webview).setOnClickListener(this);
28 | }
29 |
30 | @Override
31 | public void onClick(View v) {
32 | switch (v.getId()) {
33 | case R.id.btn_storage:
34 | startActivity(new Intent(this, StorageActivity.class));
35 | break;
36 | case R.id.btn_net:
37 | startActivity(new Intent(this, NetActivity.class));
38 | break;
39 | case R.id.btn_activity:
40 | startActivity(new Intent(this, ActivityActivity.class));
41 | break;
42 | case R.id.btn_service:
43 | startActivity(new Intent(this, ServiceActivity.class));
44 | break;
45 | case R.id.btn_broadcast:
46 | startActivity(new Intent(this, BroadcastActivity.class));
47 | break;
48 | case R.id.btn_webview:
49 | startActivity(new Intent(this, WebviewSecActivity.class));
50 | break;
51 |
52 | default:
53 | break;
54 | }
55 |
56 |
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/TokenReceiver.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.util.Log;
7 |
8 | public class TokenReceiver extends BroadcastReceiver {
9 |
10 | @Override
11 | public void onReceive(Context context, Intent intent) {
12 |
13 | boolean success = intent.getBooleanExtra("success", false);
14 | if (success){
15 | String token = intent.getStringExtra("token");
16 | Log.e("TokenReceiver", "token: " + token);
17 | }else {
18 | Log.e("TokenReceiver", "no token");
19 | }
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Activity/AccountActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Activity;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import ddns.android.vuls.R;
7 |
8 | public class AccountActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_account);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Activity/ActivityActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Activity;
2 |
3 | import android.content.Intent;
4 | import android.net.Uri;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.view.View;
8 |
9 | import ddns.android.vuls.R;
10 |
11 | public class ActivityActivity extends AppCompatActivity {
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.activity_activity);
17 | }
18 |
19 | public void bypassLogin(View view){
20 | startActivity(new Intent(this, LoginActivity.class));
21 | }
22 |
23 | public void openWebsite(View view){
24 | startActivity(new Intent(this, WebActivity.class));
25 | }
26 |
27 | public void openWebsiteWithBrowser(View view){
28 |
29 | Uri uri = Uri.parse("https://www.baidu.com");
30 | Intent intent = new Intent(Intent.ACTION_VIEW, uri);
31 | startActivity(intent);
32 | }
33 |
34 | public void startFragementActivity(View view){
35 |
36 | startActivity(new Intent(this, FragmentActivity.class));
37 | }
38 |
39 |
40 |
41 |
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Activity/Dos1Activity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Activity;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.widget.Toast;
7 |
8 | import ddns.android.vuls.R;
9 |
10 | public class Dos1Activity extends AppCompatActivity {
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_dos);
16 |
17 | Intent intent = getIntent();
18 |
19 | String data = intent.getStringExtra("data");
20 | System.out.println(data);
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Activity/Dos2Activity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Activity;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 |
7 | import ddns.android.vuls.R;
8 |
9 | public class Dos2Activity extends AppCompatActivity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_dos2);
15 |
16 | Intent intent = getIntent();
17 | boolean[] items = intent.getBooleanArrayExtra("data");
18 | for (boolean item : items){
19 | System.out.println(item);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Activity/FragmentActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Activity;
2 |
3 | import android.os.Bundle;
4 | import android.preference.PreferenceActivity;
5 | import android.util.Log;
6 |
7 |
8 | public class FragmentActivity extends PreferenceActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | }
14 |
15 | @Override
16 | protected boolean isValidFragment(String fragmentName) {
17 | Log.e("FragmentVuls", "fragmentName: " + fragmentName);
18 | return true;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Activity/LoginActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Activity;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.text.Editable;
7 | import android.view.View;
8 | import android.widget.EditText;
9 | import android.widget.Toast;
10 |
11 | import ddns.android.vuls.R;
12 |
13 | public class LoginActivity extends AppCompatActivity {
14 |
15 | private String username;
16 | private String password;
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_login);
22 |
23 | }
24 |
25 | public void login(View view){
26 | username = ((EditText) findViewById(R.id.et_ac_username)).getText().toString();
27 | password = ((EditText) findViewById(R.id.et_ac_password)).getText().toString();
28 | if ("admin".equalsIgnoreCase(username) && "123456".equalsIgnoreCase(password)){
29 | startActivity(new Intent(this, AccountActivity.class));
30 | }else {
31 | Toast.makeText(this, "账号或密码错误!", Toast.LENGTH_LONG).show();
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Activity/TargetFragment.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Activity;
2 |
3 | import android.app.Fragment;
4 | import android.os.Bundle;
5 | import android.util.Log;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.webkit.WebView;
10 |
11 | import ddns.android.vuls.R;
12 |
13 | public class TargetFragment extends Fragment {
14 |
15 | public TargetFragment() {
16 | Log.e("DDNS: ", "TargetFragment's constructor");
17 | }
18 |
19 | @Override
20 | public void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | }
23 |
24 | @Override
25 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
26 | Bundle savedInstanceState) {
27 | View view = inflater.inflate(R.layout.fragment_target,null);
28 | WebView webview = (WebView) view.findViewById(R.id.webview_fragment);
29 | webview.getSettings().setJavaScriptEnabled(true);
30 | webview.loadUrl(getActivity().getIntent().getDataString());
31 | return view;
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Activity/WebActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Activity;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.webkit.WebChromeClient;
8 | import android.webkit.WebView;
9 | import android.webkit.WebViewClient;
10 | import android.widget.EditText;
11 |
12 | import ddns.android.vuls.R;
13 |
14 | public class WebActivity extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_web);
20 | }
21 |
22 | public void visitWeb(View view){
23 | EditText editText = findViewById(R.id.et_weburl);
24 | String url = editText.getText().toString();
25 | Intent intent = new Intent(this, WebviewActivity.class);
26 | if (null != url){
27 | intent.putExtra("url", url);
28 | startActivity(intent);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Activity/WebviewActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Activity;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.webkit.WebChromeClient;
7 | import android.webkit.WebView;
8 | import android.webkit.WebViewClient;
9 |
10 | import ddns.android.vuls.R;
11 |
12 | public class WebviewActivity extends AppCompatActivity {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_webview);
18 |
19 | Intent intent = getIntent();
20 |
21 | String url = intent.getStringExtra("url");
22 | if (null != url){
23 | WebView webView = findViewById(R.id.webview);
24 | webView.setWebViewClient(new WebViewClient());
25 | webView.setWebChromeClient(new WebChromeClient());
26 | webView.loadUrl(url);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Broadcast/BroadcastActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Broadcast;
2 |
3 | import android.content.Intent;
4 | import android.content.IntentFilter;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import android.widget.Toast;
9 |
10 | import ddns.android.vuls.R;
11 |
12 | public class BroadcastActivity extends AppCompatActivity {
13 |
14 | private DosReceiver receiver;
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_broadcast);
20 | }
21 |
22 | public void brInfoleak(View view){
23 | startActivity(new Intent(this, LoginBroadcastActivity.class));
24 | }
25 |
26 | public void registBR(View view){
27 | if(receiver==null) {
28 | receiver = new DosReceiver();
29 | IntentFilter filter = new IntentFilter("ddns.receiver.dos");
30 | registerReceiver(receiver, filter);
31 | Toast.makeText(this, "注册广播接收器", Toast.LENGTH_LONG).show();
32 | } else {
33 | Toast.makeText(this, "已经注册了广播接收器", Toast.LENGTH_LONG).show();
34 | }
35 | }
36 |
37 | public void unRegistBR(View view) {
38 | if (receiver != null) {
39 | unregisterReceiver(receiver);
40 | receiver = null;
41 | Toast.makeText(this, "解注册广播接收器", Toast.LENGTH_LONG).show();
42 | } else {
43 |
44 | }
45 | }
46 |
47 | public void sendOrderBr(View view) {
48 | if (receiver != null) {
49 | unregisterReceiver(receiver);
50 | receiver = null;
51 | Toast.makeText(this, "解注册广播接收器", Toast.LENGTH_LONG).show();
52 | } else {
53 |
54 | }
55 | }
56 |
57 |
58 |
59 | @Override
60 | protected void onDestroy() {
61 | super.onDestroy();
62 | if(receiver!=null) {
63 | unregisterReceiver(receiver);
64 | receiver = null;
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Broadcast/DosReceiver.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Broadcast;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.util.Log;
7 |
8 | public class DosReceiver extends BroadcastReceiver {
9 |
10 | @Override
11 | public void onReceive(Context context, Intent intent) {
12 | String dos = intent.getStringExtra("dos");
13 | Log.e("DosReceiver", dos);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Broadcast/LoginBroadcastActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Broadcast;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.EditText;
8 | import android.widget.Toast;
9 |
10 | import ddns.android.vuls.R;
11 |
12 | public class LoginBroadcastActivity extends AppCompatActivity {
13 |
14 | private String username;
15 | private String password;
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_login_broadcast);
21 | }
22 |
23 | public void login(View view){
24 | username = ((EditText) findViewById(R.id.et_br_username)).getText().toString();
25 | password = ((EditText) findViewById(R.id.et_br_password)).getText().toString();
26 | Intent intent = new Intent();
27 | intent.setAction("ddns.action.Token");
28 | if ("admin".equalsIgnoreCase(username) && "123456".equalsIgnoreCase(password)){
29 | intent.putExtra("success", true);
30 | intent.putExtra("token", "f39uewuf09wu3u9jfi3");
31 | sendOrderedBroadcast(intent, null);
32 | Toast.makeText(this, "恭喜登录成功!", Toast.LENGTH_LONG).show();
33 | }else {
34 | intent.putExtra("success", false);
35 | sendOrderedBroadcast(intent, null);
36 | Toast.makeText(this, "账号或密码错误!", Toast.LENGTH_LONG).show();
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Services/ServiceActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Services;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.EditText;
8 |
9 | import ddns.android.vuls.R;
10 | import ddns.android.vuls.services.SMSService;
11 |
12 | public class ServiceActivity extends AppCompatActivity {
13 |
14 | private EditText et_phone;
15 | private EditText et_content;
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_service);
21 | et_phone = findViewById(R.id.et_phonenum);
22 | et_content = findViewById(R.id.et_content);
23 | }
24 |
25 |
26 | public void sendSMS(View view){
27 |
28 | Intent intent = new Intent(this, SMSService.class);
29 | intent.putExtra("phone", et_phone.getText().toString());
30 | intent.putExtra("content", et_content.getText().toString());
31 |
32 | startService(intent);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Webview/CloneActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Webview;
2 |
3 | import android.Manifest;
4 | import android.annotation.SuppressLint;
5 | import android.annotation.TargetApi;
6 | import android.content.pm.PackageManager;
7 | import android.net.Uri;
8 | import android.os.Build;
9 | import android.support.annotation.RequiresApi;
10 | import android.support.v4.app.ActivityCompat;
11 | import android.support.v4.content.ContextCompat;
12 | import android.support.v7.app.AppCompatActivity;
13 | import android.os.Bundle;
14 | import android.util.Log;
15 | import android.webkit.WebChromeClient;
16 | import android.webkit.WebSettings;
17 | import android.webkit.WebView;
18 | import android.webkit.WebViewClient;
19 |
20 | import ddns.android.vuls.R;
21 |
22 | public class CloneActivity extends AppCompatActivity {
23 |
24 | private WebView webView;
25 |
26 | public CloneActivity() {
27 | Log.e("FragmentVuls", "CloneActivity constructor");
28 | }
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 |
34 | initWebView();
35 |
36 | if (ActivityCompat.checkSelfPermission(CloneActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
37 | ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
38 | }
39 |
40 | Uri uri = getIntent().getData();
41 | String url = uri.getQueryParameter("url");
42 | Log.e("clone", url);
43 | webView.loadUrl(url);
44 |
45 | setContentView(webView);
46 |
47 | }
48 |
49 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
50 | private void initWebView(){
51 | webView = new WebView(this);
52 | WebSettings webSettings = webView.getSettings();
53 |
54 | webSettings.setJavaScriptEnabled(true);
55 |
56 | webSettings.setAllowFileAccess(true);
57 | webSettings.setAllowFileAccessFromFileURLs(true);
58 | webSettings.setAllowUniversalAccessFromFileURLs(true);
59 |
60 | webView.setWebViewClient(new WebViewClient());
61 | webView.setWebChromeClient(new WebChromeClient());
62 |
63 | }
64 |
65 | @Override
66 | protected void onDestroy() {
67 | super.onDestroy();
68 | webView.destroy();
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Webview/WebviewSecActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Webview;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 |
8 | import ddns.android.vuls.R;
9 |
10 | public class WebviewSecActivity extends AppCompatActivity {
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_webview_sec);
16 | }
17 |
18 | public void jsSec(View view){
19 | startActivity(new Intent(this, WvLoginActivity.class));
20 |
21 | }
22 |
23 | public void netSec(View view){
24 | startActivity(new Intent(this, WvNetActivity.class));
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Webview/WvLoginActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Webview;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.os.Bundle;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.text.TextUtils;
9 | import android.view.View;
10 | import android.webkit.CookieManager;
11 | import android.webkit.JavascriptInterface;
12 | import android.webkit.JsPromptResult;
13 | import android.webkit.JsResult;
14 | import android.webkit.WebChromeClient;
15 | import android.webkit.WebResourceRequest;
16 | import android.webkit.WebSettings;
17 | import android.webkit.WebView;
18 | import android.webkit.WebViewClient;
19 | import android.widget.EditText;
20 | import android.widget.Toast;
21 |
22 | import ddns.android.vuls.R;
23 |
24 | public class WvLoginActivity extends AppCompatActivity {
25 |
26 | private EditText etUsername;
27 | private EditText etPassword;
28 | private WebView webView;
29 | private String TOKEN = null;
30 | private String WEBSITE = "http://192.168.0.7/";
31 |
32 | @Override
33 | protected void onCreate(Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 | setContentView(R.layout.activity_wv_login);
36 | etUsername = findViewById(R.id.et_number);
37 | etPassword = findViewById(R.id.et_password);
38 | initWebView();
39 | }
40 |
41 | public void wvLogin(View view){
42 |
43 | String username = etUsername.getText().toString().trim();
44 | String password = etPassword.getText().toString().trim();
45 | if (TextUtils.isEmpty(username) || TextUtils.isEmpty(password)){
46 | Toast.makeText(WvLoginActivity.this, "账号和密码不能为空", Toast.LENGTH_SHORT).show();
47 | }else if ("12345".equals(password)){
48 | String sessionCookie = "session=" + username + "; HTTPOnly";
49 | TOKEN = sessionCookie;
50 | CookieManager.getInstance().setCookie(WEBSITE, sessionCookie);
51 | webView.loadUrl("javascript:javaCallJs(" + "'" + username + "'" + ")");
52 | setContentView(webView);
53 | }else {
54 | Toast.makeText(WvLoginActivity.this, "密码错误!", Toast.LENGTH_SHORT).show();
55 | }
56 |
57 | }
58 |
59 | @SuppressLint("JavascriptInterface")
60 | private void initWebView() {
61 | webView = new WebView(this);
62 | WebSettings webSettings = webView.getSettings();
63 |
64 | webSettings.setJavaScriptEnabled(true);
65 | webSettings.setBuiltInZoomControls(true);
66 | webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
67 | webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
68 | webView.setWebViewClient(new WebViewClient(){
69 |
70 | @Override
71 | public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
72 | Uri uri = request.getUrl();
73 | String scheme = uri.getScheme();
74 | String authority = uri.getAuthority();
75 | String activity = uri.getQueryParameter("activity");
76 | if ("ddns".equals(scheme) &&
77 | "startActivity".equals(authority) &&
78 | !TextUtils.isEmpty(activity)){
79 | Class> activityClass = null;
80 | try {
81 | activityClass = Class.forName(activity);
82 | } catch (ClassNotFoundException e) {
83 | e.printStackTrace();
84 | }
85 | if (activityClass != null){
86 | startActivity(new Intent(WvLoginActivity.this, activityClass));
87 | }
88 | return true;
89 | }
90 |
91 | return super.shouldOverrideUrlLoading(view, request);
92 | }
93 | });
94 |
95 | webView.setWebChromeClient(new WebChromeClient(){
96 | @Override
97 | public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
98 | return super.onJsAlert(view, url, message, result);
99 | }
100 |
101 | @Override
102 | public boolean onJsConfirm(WebView view, String url, String message, JsResult result) {
103 | return super.onJsConfirm(view, url, message, result);
104 | }
105 |
106 | @Override
107 | public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
108 | return super.onJsPrompt(view, url, message, defaultValue, result);
109 | }
110 | });
111 |
112 | //设置支持 js 调用 java
113 | webView.addJavascriptInterface(new JSInterface(),"Android");
114 |
115 | //加载网络资源
116 | webView.loadUrl(WEBSITE + "welcome");
117 | }
118 |
119 | private class JSInterface {
120 | @JavascriptInterface
121 | public String getSession(){
122 | return TOKEN;
123 | }
124 | }
125 |
126 | @Override
127 | protected void onDestroy() {
128 | super.onDestroy();
129 | webView.destroy();
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/Webview/WvNetActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.Webview;
2 |
3 | import android.net.http.SslError;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.text.TextUtils;
7 | import android.util.Log;
8 | import android.view.View;
9 | import android.webkit.SslErrorHandler;
10 | import android.webkit.WebChromeClient;
11 | import android.webkit.WebSettings;
12 | import android.webkit.WebView;
13 | import android.webkit.WebViewClient;
14 | import android.widget.EditText;
15 | import android.widget.Toast;
16 |
17 | import ddns.android.vuls.R;
18 |
19 | public class WvNetActivity extends AppCompatActivity {
20 |
21 | private WebView webView;
22 | private EditText etUrl;
23 |
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | setContentView(R.layout.activity_wv_net);
28 | etUrl = findViewById(R.id.et_wv_url);
29 | initWebview();
30 | }
31 |
32 | private void initWebview(){
33 | webView = new WebView(this);
34 | WebSettings webSettings = webView.getSettings();
35 |
36 | webSettings.setJavaScriptEnabled(true);
37 | webSettings.setBuiltInZoomControls(true);
38 | webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
39 | webView.setWebViewClient(new WebViewClient(){
40 | @Override
41 | public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
42 | handler.proceed();
43 | }
44 |
45 | });
46 |
47 | webView.setWebChromeClient(new WebChromeClient());
48 | }
49 |
50 | public void view(View view){
51 |
52 | String url = etUrl.getText().toString().trim();
53 | if (TextUtils.isEmpty((url))){
54 | Toast.makeText(WvNetActivity.this, "URL 不能为空!", Toast.LENGTH_LONG).show();
55 | }else {
56 | webView.loadUrl(url);
57 | setContentView(webView);
58 | }
59 |
60 | }
61 |
62 | @Override
63 | protected void onDestroy() {
64 | super.onDestroy();
65 | webView.destroy();
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/net/AntiActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.net;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.widget.Toast;
7 |
8 | import ddns.android.vuls.Common.AntiTools;
9 | import ddns.android.vuls.R;
10 |
11 | public class AntiActivity extends AppCompatActivity {
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.activity_anti);
17 | }
18 |
19 | public void checkSignature(View view){
20 | boolean notRepacked = AntiTools.checkSignature(AntiActivity.this,
21 | "c2429d87b38bf8ba347cfda67657576c80b18644");
22 | if (notRepacked){
23 | Toast.makeText(AntiActivity.this, "未重打包", Toast.LENGTH_LONG).show();
24 | }else {
25 | Toast.makeText(AntiActivity.this, "重打包了!", Toast.LENGTH_LONG).show();
26 | }
27 | }
28 |
29 | public void checkProxy(View view){
30 | boolean proxy = AntiTools.checkProxy();
31 | if (proxy){
32 | Toast.makeText(AntiActivity.this, "有代理或VPN", Toast.LENGTH_LONG).show();
33 | }else {
34 | Toast.makeText(AntiActivity.this, "网络环境正常", Toast.LENGTH_LONG).show();
35 | }
36 | }
37 |
38 | public void checkHook(View view){
39 | boolean hooked = AntiTools.checkHook();
40 | if (hooked){
41 | Toast.makeText(AntiActivity.this, "存在 Hook 框架", Toast.LENGTH_LONG).show();
42 | }else {
43 | Toast.makeText(AntiActivity.this, "环境正常", Toast.LENGTH_LONG).show();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/net/HttpsURLConnectionActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.net;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.util.Log;
6 | import android.view.View;
7 | import android.widget.Toast;
8 |
9 | import java.net.URL;
10 | import java.security.SecureRandom;
11 | import java.security.cert.CertificateException;
12 | import java.security.cert.X509Certificate;
13 |
14 | import javax.net.ssl.HostnameVerifier;
15 | import javax.net.ssl.HttpsURLConnection;
16 | import javax.net.ssl.SSLContext;
17 | import javax.net.ssl.SSLSession;
18 | import javax.net.ssl.TrustManager;
19 | import javax.net.ssl.X509TrustManager;
20 |
21 | import ddns.android.vuls.R;
22 |
23 | public class HttpsURLConnectionActivity extends AppCompatActivity {
24 |
25 | private String baidu = "https://www.baidu.com/aaa";
26 | private String self = "https://192.168.8.233";
27 |
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_https_urlconnection);
33 | }
34 |
35 | public void doHttpsURLConnection(View view) {
36 |
37 | new Thread(new Runnable() {
38 | @Override
39 | public void run() {
40 | try {
41 | URL url = new URL(baidu);
42 | HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
43 | connection.setConnectTimeout(5000);
44 | connection.setReadTimeout(10000);
45 | connection.connect();
46 |
47 | int responseCode = connection.getResponseCode();
48 | if (200 == responseCode) {
49 | runOnUiThread(new Runnable() {
50 | @Override
51 | public void run() {
52 | Toast.makeText(HttpsURLConnectionActivity.this, "请求成功", Toast.LENGTH_LONG).show();
53 | }
54 | });
55 | }
56 | connection.disconnect();
57 | } catch (Exception e) {
58 | e.printStackTrace();
59 | runOnUiThread(new Runnable() {
60 | @Override
61 | public void run() {
62 | Toast.makeText(HttpsURLConnectionActivity.this, "请求失败", Toast.LENGTH_LONG).show();
63 | }
64 | });
65 | }
66 | }
67 | }).start();
68 | }
69 |
70 | public void doCheckNothing(View view) {
71 |
72 | final TrustManager[] trustManagers = new TrustManager[]{
73 | new X509TrustManager() {
74 | @Override
75 | public void checkClientTrusted(X509Certificate[] chain, String authType)
76 | throws CertificateException {
77 | }
78 |
79 | @Override
80 | public void checkServerTrusted(X509Certificate[] chain, String authType)
81 | throws CertificateException {
82 | }
83 |
84 | @Override
85 | public X509Certificate[] getAcceptedIssuers() {
86 | return new X509Certificate[0];
87 | }
88 | }
89 | };
90 |
91 | final HostnameVerifier hostnameVerifier = new HostnameVerifier() {
92 | @Override
93 | public boolean verify(String hostname, SSLSession session) {
94 | return true;
95 | }
96 | };
97 |
98 | new Thread(new Runnable() {
99 | @Override
100 | public void run() {
101 | try {
102 | SSLContext sslContext = SSLContext.getInstance("TLS");
103 | sslContext.init(null, trustManagers, new SecureRandom());
104 |
105 | URL url = new URL(baidu);
106 | HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
107 | connection.setSSLSocketFactory(sslContext.getSocketFactory());
108 | connection.setHostnameVerifier(hostnameVerifier);
109 | connection.setConnectTimeout(5000);
110 | connection.setReadTimeout(10000);
111 | connection.connect();
112 |
113 | int responseCode = connection.getResponseCode();
114 | if (200 == responseCode) {
115 | runOnUiThread(new Runnable() {
116 | @Override
117 | public void run() {
118 | Toast.makeText(HttpsURLConnectionActivity.this, "请求成功", Toast.LENGTH_LONG).show();
119 | }
120 | });
121 | }
122 | connection.disconnect();
123 | } catch (Exception e) {
124 | e.printStackTrace();
125 | runOnUiThread(new Runnable() {
126 | @Override
127 | public void run() {
128 | Toast.makeText(HttpsURLConnectionActivity.this, "请求失败", Toast.LENGTH_LONG).show();
129 | }
130 | });
131 | }
132 | }
133 | }).start();
134 | }
135 |
136 | public void doCheckHost(View view) {
137 |
138 | final TrustManager[] trustManagers = new TrustManager[]{
139 | new X509TrustManager() {
140 | @Override
141 | public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
142 | }
143 |
144 | @Override
145 | public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
146 | }
147 |
148 | @Override
149 | public X509Certificate[] getAcceptedIssuers() {
150 | return new X509Certificate[0];
151 | }
152 | }
153 | };
154 |
155 | final HostnameVerifier hostnameVerifier = new HostnameVerifier() {
156 | @Override
157 | public boolean verify(String hostname, SSLSession session) {
158 | Log.e("NetAcitivty", hostname);
159 | HostnameVerifier hv = HttpsURLConnection.getDefaultHostnameVerifier();
160 | Boolean result = hv.verify("www.google.com", session);
161 | return result;
162 | }
163 | };
164 |
165 | new Thread(new Runnable() {
166 | @Override
167 | public void run() {
168 | try {
169 | SSLContext sslContext = SSLContext.getInstance("TLS");
170 | sslContext.init(null, trustManagers, new SecureRandom());
171 |
172 | URL url = new URL(baidu);
173 | HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
174 | connection.setSSLSocketFactory(sslContext.getSocketFactory());
175 | connection.setHostnameVerifier(hostnameVerifier);
176 | connection.setConnectTimeout(5000);
177 | connection.setReadTimeout(10000);
178 | connection.connect();
179 |
180 | int responseCode = connection.getResponseCode();
181 | if (200 == responseCode) {
182 | runOnUiThread(new Runnable() {
183 | @Override
184 | public void run() {
185 | Toast.makeText(HttpsURLConnectionActivity.this, "请求成功", Toast.LENGTH_LONG).show();
186 | }
187 | });
188 | }
189 | connection.disconnect();
190 | } catch (Exception e) {
191 | e.printStackTrace();
192 | runOnUiThread(new Runnable() {
193 | @Override
194 | public void run() {
195 | Toast.makeText(HttpsURLConnectionActivity.this, "请求失败", Toast.LENGTH_LONG).show();
196 | }
197 | });
198 | }
199 | }
200 | }).start();
201 | }
202 |
203 | }
204 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/net/NetActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.net;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.util.Log;
7 | import android.view.View;
8 |
9 | import java.io.File;
10 | import java.io.FileOutputStream;
11 | import java.io.IOException;
12 | import java.util.zip.ZipEntry;
13 | import java.util.zip.ZipInputStream;
14 |
15 | import ddns.android.vuls.R;
16 | import okhttp3.Call;
17 | import okhttp3.Callback;
18 | import okhttp3.OkHttpClient;
19 | import okhttp3.Request;
20 | import okhttp3.Response;
21 |
22 | public class NetActivity extends AppCompatActivity implements View.OnClickListener {
23 |
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_net);
29 | findViewById(R.id.btn_HttpsURLConnection).setOnClickListener(this);
30 | findViewById(R.id.btn_SSLPinning).setOnClickListener(this);
31 | findViewById(R.id.btn_anti).setOnClickListener(this);
32 | findViewById(R.id.btn_proto).setOnClickListener(this);
33 | findViewById(R.id.btn_zipper).setOnClickListener(this);
34 | findViewById(R.id.btn_protostuff).setOnClickListener(this);
35 | findViewById(R.id.btn_noproxy).setOnClickListener(this);
36 |
37 | }
38 |
39 | @Override
40 | public void onClick(View v) {
41 | switch (v.getId()) {
42 | case R.id.btn_HttpsURLConnection:
43 | startActivity(new Intent(this, HttpsURLConnectionActivity.class));
44 | break;
45 | case R.id.btn_SSLPinning:
46 | startActivity(new Intent(this, SSLPinningActivity.class));
47 | break;
48 | case R.id.btn_anti:
49 | startActivity(new Intent(this, AntiActivity.class));
50 | break;
51 | case R.id.btn_proto:
52 | startActivity(new Intent(this, ProtoActivity.class));
53 | break;
54 | case R.id.btn_protostuff:
55 | startActivity(new Intent(this, ProtoStuffActivity.class));
56 | break;
57 | case R.id.btn_zipper:
58 | zipperDown();
59 | break;
60 | case R.id.btn_noproxy:
61 | startActivity(new Intent(this, NoProxyActivity.class));
62 | break;
63 | default:
64 | break;
65 |
66 | }
67 | }
68 |
69 | private void zipperDown(){
70 | String url = "http://www.example.com/test.zip";
71 | OkHttpClient okHttpClient = new OkHttpClient();
72 | final Request request = new Request.Builder().url(url).get().build();
73 | Call call = okHttpClient.newCall(request);
74 | call.enqueue(new Callback() {
75 | @Override
76 | public void onFailure(Call call, IOException e) {
77 | Log.e("zipperDown", "zipperDown fail");
78 | }
79 |
80 | @Override
81 | public void onResponse(Call call, Response response) throws IOException {
82 | // Log.e("zipperDown", response.body().bytes().length + "");
83 | String dstPath = getCacheDir().toString();
84 | ZipEntry zipEntry = null;
85 | ZipInputStream zipInputStream = new ZipInputStream(response.body().byteStream());
86 | while ((zipEntry = zipInputStream.getNextEntry()) != null){
87 | String entryName = zipEntry.getName();
88 | if (zipEntry.isDirectory()){
89 | entryName = entryName.substring(0, entryName.length() -1);
90 | File folder = new File(dstPath + File.separator + entryName);
91 | folder.mkdirs();
92 | }else {
93 | String fileName = dstPath + File.separator + entryName;
94 | Log.e("zipperDown", fileName);
95 | File file = new File(fileName);
96 | file.createNewFile();
97 | FileOutputStream fileOutputStream = new FileOutputStream(file);
98 | byte[] buffer = new byte[1024];
99 | int n = 0;
100 | while ((n = zipInputStream.read(buffer, 0 , 1024)) != -1){
101 | fileOutputStream.write(buffer, 0 , n);
102 | }
103 | fileOutputStream.flush();
104 | fileOutputStream.close();
105 | }
106 | }
107 | zipInputStream.close();
108 | }
109 | });
110 |
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/net/NoProxyActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.net;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.widget.Toast;
7 |
8 | import java.io.IOException;
9 | import java.net.HttpURLConnection;
10 | import java.net.InetSocketAddress;
11 | import java.net.Proxy;
12 | import java.net.SocketAddress;
13 | import java.net.URL;
14 |
15 | import ddns.android.vuls.R;
16 | import okhttp3.Call;
17 | import okhttp3.Callback;
18 | import okhttp3.CertificatePinner;
19 | import okhttp3.OkHttpClient;
20 | import okhttp3.Request;
21 | import okhttp3.Response;
22 |
23 | public class NoProxyActivity extends AppCompatActivity {
24 |
25 | String testurl = "http://tool.chinaz.com/";
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.activity_no_proxyf);
31 | }
32 |
33 | public void httpURLConnection_noproxy(View view) {
34 |
35 | new Proxy(Proxy.Type.HTTP, new InetSocketAddress("192.168.8.233",8080));
36 |
37 | new Thread(new Runnable() {
38 | @Override
39 | public void run() {
40 | try {
41 | URL url = new URL(testurl);
42 | HttpURLConnection connection = (HttpURLConnection) url.openConnection(Proxy.NO_PROXY);
43 | connection.setConnectTimeout(5000);
44 | connection.setReadTimeout(10000);
45 | connection.connect();
46 |
47 | int responseCode = connection.getResponseCode();
48 | if (200 == responseCode) {
49 | runOnUiThread(new Runnable() {
50 | @Override
51 | public void run() {
52 | Toast.makeText(NoProxyActivity.this, "请求成功", Toast.LENGTH_LONG).show();
53 | }
54 | });
55 | }
56 | connection.disconnect();
57 | } catch (Exception e) {
58 | e.printStackTrace();
59 | runOnUiThread(new Runnable() {
60 | @Override
61 | public void run() {
62 | Toast.makeText(NoProxyActivity.this, "请求失败", Toast.LENGTH_LONG).show();
63 | }
64 | });
65 | }
66 | }
67 | }).start();
68 | }
69 |
70 | public void okhttp3_noproxy(View view) {
71 |
72 | OkHttpClient okHttpClient = new OkHttpClient.Builder()
73 | .proxy(Proxy.NO_PROXY)
74 | .build();
75 |
76 | Request.Builder builder = new Request.Builder();
77 | Request request = builder.get().url(testurl).build();
78 |
79 | Call call = okHttpClient.newCall(request);
80 |
81 | call.enqueue(new Callback() {
82 | @Override
83 | public void onFailure(Call call, IOException e) {
84 | e.printStackTrace();
85 | runOnUiThread(new Runnable() {
86 | @Override
87 | public void run() {
88 | Toast.makeText(NoProxyActivity.this, "请求失败", Toast.LENGTH_LONG).show();
89 | }
90 | });
91 | }
92 |
93 | @Override
94 | public void onResponse(Call call, Response response) throws IOException {
95 | final int code = response.code();
96 | runOnUiThread(new Runnable() {
97 | @Override
98 | public void run() {
99 | Toast.makeText(NoProxyActivity.this, "请求成功" + code, Toast.LENGTH_LONG).show();
100 | }
101 | });
102 | }
103 | });
104 |
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/net/ProtoActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.net;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.widget.Button;
7 | import android.widget.EditText;
8 | import android.widget.Toast;
9 |
10 | import java.io.IOException;
11 |
12 | import ddns.android.vuls.Beans.LoginRequestOuterClass;
13 | import ddns.android.vuls.Beans.MessageOuterClass;
14 | import ddns.android.vuls.R;
15 | import okhttp3.Call;
16 | import okhttp3.Callback;
17 | import okhttp3.MediaType;
18 | import okhttp3.OkHttpClient;
19 | import okhttp3.Request;
20 | import okhttp3.RequestBody;
21 | import okhttp3.Response;
22 | import okhttp3.ResponseBody;
23 |
24 | public class ProtoActivity extends AppCompatActivity {
25 |
26 | private String username;
27 | private String password;
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_login);
33 | ((Button)findViewById(R.id.btn_ac_save)).setText("登录");
34 | }
35 |
36 | public void login(View view){
37 | username = ((EditText) findViewById(R.id.et_ac_username)).getText().toString();
38 | password = ((EditText) findViewById(R.id.et_ac_password)).getText().toString();
39 | String url = "http://192.168.8.233/pblogin";
40 |
41 | final LoginRequestOuterClass.LoginRequest
42 | loginRequest = LoginRequestOuterClass.LoginRequest
43 | .newBuilder()
44 | .setUsername(username)
45 | .setPassword(password)
46 | .build();
47 |
48 |
49 | OkHttpClient okHttpClient = new OkHttpClient.Builder().build();
50 | RequestBody requestBody = RequestBody.create(
51 | MediaType.parse("application/pb"),
52 | loginRequest.toByteArray());
53 |
54 | Request request = new Request.Builder().url(url).post(requestBody).build();
55 |
56 | Call call = okHttpClient.newCall(request);
57 | call.enqueue(new Callback() {
58 | @Override
59 | public void onFailure(Call call, IOException e) {
60 | e.printStackTrace();
61 | runOnUiThread(new Runnable() {
62 | @Override
63 | public void run() {
64 | Toast.makeText(ProtoActivity.this, "请求失败", Toast.LENGTH_LONG).show();
65 | }
66 | });
67 | }
68 |
69 | @Override
70 | public void onResponse(Call call, Response response) throws IOException {
71 | ResponseBody body = response.body();
72 | LoginRequestOuterClass.LoginResponse
73 | loginResponse = LoginRequestOuterClass.LoginResponse.parseFrom(body.bytes());
74 | final int code = loginResponse.getCode();
75 | MessageOuterClass.Message responseMsg = loginResponse.getMsg();
76 | final int id = responseMsg.getId();
77 | final String content = responseMsg.getContent();
78 | runOnUiThread(new Runnable() {
79 | @Override
80 | public void run() {
81 | if (id == 1){
82 | Toast.makeText(ProtoActivity.this, content, Toast.LENGTH_LONG).show();
83 | }else {
84 | Toast.makeText(ProtoActivity.this, content + code, Toast.LENGTH_LONG).show();
85 | }
86 | }
87 | });
88 | }
89 | });
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/net/ProtoStuffActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.net;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.util.Log;
6 | import android.view.View;
7 | import android.widget.EditText;
8 | import android.widget.Toast;
9 |
10 | import java.io.IOException;
11 |
12 | import ddns.android.vuls.Beans.LoginRequestOuterClass;
13 | import ddns.android.vuls.Beans.MessageOuterClass;
14 | import ddns.android.vuls.Beans.User;
15 | import ddns.android.vuls.R;
16 | import io.protostuff.LinkedBuffer;
17 | import io.protostuff.ProtostuffIOUtil;
18 | import io.protostuff.runtime.RuntimeSchema;
19 | import okhttp3.Call;
20 | import okhttp3.Callback;
21 | import okhttp3.MediaType;
22 | import okhttp3.OkHttpClient;
23 | import okhttp3.Request;
24 | import okhttp3.RequestBody;
25 | import okhttp3.Response;
26 | import okhttp3.ResponseBody;
27 |
28 | public class ProtoStuffActivity extends AppCompatActivity {
29 |
30 | private String username;
31 | private String password;
32 |
33 | @Override
34 | protected void onCreate(Bundle savedInstanceState) {
35 | super.onCreate(savedInstanceState);
36 | setContentView(R.layout.activity_proto_stuff);
37 | username = ((EditText)findViewById(R.id.et_ps_username)).getText().toString();
38 | password = ((EditText)findViewById(R.id.et_ps_password)).getText().toString();
39 | }
40 |
41 | public void login(View view){
42 | String url = "http://10.102.166.186/pslogin";
43 |
44 | RuntimeSchema schema = RuntimeSchema.createFrom(User.class);
45 | User user = new User();
46 | user.setId(3);
47 | user.setName("tom");
48 | user.setAge(8);
49 | user.setPassword("123");
50 |
51 | byte[] bytes = ProtostuffIOUtil.toByteArray(user, schema,
52 | LinkedBuffer.allocate(LinkedBuffer.DEFAULT_BUFFER_SIZE));
53 |
54 | Log.e("pb", bytesToHexString(bytes));
55 |
56 |
57 | OkHttpClient okHttpClient = new OkHttpClient.Builder().build();
58 | RequestBody requestBody = RequestBody.create(
59 | MediaType.parse("application/pb"),
60 | bytes);
61 |
62 | Request request = new Request.Builder().url(url).post(requestBody).build();
63 |
64 | Call call = okHttpClient.newCall(request);
65 | call.enqueue(new Callback() {
66 | @Override
67 | public void onFailure(Call call, IOException e) {
68 | e.printStackTrace();
69 | runOnUiThread(new Runnable() {
70 | @Override
71 | public void run() {
72 | Toast.makeText(ProtoStuffActivity.this, "请求失败", Toast.LENGTH_LONG).show();
73 | }
74 | });
75 | }
76 |
77 | @Override
78 | public void onResponse(Call call, Response response) throws IOException {
79 | ResponseBody body = response.body();
80 | final String string = body.string();
81 | runOnUiThread(new Runnable() {
82 | @Override
83 | public void run() {
84 | if (1 == 1){
85 | Toast.makeText(ProtoStuffActivity.this, string, Toast.LENGTH_LONG).show();
86 | }else {
87 | Toast.makeText(ProtoStuffActivity.this, string, Toast.LENGTH_LONG).show();
88 | }
89 | }
90 | });
91 | }
92 | });
93 | }
94 |
95 | public static String bytesToHexString(byte[] src){
96 | StringBuilder stringBuilder = new StringBuilder("");
97 | if (src == null || src.length <= 0) {
98 | return null;
99 | }
100 | for (int i = 0; i < src.length; i++) {
101 | int v = src[i] & 0xFF;
102 | String hv = Integer.toHexString(v);
103 | if (hv.length() < 2) {
104 | stringBuilder.append(0);
105 | }
106 | stringBuilder.append(hv);
107 | }
108 | return stringBuilder.toString();
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/net/SSLPinningActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.net;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.Toast;
8 |
9 | import java.io.IOException;
10 | import java.net.URL;
11 |
12 | import javax.net.ssl.HttpsURLConnection;
13 |
14 | import ddns.android.vuls.R;
15 | import okhttp3.Call;
16 | import okhttp3.Callback;
17 | import okhttp3.CertificatePinner;
18 | import okhttp3.OkHttpClient;
19 | import okhttp3.Request;
20 | import okhttp3.Response;
21 |
22 | public class SSLPinningActivity extends AppCompatActivity {
23 |
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_sslpinning);
29 | }
30 |
31 | public void okhttp3(View view) {
32 | CertificatePinner leafCertPinner = new CertificatePinner.Builder()
33 | .add("www.baidu.com", "sha256/M9Hz16jmJjXzPUkH8FUKG2GZLd/55sT6yCNiQgwfNtk=")
34 | .add("www.sohu.com", "sha256/MQ==")
35 | .build();
36 |
37 | CertificatePinner intermediateCertPinner = new CertificatePinner.Builder()
38 | .add("*.baidu.com", "sha256/IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4=")
39 | .build();
40 |
41 | OkHttpClient okHttpClient = new OkHttpClient.Builder()
42 | .certificatePinner(leafCertPinner)
43 | .certificatePinner(intermediateCertPinner)
44 | .build();
45 |
46 | Request.Builder builder = new Request.Builder();
47 | Request request = builder.get().url("https://www.baidu.com/").build();
48 |
49 | Call call = okHttpClient.newCall(request);
50 |
51 | call.enqueue(new Callback() {
52 | @Override
53 | public void onFailure(Call call, IOException e) {
54 | e.printStackTrace();
55 | runOnUiThread(new Runnable() {
56 | @Override
57 | public void run() {
58 | Toast.makeText(SSLPinningActivity.this, "请求失败", Toast.LENGTH_LONG).show();
59 | }
60 | });
61 | }
62 |
63 | @Override
64 | public void onResponse(Call call, Response response) throws IOException {
65 | final int code = response.code();
66 | runOnUiThread(new Runnable() {
67 | @Override
68 | public void run() {
69 | Toast.makeText(SSLPinningActivity.this, "请求成功" + code, Toast.LENGTH_LONG).show();
70 | }
71 | });
72 | }
73 | });
74 |
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/storage/ClipboardActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.storage;
2 |
3 | import android.content.ClipData;
4 | import android.content.ClipboardManager;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.view.ActionMode;
8 | import android.view.Menu;
9 | import android.view.MenuItem;
10 | import android.view.View;
11 | import android.widget.EditText;
12 | import android.widget.TextView;
13 | import android.widget.Toast;
14 |
15 | import ddns.android.vuls.R;
16 |
17 | public class ClipboardActivity extends AppCompatActivity {
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_clipboard);
23 | EditText editText = (EditText) findViewById(R.id.et_cb_password);
24 | editText.setCustomSelectionActionModeCallback(new ActionMode.Callback() {
25 | @Override
26 | public boolean onCreateActionMode(ActionMode mode, Menu menu) {
27 | return false;
28 | }
29 |
30 | @Override
31 | public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
32 | return false;
33 | }
34 |
35 | @Override
36 | public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
37 | return false;
38 | }
39 |
40 | @Override
41 | public void onDestroyActionMode(ActionMode mode) {
42 |
43 | }
44 | });
45 | }
46 |
47 | public void showClipboard(View view){
48 | ClipboardManager cm = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
49 | ClipData data = cm.getPrimaryClip();
50 | ClipData.Item item = data.getItemAt(0);
51 | String content = item.getText().toString();
52 | Toast.makeText(ClipboardActivity.this, content, Toast.LENGTH_LONG).show();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/storage/ExternalFileActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.storage;
2 |
3 | import android.os.Environment;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.EditText;
8 | import android.widget.Toast;
9 |
10 | import java.io.File;
11 | import java.io.FileOutputStream;
12 | import java.io.IOException;
13 |
14 | import ddns.android.vuls.R;
15 |
16 | public class ExternalFileActivity extends AppCompatActivity {
17 |
18 | private EditText et_ef_username;
19 | private EditText et_ef_password;
20 |
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_external_file);
26 | et_ef_username = findViewById(R.id.ef_username);
27 | et_ef_password = findViewById(R.id.ef_password);
28 |
29 | }
30 |
31 | public void save(View v) throws Exception {
32 |
33 | //1. 判断sd卡状态, 如果是挂载的状态才继续, 否则提示
34 | if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
35 | String userName = et_ef_username.getText().toString();
36 | String password = et_ef_password.getText().toString();
37 | String filesPath = getExternalFilesDir(null).getAbsolutePath();
38 | String filePath = filesPath + "/account.txt";
39 | FileOutputStream fos = new FileOutputStream(filePath);
40 | fos.write((userName + ":" + password + "\n").getBytes("utf-8"));
41 | fos.close();
42 | Toast.makeText(this, "保存完成", Toast.LENGTH_LONG).show();
43 | } else {
44 | Toast.makeText(this, "sd卡没有挂载", Toast.LENGTH_LONG).show();
45 | }
46 | }
47 |
48 | public void save2sdcard(View v) throws IOException {
49 | //1. 判断sd卡状态, 如果是挂载的状态才继续, 否则提示
50 | if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
51 | String userName = et_ef_username.getText().toString();
52 | String password = et_ef_password.getText().toString();
53 | String sdPath = Environment.getExternalStorageDirectory().getAbsolutePath();
54 | File file = new File(sdPath+"/ddns");
55 | if(!file.exists()) {
56 | file.mkdirs();
57 | }
58 | String filePath = sdPath+"/ddns/account.txt";
59 | FileOutputStream fos = new FileOutputStream(filePath);
60 | fos.write((userName + ":" + password + "\n").getBytes("utf-8"));
61 | fos.close();
62 | Toast.makeText(this, "保存完成", Toast.LENGTH_LONG).show();
63 | } else {
64 | Toast.makeText(this, "sd卡没有挂载", Toast.LENGTH_LONG).show();
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/storage/InternalFileActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.storage;
2 |
3 | import android.content.Context;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.EditText;
8 | import android.widget.Toast;
9 |
10 | import java.io.FileOutputStream;
11 | import java.io.IOException;
12 |
13 | import ddns.android.vuls.R;
14 |
15 | public class InternalFileActivity extends AppCompatActivity {
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_internal_file);
21 | }
22 |
23 | public void save(View v) throws IOException {
24 |
25 | String username = ((EditText)findViewById(R.id.if_username)).getText().toString();
26 | String password = ((EditText)findViewById(R.id.if_password)).getText().toString();
27 |
28 | FileOutputStream fosDangerous = openFileOutput("account_dangerous.txt",
29 | Context.MODE_WORLD_WRITEABLE | Context.MODE_WORLD_READABLE);
30 | fosDangerous.write((username + " : " + password + "\n").getBytes("utf-8"));
31 | fosDangerous.close();
32 |
33 | FileOutputStream fosSafe = openFileOutput("account_safe.txt", Context.MODE_PRIVATE);
34 | fosSafe.write((username + " : " + password + "\n").getBytes("utf-8"));
35 | fosSafe.close();
36 |
37 | Toast.makeText(this, "保存完成", Toast.LENGTH_LONG).show();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/storage/KeyboardCacheActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.storage;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import ddns.android.vuls.R;
7 |
8 | public class KeyboardCacheActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_keyboard_cache);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/storage/LogcatActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.storage;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.util.Log;
6 | import android.view.View;
7 | import android.widget.EditText;
8 | import android.widget.Toast;
9 |
10 | import ddns.android.vuls.R;
11 |
12 | public class LogcatActivity extends AppCompatActivity {
13 |
14 | private EditText etUsername;
15 | private EditText etPassword;
16 |
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_logcat);
22 |
23 | etUsername = findViewById(R.id.et_log_username);
24 | etPassword = findViewById(R.id.et_log_password);
25 |
26 | }
27 |
28 | public void log(View v) {
29 |
30 | // 去除log https://blog.csdn.net/a2241076850/article/details/78391536
31 | String username = etUsername.getText().toString();
32 | String password = etPassword.getText().toString();
33 |
34 | String message = "username: " + username + " password: " + password;
35 |
36 | Log.v("DDNS", message);
37 | Log.d("DDNS", message);
38 | Log.i("DDNS", message);
39 | Log.w("DDNS", message);
40 | Log.e("DDNS", message);
41 | Log.println(Log.ASSERT, "DDNS", message);
42 |
43 | System.out.println("DDNS " + message);
44 | System.err.println("DDNS " + message);
45 |
46 |
47 | Toast.makeText(this, "保存完成!", Toast.LENGTH_LONG).show();
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/storage/SQLiteActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.storage;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import android.widget.EditText;
9 | import android.widget.Toast;
10 |
11 | import ddns.android.vuls.R;
12 |
13 | public class SQLiteActivity extends AppCompatActivity {
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.activity_sqlite);
19 | }
20 |
21 | public void save2db(View v) {
22 | String username = ((EditText) findViewById(R.id.et_db_username)).getText().toString();
23 | String password = ((EditText) findViewById(R.id.et_db_password)).getText().toString();
24 |
25 | SQLiteDatabase sqLiteDatabase = openOrCreateDatabase("account.db",
26 | Context.MODE_WORLD_WRITEABLE | Context.MODE_WORLD_READABLE, null);
27 | String init = "create table if not exists accounts(" +
28 | "_id integer primary key autoincrement, " +
29 | "username varchar," +
30 | "password varchar)";
31 | sqLiteDatabase.execSQL(init);
32 | String insert = "INSERT INTO accounts(username, password)" +
33 | " VALUES('" +
34 | username + "','" +
35 | password + "'" +
36 | ");";
37 | sqLiteDatabase.execSQL(insert);
38 | sqLiteDatabase.close();
39 | Toast.makeText(this, "保存成功", Toast.LENGTH_LONG).show();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/storage/ScreenShotActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.storage;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 | import android.view.WindowManager;
7 | import android.widget.EditText;
8 | import android.widget.Toast;
9 |
10 | import ddns.android.vuls.R;
11 |
12 | public class ScreenShotActivity extends AppCompatActivity {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
18 | WindowManager.LayoutParams.FLAG_SECURE);
19 | setContentView(R.layout.activity_screen_shot);
20 | }
21 |
22 | public void save(View view){
23 | String username = ((EditText) findViewById(R.id.et_ss_username)).getText().toString();
24 | String password = ((EditText) findViewById(R.id.et_ss_password)).getText().toString();
25 | Toast.makeText(ScreenShotActivity.this, username + " : " + password, Toast.LENGTH_SHORT).show();
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/storage/SpActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.storage;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import android.view.WindowManager;
9 | import android.widget.EditText;
10 | import android.widget.Toast;
11 |
12 | import ddns.android.vuls.R;
13 |
14 | public class SpActivity extends AppCompatActivity {
15 |
16 | private EditText etUsername;
17 | private EditText etPassword;
18 |
19 | private SharedPreferences spDangerous;
20 | private SharedPreferences spSafe;
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
26 | WindowManager.LayoutParams.FLAG_SECURE);
27 | setContentView(R.layout.activity_sp);
28 |
29 | etUsername = findViewById(R.id.et_sp_username);
30 | etPassword = findViewById(R.id.et_sp_password);
31 |
32 | }
33 |
34 | public void save(View v) {
35 |
36 | spDangerous = getSharedPreferences("account_dangerous",
37 | Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE);
38 | spSafe = getSharedPreferences("account_safe", Context.MODE_PRIVATE);
39 |
40 | SharedPreferences.Editor editDangerous = spDangerous.edit();
41 | SharedPreferences.Editor editSafe = spSafe.edit();
42 |
43 | String username = etUsername.getText().toString();
44 | String password = etPassword.getText().toString();
45 |
46 | editDangerous.putString("username", username).commit();
47 | editDangerous.putString("password", password).commit();
48 | editSafe.putString("username", username).commit();
49 | editSafe.putString("password", password).commit();
50 |
51 | Toast.makeText(this, "保存完成!", Toast.LENGTH_LONG).show();
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/storage/StorageActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.storage;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.View;
7 |
8 | import ddns.android.vuls.R;
9 |
10 | public class StorageActivity extends AppCompatActivity implements View.OnClickListener {
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_storage);
16 | findViewById(R.id.btn_sp).setOnClickListener(this);
17 | findViewById(R.id.btn_internal_file).setOnClickListener(this);
18 | findViewById(R.id.btn_external_file).setOnClickListener(this);
19 | findViewById(R.id.btn_database).setOnClickListener(this);
20 | findViewById(R.id.btn_logcat).setOnClickListener(this);
21 | findViewById(R.id.btn_screen_shot).setOnClickListener(this);
22 | findViewById(R.id.btn_clipboard).setOnClickListener(this);
23 | findViewById(R.id.btn_keyboard_cache).setOnClickListener(this);
24 |
25 | }
26 |
27 |
28 | @Override
29 | public void onClick(View v) {
30 | switch (v.getId()) {
31 | case R.id.btn_sp:
32 | startActivity(new Intent(this, SpActivity.class));
33 | break;
34 | case R.id.btn_internal_file:
35 | startActivity(new Intent(this, InternalFileActivity.class));
36 | break;
37 | case R.id.btn_external_file:
38 | startActivity(new Intent(this, ExternalFileActivity.class));
39 | break;
40 | case R.id.btn_database:
41 | startActivity(new Intent(this, SQLiteActivity.class));
42 | break;
43 | case R.id.btn_logcat:
44 | startActivity(new Intent(this, LogcatActivity.class));
45 | break;
46 | case R.id.btn_screen_shot:
47 | startActivity(new Intent(this, ScreenShotActivity.class));
48 | break;
49 | case R.id.btn_clipboard:
50 | startActivity(new Intent(this, ClipboardActivity.class));
51 | break;
52 | case R.id.btn_keyboard_cache:
53 | startActivity(new Intent(this, KeyboardCacheActivity.class));
54 | break;
55 | default:
56 | break;
57 | }
58 | }
59 |
60 | public void onClickGetUID(View v){
61 | startActivity(new Intent(this, UidActivity.class));
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/activities/storage/UidActivity.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.activities.storage;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.widget.TextView;
6 |
7 | import java.io.BufferedReader;
8 | import java.io.IOException;
9 | import java.io.InputStream;
10 | import java.io.InputStreamReader;
11 |
12 | import ddns.android.vuls.R;
13 |
14 | public class UidActivity extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_uid);
20 |
21 | try {
22 | Process getUid = Runtime.getRuntime().exec("id");
23 | InputStream inputStream = getUid.getInputStream();
24 | InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
25 | BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
26 | String line = null;
27 | StringBuilder stringBuilder = new StringBuilder();
28 | while( (line = bufferedReader.readLine()) != null ){
29 | stringBuilder.append(line);
30 | }
31 |
32 | ((TextView)findViewById(R.id.tv_uid)).setText("uid:\n" + stringBuilder.toString());
33 | } catch (IOException e) {
34 | e.printStackTrace();
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/services/NetService.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.services;
2 |
3 | import android.app.Service;
4 | import android.content.Intent;
5 | import android.os.IBinder;
6 | import android.util.Log;
7 |
8 | import ddns.android.vuls.Common.Utils;
9 |
10 | public class NetService extends Service {
11 | public NetService() {
12 | }
13 |
14 |
15 | public IGetNetStatusInterface.Stub netStub = new IGetNetStatusInterface.Stub(){
16 | @Override
17 | public String getNetStatus(String host){
18 | String cmd = "ping -c 1 " + host;
19 | Log.e("NetService", cmd);
20 | String result = Utils.exec(cmd);
21 | Log.e("NetService result", result);
22 | if (result.contains("1 received")){
23 | Log.e("NetService", "net is avaliable");
24 | }else {
25 | Log.e("NetService", "net is unavaliable");
26 | }
27 | return result;
28 | }
29 | };
30 |
31 | @Override
32 | public IBinder onBind(Intent intent) {
33 | return netStub;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/ddns/android/vuls/services/SMSService.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls.services;
2 |
3 | import android.Manifest;
4 | import android.app.Service;
5 | import android.content.Intent;
6 | import android.os.IBinder;
7 | import android.support.v4.app.ActivityCompat;
8 | import android.telephony.SmsManager;
9 | import android.util.Log;
10 |
11 | import java.util.ArrayList;
12 |
13 | import ddns.android.vuls.MainActivity;
14 |
15 | public class SMSService extends Service {
16 | public SMSService() {
17 | }
18 |
19 | @Override
20 | public IBinder onBind(Intent intent) {
21 | // TODO: Return the communication channel to the service.
22 | throw new UnsupportedOperationException("Not yet implemented");
23 | }
24 |
25 | @Override
26 | public void onCreate() {
27 | super.onCreate();
28 | }
29 |
30 | @Override
31 | public int onStartCommand(Intent intent, int flags, int startId) {
32 |
33 | SmsManager smsManager = SmsManager.getDefault();
34 | String phoneNumber = intent.getStringExtra("phone");
35 | String message = intent.getStringExtra("content");
36 | ArrayList contents = smsManager.divideMessage(message);
37 | for (String content : contents){
38 | smsManager.sendTextMessage(phoneNumber, null, content, null, null);
39 | Log.e("SMSService", "send sms: " + content);
40 | }
41 |
42 | return super.onStartCommand(intent, flags, startId);
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/proto/LoginRequest.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | import public "Message.proto";
4 |
5 | //登录请求结构体
6 | message LoginRequest {
7 | string username = 1;
8 | string password = 2;
9 | }
10 | //登录响应结构体
11 | message LoginResponse {
12 | int32 code = 1;
13 | Message msg = 2;
14 | }
--------------------------------------------------------------------------------
/app/src/main/proto/Message.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | // 返回消息体
4 | message Message {
5 | int32 id = 2;
6 | string content = 1;
7 | }
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_account.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
14 |
19 |
20 |
25 |
26 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_anti.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
14 |
19 |
20 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_broadcast.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
12 |
13 |
18 |
19 |
24 |
25 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_clipboard.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
14 |
15 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_clone.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
14 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_dos.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_dos2.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_external_file.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
11 |
12 |
19 |
20 |
21 |
26 |
27 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_fragement.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_https_urlconnection.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
14 |
19 |
20 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_internal_file.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
11 |
12 |
19 |
20 |
21 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_keyboard_cache.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
12 |
13 |
20 |
21 |
22 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_logcat.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
12 |
13 |
21 |
22 |
23 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
20 |
21 |
22 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login_broadcast.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
20 |
21 |
22 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
14 |
19 |
20 |
25 |
26 |
31 |
32 |
37 |
38 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_net.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
14 |
19 |
20 |
25 |
26 |
31 |
32 |
37 |
38 |
43 |
44 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_no_proxyf.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
14 |
15 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_proto.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
20 |
21 |
22 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_proto_stuff.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
20 |
21 |
22 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_screen_shot.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
11 |
12 |
20 |
21 |
22 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_service.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
21 |
22 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_sp.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
11 |
12 |
19 |
20 |
21 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_sqlite.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
11 |
12 |
19 |
20 |
21 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_sslpinning.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_storage.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
18 |
19 |
24 |
25 |
30 |
31 |
36 |
37 |
42 |
43 |
48 |
49 |
54 |
55 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_uid.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
14 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_webview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_webview_sec.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_wv_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
19 |
20 |
21 |
22 |
27 |
28 |
34 |
35 |
40 |
41 |
47 |
48 |
53 |
54 |
61 |
62 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_wv_net.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_target.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidAppSec/vuls/8de4c638e7e9694daa8e18d6d2d53b25393b8e8e/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidAppSec/vuls/8de4c638e7e9694daa8e18d6d2d53b25393b8e8e/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidAppSec/vuls/8de4c638e7e9694daa8e18d6d2d53b25393b8e8e/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidAppSec/vuls/8de4c638e7e9694daa8e18d6d2d53b25393b8e8e/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidAppSec/vuls/8de4c638e7e9694daa8e18d6d2d53b25393b8e8e/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidAppSec/vuls/8de4c638e7e9694daa8e18d6d2d53b25393b8e8e/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidAppSec/vuls/8de4c638e7e9694daa8e18d6d2d53b25393b8e8e/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidAppSec/vuls/8de4c638e7e9694daa8e18d6d2d53b25393b8e8e/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidAppSec/vuls/8de4c638e7e9694daa8e18d6d2d53b25393b8e8e/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidAppSec/vuls/8de4c638e7e9694daa8e18d6d2d53b25393b8e8e/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | vuls
3 | 存储安全
4 | SharedPreferences安全
5 | 内部存储安全
6 | 外部存储安全
7 | 数据库存储安全
8 | 获取UID
9 | Logcat
10 | 截屏
11 | Keyboard Cache
12 | Clipboard
13 |
14 |
15 | Hello blank fragment
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/test/java/ddns/android/vuls/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package ddns.android.vuls;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.1.2'
11 | classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.6'
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | google()
18 | jcenter()
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
25 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | android.injected.testOnly=false
15 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidAppSec/vuls/8de4c638e7e9694daa8e18d6d2d53b25393b8e8e/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Nov 17 21:12:08 CST 2018
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-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
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 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/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 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
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 Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------