Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update project #1

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 0 additions & 59 deletions .circleci/config.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
root = true

[*]
insert_final_newline = true

[*.{kt,kts}]
max_line_length = 140
indent_size = 4
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
ktlint_code_style = intellij_idea
ktlint_standard_property-naming = disabled
ktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = 2
ktlint_function_naming_ignore_when_annotated_with = Composable
ktlint_compose_unstable-collections = disabled

[*.xml]
indent_size = 4
ij_xml_space_inside_empty_tag = true
80 changes: 80 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build project

on:
pull_request:
push:
branches:
- master
- main
- trunk
- develop
- maine
- mane
schedule:
- cron: '0 3 * * 1,4'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21

- uses: gradle/actions/setup-gradle@v3

- uses: gradle/wrapper-validation-action@v2

- run: ./gradlew projectCodestyle

- run: ./gradlew assembleRelease check --scan

- run: ./gradlew projectCoverage

- run: ./gradlew publishToMavenLocal

- run: git diff --exit-code

- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: lint-results
path: '${{ github.workspace }}/**/build/**/reports/lint-results-*.html'

- name: Unwrap GPG key
if: github.repository == 'usefulness/rootbeer' && github.event_name != 'pull_request'
env:
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
run: sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"

- name: Publish
if: github.repository == 'usefulness/rootbeer' && github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
run: ./gradlew publishReleasePublicationToGithubRepository | true

- uses: actions/cache@v4
if: github.event_name != 'pull_request'
name: Upload base (release)
with:
path: diffuse-source-file-release
key: diffuse-${{ github.sha }}-${{ hashFiles('**/aar/**.aar') }}

- run: cp rootbeerlib/build/outputs/aar/rootbeerlib-release.aar diffuse-source-file-release
if: github.event_name != 'pull_request'
shell: bash
64 changes: 64 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Generate dependency diff

on:
pull_request:
push:
branches:
- master
- main
- trunk
- develop
- maine
- mane

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
generate-diff:
env:
github_token: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21

- uses: gradle/actions/setup-gradle@v3

- run: ./gradlew assembleRelease -m

- id: dependency-diff
name: Generate dependency diff
if: github.event_name == 'pull_request'
uses: usefulness/dependency-tree-diff-action@v2
with:
project: 'rootbeerlib'
configuration: releaseRuntimeClasspath

- uses: peter-evans/find-comment@v3
if: github.event_name == 'pull_request'
id: find_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Dependency diff

- uses: peter-evans/create-or-update-comment@v4
if: ${{ steps.dependency-diff.outputs.text-diff != null || steps.find_comment.outputs.comment-id != null }}
with:
body: |
Dependency diff:
```diff
${{ steps.dependency-diff.outputs.text-diff }}
```
edit-mode: replace
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}
45 changes: 45 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish Release

on:
push:
tags:
- 'v*'

jobs:
build:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21

- uses: gradle/actions/setup-gradle@v3

- run: ./gradlew assemble

- name: Unwrap GPG key
env:
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
run: sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"

- run: ./gradlew currentVersion

- name: Publish to Maven Central
run: ./gradlew publishReleasePublicationToMavenCentralRepository

- name: Publish to Github Package Registry
run: ./gradlew publishReleasePublicationToGithubRepository
75 changes: 75 additions & 0 deletions .github/workflows/run_diffuse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Diffuse

on:
pull_request:
branches:
- master
- main
- trunk
- develop
- maine
- mane

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
run-diffuse:
env:
github_token: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21

- uses: gradle/actions/setup-gradle@v3

- run: ./gradlew assembleRelease

- uses: actions/cache@v4
name: Download base
with:
path: |
diffuse-source-file-release
key: diffuse-${{ github.event.pull_request.base.sha }}
restore-keys: diffuse-${{ github.event.pull_request.base.sha }}

- id: diffuse
uses: usefulness/diffuse-action@v1
with:
old-file-path: diffuse-source-file-release
new-file-path: rootbeerlib/build/outputs/aar/rootbeerlib-release.aar

- uses: peter-evans/find-comment@v3
id: find_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Diffuse output

- uses: peter-evans/create-or-update-comment@v4
if: ${{ steps.diffuse.outputs.diff-gh-comment != null || steps.find_comment.outputs.comment-id != null }}
with:
body: |
### Aar size:
Aar size change: ${{ steps.diffuse.outputs.size-diff-comment_style_1 }}

### Diffuse output:

${{ steps.diffuse.outputs.diff-gh-comment }}
edit-mode: replace
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/upload-artifact@v4
with:
name: diffuse-output
path: ${{ steps.diffuse.outputs.diff-file }}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright {yyyy} {name of copyright owner}
Copyright (C) 2015, Scott Alexander-Bown, Mat Rollings

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
25 changes: 4 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A tasty root checker library and sample app. We've scoured the internets for dif
# Root checks
These are the current checks/tricks we are using to give an indication of root.

**Java checks**
**JVM checks**

* checkRootManagementApps
* checkPotentiallyDangerousApps
Expand All @@ -26,29 +26,12 @@ We call through to our native root checker to run some of its own checks. Native
* checkForSuBinary


## Disclaimer and limitations!

We love root! both [Scott](https://github.com/scottyab) and [Mat](https://github.com/stealthcopter) (the creators) own and use rooted devices (albeit not as daily driver). However we appreciate it can be useful to have an indication your app is running on a rooted device. Plus as hackday style project we wanted to see if we could beat the root cloakers at the time in 2015.

Remember **root==god**, so there's no 100% guaranteed way to check for root! treat this as an *indication* of root.

<img src="./art/rootbeerjesus.png" width=200 />


### Root cloakers

In **2015** we successfully tested Rootbeer and it flagged an indication of root when testing with the following root cloak apps. However Rootbeer was defeated when using a combination of the root cloakers activated at the same time.

Tested cloakers:

* [RootCloak Plus (Cydia)](https://play.google.com/store/apps/details?id=com.devadvance.rootcloakplus&hl=en_GB) requires [Cydia Substrate](http://play.google.com/store/apps/details?id=com.saurik.substrate)
* [RootCloak](http://repo.xposed.info/module/com.devadvance.rootcloak) - requires [Xposed Framework](http://repo.xposed.info/module/de.robv.android.xposed.installer)

## Usage

```java
RootBeer rootBeer = new RootBeer(context);
if (rootBeer.isRooted()) {
```kotlin
val rootBeer = RootBeer(context);
if (rootBeer.isRooted) {
//we found indication of root
} else {
//we didn't find indication of root
Expand Down
Loading
Loading