Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Commit

Permalink
Fix analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
tiann committed Nov 27, 2022
1 parent b810a2d commit 1df5852
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "me.weishu.dirtypipecheck"
minSdk 28
targetSdk 32
versionCode 2
versionName "1.1"
versionCode 103
versionName "1.3"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
Expand Down
33 changes: 23 additions & 10 deletions app/src/main/java/me/weishu/dirtypipecheck/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Activity;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
Expand Down Expand Up @@ -43,20 +44,32 @@ protected void onCreate(Bundle savedInstanceState) {

Check.check(tmpfile.getAbsolutePath());


String content = "";
try {
String content = new String(Files.readAllBytes(tmpfile.toPath()));
Log.w(TAG, "content: " + content);
boolean vunlerable = content.contains("test");
content = new String(Files.readAllBytes(tmpfile.toPath()));
} catch (IOException ignored) {
}

Analytics.trackEvent("vunlerable", new HashMap<String, String>() {{
put("vunlerable", String.valueOf(vunlerable));
}});
Log.w(TAG, "content: " + content);
boolean vulnerable = content.contains("test");

button.setBackgroundColor(vunlerable ? Color.GREEN : Color.RED);
} catch (IOException e) {
Log.e(TAG, "err", e);
if (vulnerable) {
Analytics.trackEvent("vulnerable", new HashMap<String, String>() {{
put("product", Build.PRODUCT);
put("model", Build.MODEL);
put("fingerprint", Build.FINGERPRINT);
put("os", System.getProperty("os.version"));
}});
} else {
Analytics.trackEvent("invulnerable", new HashMap<String, String>() {{
put("product", Build.PRODUCT);
put("model", Build.MODEL);
put("fingerprint", Build.FINGERPRINT);
put("os", System.getProperty("os.version"));
}});
}

button.setBackgroundColor(vulnerable ? Color.GREEN : Color.RED);
});
}
}
11 changes: 10 additions & 1 deletion app/src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,18 @@
android:layout_weight="1"
android:layout_height="0dp"/>

<TextView
android:text="@string/desc"
android:textSize="12sp"
android:autoLink="web"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

<TextView
android:text="@string/author"
android:textSize="24sp"
android:autoLink="web"
android:textColor="@android:color/black"
android:textSize="16sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">DirtyPipeCheck</string>
<string name="desc">说明:绿色代表设备可以用 DirtyPipe(https://github.com/polygraphene/DirtyPipe-Android) 获取临时 Root,红色则意味着不行。</string>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<string name="hello_first_fragment">Hello first fragment</string>
<string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
<string name="author">Author: weishu \n contact: https://github.com/tiann</string>
<string name="author">Author: weishu \nContact me: https://github.com/tiann/DirtyPipeCheck</string>
<string name="checkit">开始检测</string>
<string name="desc">Description: Green means this device is vulnerable using DirtyPipe(https://github.com/polygraphene/DirtyPipe-Android), red is invulnerable</string>
</resources>

0 comments on commit 1df5852

Please sign in to comment.