diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..62e7e1d --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,4 @@ +# These are supported funding model platforms + +custom: ["https://github.com/sponsors/Furtif", "https://www.paypal.com/donate/?hosted_button_id=WXA874KBC7RNN"] +github: [Furtif] diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..e519f16 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,26 @@ +name: Android CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build diff --git a/.gitignore b/.gitignore index da384a1..0277f91 100644 --- a/.gitignore +++ b/.gitignore @@ -1,210 +1,6 @@ -# Built application files -*.apk -*.ap_ -*.aab - -# Files for the ART/Dalvik VM -*.dex - -# Java class files -*.class - -# Generated files -bin/ -gen/ -out/ -release/ - -# Gradle files -.gradle/ -build/ - -# Local configuration file (sdk path, etc) -local.properties - -# Proguard folder generated by Eclipse -proguard/ - -# Log Files -*.log - -# Android Studio Navigation editor temp files -.navigation/ - -# Android Studio captures folder -captures/ - -# IntelliJ -*.iml -.idea/workspace.xml -.idea/tasks.xml -.idea/gradle.xml -.idea/assetWizardSettings.xml -.idea/dictionaries -.idea/libraries -# Android Studio 3 in .gitignore file. -.idea/caches -.idea/modules.xml -# Comment next line if keeping position of elements in Navigation Editor is relevant for you -.idea/navEditor.xml - -# Keystore files -# Uncomment the following lines if you do not want to check your keystore files in. -#*.jks -#*.keystore - -# External native build folder generated in Android Studio 2.2 and later -.externalNativeBuild - -# Google Services (e.g. APIs or Firebase) -# google-services.json - -# Freeline -freeline.py -freeline/ -freeline_project_description.json - -# fastlane -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots -fastlane/test_output -fastlane/readme.md - -# Version control -vcs.xml - -# lint -lint/intermediates/ -lint/generated/ -lint/outputs/ -lint/tmp/ -# lint/reports/ - - -#old -# DS_Store and Thumbsdb crap stay away -.DS_Store -Thumbs.db - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover -.hypothesis/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# IPython Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# dotenv -.env - -# virtualenv -venv/ -ENV/ - -# Spyder project settings -.spyderproject - - -# Files for the ART/Dalvik VM -*.dex - -# Java class files -*.class - -# Generated files -bin/ -gen/ -out/ - -# Gradle files -.gradle/ -build/ - -# Local configuration file (sdk path, etc) -local.properties - -# Proguard folder generated by Eclipse -proguard/ - -# Log Files -*.log - -# Android Studio Navigation editor temp files -.navigation/ - -# Android Studio captures folder -captures/ - -# Intellij -*.iml -.idea/workspace.xml +/.idea/ +/.gradle/ +/FridaLoader/build/ +/FridaLoader/debug/ +/FridaLoader/release/ +/local.properties diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index ae78c11..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - -
- - - - xmlns:android - - ^$ - - - -
-
- - - - xmlns:.* - - ^$ - - - BY_NAME - -
-
- - - - .*:id - - http://schemas.android.com/apk/res/android - - - -
-
- - - - .*:name - - http://schemas.android.com/apk/res/android - - - -
-
- - - - name - - ^$ - - - -
-
- - - - style - - ^$ - - - -
-
- - - - .* - - ^$ - - - BY_NAME - -
-
- - - - .* - - http://schemas.android.com/apk/res/android - - - ANDROID_ATTRIBUTE_ORDER - -
-
- - - - .* - - .* - - - BY_NAME - -
-
-
-
-
-
\ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index d6401c5..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - Android API 24 Platform - - - - - - - - \ No newline at end of file diff --git a/FridaLoader/.gitignore b/FridaLoader/.gitignore deleted file mode 100644 index 2b75303..0000000 --- a/FridaLoader/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/caches -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml -.DS_Store -/build -/captures -.externalNativeBuild diff --git a/FridaLoader/.idea/codeStyles/Project.xml b/FridaLoader/.idea/codeStyles/Project.xml deleted file mode 100644 index ae78c11..0000000 --- a/FridaLoader/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - -
- - - - xmlns:android - - ^$ - - - -
-
- - - - xmlns:.* - - ^$ - - - BY_NAME - -
-
- - - - .*:id - - http://schemas.android.com/apk/res/android - - - -
-
- - - - .*:name - - http://schemas.android.com/apk/res/android - - - -
-
- - - - name - - ^$ - - - -
-
- - - - style - - ^$ - - - -
-
- - - - .* - - ^$ - - - BY_NAME - -
-
- - - - .* - - http://schemas.android.com/apk/res/android - - - ANDROID_ATTRIBUTE_ORDER - -
-
- - - - .* - - .* - - - BY_NAME - -
-
-
-
-
-
\ No newline at end of file diff --git a/FridaLoader/.idea/gradle.xml b/FridaLoader/.idea/gradle.xml deleted file mode 100644 index 5cd135a..0000000 --- a/FridaLoader/.idea/gradle.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/FridaLoader/.idea/misc.xml b/FridaLoader/.idea/misc.xml deleted file mode 100644 index 7bfef59..0000000 --- a/FridaLoader/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/FridaLoader/.idea/runConfigurations.xml b/FridaLoader/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/FridaLoader/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/FridaLoader/app/.gitignore b/FridaLoader/app/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/FridaLoader/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/FridaLoader/app/build.gradle b/FridaLoader/app/build.gradle deleted file mode 100644 index a6f431c..0000000 --- a/FridaLoader/app/build.gradle +++ /dev/null @@ -1,48 +0,0 @@ -apply plugin: 'com.android.application' - -android { - compileSdkVersion 29 - defaultConfig { - applicationId "com.dns.fridaloader" - minSdkVersion 16 - targetSdkVersion 29 - versionCode 1 - versionName "1.0" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility = '1.8' - targetCompatibility = '1.8' - } -} -repositories { - maven { url 'https://jitpack.io' } -} - -dependencies { - implementation 'com.github.sabujak-sabujak:RoundedButton:v0.1.1' -} -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.mindorks.android:prdownloader:+' - implementation 'com.muddzdev:styleabletoast:+' - - - - - implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0' - - implementation group: 'org.tukaani', name: 'xz', version: '1.8' - // implementation 'com.android.support:appcompat-v7:+' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - testImplementation 'junit:junit:4.12' - // androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4' -} - diff --git a/FridaLoader/app/debug/output.json b/FridaLoader/app/debug/output.json deleted file mode 100644 index dc2b161..0000000 --- a/FridaLoader/app/debug/output.json +++ /dev/null @@ -1 +0,0 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-debug.apk","fullName":"debug","baseName":"debug","dirName":""},"path":"app-debug.apk","properties":{}}] \ No newline at end of file diff --git a/FridaLoader/app/src/main/java/com/dns/fridaloader/MainActivity.java b/FridaLoader/app/src/main/java/com/dns/fridaloader/MainActivity.java deleted file mode 100644 index 88fdd7c..0000000 --- a/FridaLoader/app/src/main/java/com/dns/fridaloader/MainActivity.java +++ /dev/null @@ -1,404 +0,0 @@ -package com.dns.fridaloader; - -import android.graphics.Color; -import android.os.SystemClock; -import androidx.appcompat.app.AppCompatActivity; -import life.sabujak.roundedbutton.RoundedButton; - -import android.os.Bundle; -import android.util.Log; -import android.view.View; -import android.widget.Button; -import android.widget.ProgressBar; -import android.widget.TextView; -import android.widget.Toast; - -import com.crowdfire.cfalertdialog.CFAlertDialog; -import com.downloader.Error; -import com.downloader.OnCancelListener; -import com.downloader.OnDownloadListener; -import com.downloader.OnPauseListener; -import com.downloader.OnProgressListener; -import com.downloader.OnStartOrResumeListener; -import com.downloader.PRDownloader; -import com.downloader.Progress; -import com.downloader.Status; -import com.muddzdev.styleabletoast.StyleableToast; - -import org.tukaani.xz.XZInputStream; - -import java.io.BufferedInputStream; -import java.io.BufferedReader; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; - -public class MainActivity extends AppCompatActivity { - String receivedData = ""; - int downloadIdOne; - private static String dirPath; - String request_endpoint = "https://api.github.com/repos/frida/frida/releases/latest"; - String URL1 =""; - // String URL1 = "https://github.com/frida/frida/releases/download/12.6.6/frida-server-12.6.6-android-x86.xz"; - String frida_url_prefix = "https://github.com/frida/frida/releases/download/"; - - Button performDownloadCancel, performDownload ; - RoundedButton reCheckStatusButton; - ProgressBar downloadProgressBar; - TextView textViewActionProgress, fridaStatusTextView; - - String command_ls, command_cp, command_chmod, command_launch_frida, - command_ps1, command_ps2, command_kill_frida, command_frida_search; - - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - // executeCommand("su -c /system/bin/cp /data/local/tmp/blah.txt /data/local/tmp/blah2.txt", true); - // executeCommand("su 0 /system/bin/cp /data/local/tmp/blah.txt /data/local/tmp/blah2.txt", false); - // executeCommand("su 0 /system/bin/cp /data/local/tmp/blah.txt /data/local/tmp/blah2.txt", false); - - if(rootedUsingMagisk()) - { - command_ls = "su -c /system/bin/ls"; - command_cp = "su -c /system/bin/cp /storage/emulated/0/Android/data/com.dns.fridaloader/files/frida-server-latest-decompressed /data/local/tmp/frida-server-latest"; - command_chmod = "su -c /system/bin/chmod +x /data/local/tmp/frida-server-latest"; - command_launch_frida = "su -c /data/local/tmp/frida-server-latest &"; - command_ps1 = "su -c /system/bin/ps -A"; - command_ps2 = "su -c /system/bin/ps"; - command_kill_frida = "su -c /system/bin/killall frida-server-latest"; - command_frida_search = "su -c /system/bin/ls /data/local/tmp/frida-server-latest"; - } else{ - command_ls = "su 0 /system/bin/ls"; - command_cp = "su 0 /system/bin/cp /storage/emulated/0/Android/data/com.dns.fridaloader/files/frida-server-latest-decompressed /data/local/tmp/frida-server-latest"; - command_chmod = "su 0 /system/bin/chmod +x /data/local/tmp/frida-server-latest"; - command_launch_frida = "su 0 /data/local/tmp/frida-server-latest &"; - command_ps1 = "su 0 /system/bin/ps -A"; - command_ps2 = "su 0 /system/bin/ps"; - command_kill_frida = "su 0 /system/bin/killall frida-server-latest"; - command_frida_search = "su 0 /system/bin/ls /data/local/tmp/frida-server-latest"; - } - //handle super user permissions - //executeCommand("su -c /system/bin/ls", true); - executeCommand(command_ls, true); - dirPath = Util.getRootDirPath(getApplicationContext()); - performDownloadCancel = (Button) findViewById(R.id.button_cancel_frida); - downloadProgressBar = (ProgressBar) findViewById(R.id.progressBarOne); - textViewActionProgress = (TextView)findViewById(R.id.textViewActionProgress); - fridaStatusTextView = (TextView)findViewById(R.id.fridaStatusTextView); - performDownload = (Button) findViewById(R.id.button_download_frida); - - reCheckStatusButton = (RoundedButton) findViewById(R.id.reCheckFridaStatus); - performDownload.setOnClickListener( new View.OnClickListener() { - - @Override - public void onClick(View v) { - performDownloadAndStartFrida(); - } - }); - - reCheckStatusButton.setOnClickListener( new View.OnClickListener() { - - @Override - public void onClick(View v) { - doFridaStuff(); - } - }); - - SystemClock.sleep(2000); - doFridaStuff(); - - } - - private void doFridaStuff() { - - // setupFridaURL(); - - Boolean fridaStatus = checkFridaStatusCode(); - if(fridaStatus){ - //frida already running - fridaAlreadyRunning(); - }else{ - //frida not currently running - freshFridaLaunchOptions(); - } - } - - - public void setupFridaURL() { - HttpURLConnectionGetRequest requestTypeOne = new HttpURLConnectionGetRequest(); - try { - String archType = execSomeCommandAndGetResponse("getprop ro.product.cpu.abi"); - receivedData = requestTypeOne.execute(request_endpoint, archType).get().toString(); - System.out.println("receivedData = "+receivedData); - if(!receivedData.contains("ERROR")){ - System.out.println("Frida URL found = "+frida_url_prefix.concat(receivedData)); - URL1 = frida_url_prefix.concat(receivedData); - }else{ - System.out.println("Something Went Wrong while finding latest branch so fallback to older version"); - URL1 = "https://github.com/frida/frida/releases/download/12.6.6/frida-server-12.6.6-android-x86.xz"; - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - - private void performDownloadAndStartFrida() { - - setupFridaURL(); - - if (Status.RUNNING == PRDownloader.getStatus(downloadIdOne)) { - PRDownloader.pause(downloadIdOne); - return; - } - - performDownload.setEnabled(false); - downloadProgressBar.setIndeterminate(true); - downloadProgressBar.getIndeterminateDrawable().setColorFilter( - Color.BLUE, android.graphics.PorterDuff.Mode.SRC_IN); - - if (Status.PAUSED == PRDownloader.getStatus(downloadIdOne)) { - PRDownloader.resume(downloadIdOne); - return; - } - - downloadIdOne = PRDownloader.download(URL1, dirPath, "frida-server-latest-xz.xz") - .build() - .setOnStartOrResumeListener(new OnStartOrResumeListener() { - @Override - public void onStartOrResume() { - reCheckStatusButton.setEnabled(false); - downloadProgressBar.setIndeterminate(false); - performDownload.setEnabled(true); - performDownload.setText("PAUSE PROCESS"); - performDownloadCancel.setEnabled(true); - } - }) - .setOnPauseListener(new OnPauseListener() { - @Override - public void onPause() { - performDownload.setText("RESUME PROCESS"); - } - }) - .setOnCancelListener(new OnCancelListener() { - @Override - public void onCancel() { - reCheckStatusButton.setEnabled(true); - performDownload.setText("START PROCESS"); - performDownloadCancel.setEnabled(false); - downloadProgressBar.setProgress(0); - textViewActionProgress.setText(""); - downloadIdOne = 0; - downloadProgressBar.setIndeterminate(false); - } - }) - .setOnProgressListener(new OnProgressListener() { - @Override - public void onProgress(Progress progress) { - long progressPercent = progress.currentBytes * 100 / progress.totalBytes; - downloadProgressBar.setProgress((int) progressPercent); - textViewActionProgress.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes)); - downloadProgressBar.setIndeterminate(false); - } - }) - .start(new OnDownloadListener() { - @Override - public void onDownloadComplete() { - performDownloadCancel.setEnabled(false); - performDownload.setText("DOWNLOAD & RUN AGAIN"); - System.out.println("Now uncompressing"); - try { - FileInputStream fin = new FileInputStream("/storage/emulated/0/Android/data/com.dns.fridaloader/files/" + "frida-server-latest-xz.xz"); - BufferedInputStream in = new BufferedInputStream(fin); - FileOutputStream out = new FileOutputStream("/storage/emulated/0/Android/data/com.dns.fridaloader/files/" + "frida-server-latest-decompressed"); - XZInputStream xzIn = new XZInputStream(in); - final byte[] buffer = new byte[8192]; - int n = 0; - while (-1 != (n = xzIn.read(buffer))) { - out.write(buffer, 0, n); - } - xzIn.close(); - fin.close(); - out.close(); - } - catch(Exception e) { - Log.e("Decompress", "unzip", e); - } - //executeCommand("su -c /system/bin/cp\\ /storage/emulated/0/Android/data/com.dns.fridaloader/files/frida-server-latest-decompressed\\ /data/local/tmp/frida-server-latest", false); - executeCommand(command_cp, false); - SystemClock.sleep(2000); - //executeCommand("su -c /system/bin/chmod\\ \\+x\\ /data/local/tmp/frida-server-latest", true); - executeCommand(command_chmod, true); - SystemClock.sleep(2000); - //executeCommand("su -c /data/local/tmp/frida-server-latest &", true); - executeCommand(command_launch_frida, true); - SystemClock.sleep(2000); - fridaStatusTextView.setText("Running"); - fridaStatusTextView.setTextColor(Color.parseColor("#ACF7C1")); - doFridaStuff(); - reCheckStatusButton.setEnabled(true); - } - - @Override - public void onError(Error error) { - performDownload.setText("Start"); - StyleableToast.makeText(MainActivity.this, "Something Went Wrong" + " " + "1", Toast.LENGTH_LONG, R.style.red).show(); - textViewActionProgress.setText(""); - downloadProgressBar.setProgress(0); - downloadIdOne = 0; - performDownloadCancel.setEnabled(false); - downloadProgressBar.setIndeterminate(false); - performDownload.setEnabled(true); - reCheckStatusButton.setEnabled(true); - } - }); - - } - - private boolean checkFridaStatusCode() { - //String status = executeCommand("su -c /system/bin/ps\\ -A", false); - String status = executeCommand(command_ps1, false); - if (status.contains("frida-server-latest")) { - return true; - }else{ - //status = executeCommand("su -c /system/bin/ps", false); - status = executeCommand(command_ps2, false); - if (status.contains("frida-server-latest")) { - return true; - }else{ - return false; - } - } - } - - private String execSomeCommandAndGetResponse(String command) { - //example command = "su -c /system/bin/ps -A" - String response = executeCommand(command, false); - return response; - } - private boolean rootedUsingMagisk() { - //example command = "su -c /system/bin/ps -A" - String response = executeCommand("/system/bin/which magisk", false); - if (response.contains("magisk")) { - return true; - }else{ - return false; - } - - } - - private void fridaAlreadyRunning() { - System.out.println("FRIDA IS RUNNING"); - fridaStatusTextView.setText("Running"); - fridaStatusTextView.setTextColor(Color.parseColor("#ACF7C1")); - - CFAlertDialog.Builder builder = new CFAlertDialog.Builder(this) - .setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) - .setTitle("Frida Status") - .setMessage("Frida Server (frida-server-latest) is already running. How do you want to proceed?") - .addButton("Download & Run Latest Frida Server", -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { - // Toast.makeText(MainActivity.this, "Upgrade tapped", Toast.LENGTH_SHORT).show(); - if(checkFridaStatusCode()) { - // sometimes we have to run kill twice for it to work - //executeCommand("su -c /system/bin/killall\\ frida-server-latest", false); - executeCommand(command_kill_frida, false); - } - // executeCommand("su -c /system/bin/killall\\ frida-server-latest", false); - if(checkFridaStatusCode()) { - // sometimes we have to run kill twice for it to work - //executeCommand("su -c /system/bin/killall\\ frida-server-latest", false); - executeCommand(command_kill_frida, false); - } - dialog.dismiss(); - fridaStatusTextView.setText("Terminated"); - performDownloadAndStartFrida(); - SystemClock.sleep(2000); - doFridaStuff(); - }) - .addButton("KILL Frida Server", -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { - if(checkFridaStatusCode()) { - // sometimes we have to run kill twice for it to work - //executeCommand("su -c /system/bin/killall\\ frida-server-latest", false); - executeCommand(command_kill_frida, false); - } - dialog.dismiss(); - fridaStatusTextView.setText("Terminated"); - SystemClock.sleep(2000); - - doFridaStuff(); - }).addButton("Continue", -1, -1, CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { - dialog.dismiss(); - }); - builder.show(); - } - - private void freshFridaLaunchOptions() { - fridaStatusTextView.setText("Not Running"); - fridaStatusTextView.setTextColor(Color.parseColor("#A50104")); - - CFAlertDialog.Builder builder = new CFAlertDialog.Builder(this) - .setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) - .setTitle("Frida Status") - .setMessage("Frida Server (frida-server-latest) is current not running. How do you want to proceed?") - .addButton("Install & Run Latest Frida Server", -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { - performDownloadAndStartFrida(); - dialog.dismiss(); - }) - .addButton("Force Start Existing Frida Server", -1, -1, CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { - - //String status = executeCommand("su -c /system/bin/ls\\ /data/local/tmp/frida-server-latest", false); - String status = executeCommand(command_frida_search, false); - if (!status.contains("frida-server-latest")) { - System.out.println("No such file or directory"); - dialog.dismiss(); - fridaStatusTextView.setText("Server Not Found"); - fridaStatusTextView.setTextColor(Color.parseColor("#A50104")); - - StyleableToast.makeText(MainActivity.this, "Server Not Found", Toast.LENGTH_LONG, R.style.red).show(); - }else{ - StyleableToast.makeText(MainActivity.this, "Server Found. Starting it now.", Toast.LENGTH_LONG, R.style.green).show(); - // executeCommand("su -c /data/local/tmp/frida-server-latest &", true); - executeCommand(command_launch_frida, true); - dialog.dismiss(); - SystemClock.sleep(2000); - fridaStatusTextView.setText("Running"); - fridaStatusTextView.setTextColor(Color.parseColor("#ACF7C1")); - doFridaStuff(); - } - }) - .addButton("Continue", -1, -1, CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { - dialog.dismiss(); - }); - builder.show(); - } - - private String executeCommand(String command, boolean standardOutExclude) { - int readData; - char[] buffer; - buffer = new char[4096]; - StringBuilder outputData; - BufferedReader reader; - try { - Process process = Runtime.getRuntime().exec(command); - if (standardOutExclude) { - // process.waitFor(); - return ""; - } - reader = new BufferedReader(new InputStreamReader(process.getInputStream())); - outputData = new StringBuilder(); - while ((readData = reader.read(buffer)) > 0) - { - outputData.append(buffer, 0, readData); - } - reader.close(); - process.waitFor(); - return outputData.toString(); - } catch (Exception e) - { - throw new RuntimeException(e); - } - } -} diff --git a/FridaLoader/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/FridaLoader/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index eca70cf..0000000 --- a/FridaLoader/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/FridaLoader/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/FridaLoader/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index eca70cf..0000000 --- a/FridaLoader/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/FridaLoader/app/src/main/res/mipmap-hdpi/ic_launcher.png b/FridaLoader/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index 898f3ed..0000000 Binary files a/FridaLoader/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/FridaLoader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/FridaLoader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index dffca36..0000000 Binary files a/FridaLoader/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/FridaLoader/app/src/main/res/mipmap-mdpi/ic_launcher.png b/FridaLoader/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 64ba76f..0000000 Binary files a/FridaLoader/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/FridaLoader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/FridaLoader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index dae5e08..0000000 Binary files a/FridaLoader/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/FridaLoader/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/FridaLoader/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index e5ed465..0000000 Binary files a/FridaLoader/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/FridaLoader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/FridaLoader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 14ed0af..0000000 Binary files a/FridaLoader/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/FridaLoader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/FridaLoader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index b0907ca..0000000 Binary files a/FridaLoader/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/FridaLoader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/FridaLoader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index d8ae031..0000000 Binary files a/FridaLoader/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/FridaLoader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/FridaLoader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 2c18de9..0000000 Binary files a/FridaLoader/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/FridaLoader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/FridaLoader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index beed3cd..0000000 Binary files a/FridaLoader/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/FridaLoader/build.gradle b/FridaLoader/build.gradle index b55d89a..f297413 100644 --- a/FridaLoader/build.gradle +++ b/FridaLoader/build.gradle @@ -1,27 +1,52 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. +apply plugin: 'com.android.application' -buildscript { - repositories { - google() - jcenter() - +android { + namespace 'com.dns.fridaloader' + signingConfigs { + debug { + storeFile file('debug.keystore') + storePassword 'android' + keyAlias 'androiddebugkey' + keyPassword 'android' + } + release { + storeFile file('release.keystore') + storePassword 'android' + keyAlias 'androidreleasekey' + keyPassword 'android' + } } - dependencies { - classpath 'com.android.tools.build:gradle:3.6.2' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files + compileSdkVersion 33 + defaultConfig { + applicationId "com.dns.fridaloader" + minSdk 19 + targetSdk 33 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -} - -allprojects { - repositories { - google() - jcenter() - + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility = '1.8' + targetCompatibility = '1.8' } } - -task clean(type: Delete) { - delete rootProject.buildDir +repositories { + maven { url 'https://jitpack.io' } +} +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.mindorks.android:prdownloader:0.6.0' + implementation 'com.muddzdev:styleabletoast:2.3.0' + implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0' + implementation group: 'org.tukaani', name: 'xz', version: '1.9' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'com.github.sabujak-sabujak:RoundedButton:v0.1.1' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } diff --git a/FridaLoader/debug.keystore b/FridaLoader/debug.keystore new file mode 100644 index 0000000..81545e7 Binary files /dev/null and b/FridaLoader/debug.keystore differ diff --git a/FridaLoader/gradle/wrapper/gradle-wrapper.jar b/FridaLoader/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index f6b961f..0000000 Binary files a/FridaLoader/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/FridaLoader/gradlew b/FridaLoader/gradlew deleted file mode 100755 index cccdd3d..0000000 --- a/FridaLoader/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/FridaLoader/app/proguard-rules.pro b/FridaLoader/proguard-rules.pro similarity index 100% rename from FridaLoader/app/proguard-rules.pro rename to FridaLoader/proguard-rules.pro diff --git a/FridaLoader/release.keystore b/FridaLoader/release.keystore new file mode 100644 index 0000000..4b580f6 Binary files /dev/null and b/FridaLoader/release.keystore differ diff --git a/FridaLoader/settings.gradle b/FridaLoader/settings.gradle deleted file mode 100644 index e7b4def..0000000 --- a/FridaLoader/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' diff --git a/FridaLoader/app/src/androidTest/java/com/dns/fridaloader/ExampleInstrumentedTest.java b/FridaLoader/src/androidTest/java/com/dns/fridaloader/ExampleInstrumentedTest.java similarity index 100% rename from FridaLoader/app/src/androidTest/java/com/dns/fridaloader/ExampleInstrumentedTest.java rename to FridaLoader/src/androidTest/java/com/dns/fridaloader/ExampleInstrumentedTest.java diff --git a/FridaLoader/app/src/main/AndroidManifest.xml b/FridaLoader/src/main/AndroidManifest.xml similarity index 70% rename from FridaLoader/app/src/main/AndroidManifest.xml rename to FridaLoader/src/main/AndroidManifest.xml index 4f0d57e..d5eab8f 100644 --- a/FridaLoader/app/src/main/AndroidManifest.xml +++ b/FridaLoader/src/main/AndroidManifest.xml @@ -1,11 +1,8 @@ - - + + - - - + android:theme="@style/AppTheme"> + - - - \ No newline at end of file + diff --git a/FridaLoader/app/src/main/java/com/dns/fridaloader/HttpURLConnectionGetRequest.java b/FridaLoader/src/main/java/com/dns/fridaloader/HttpURLConnectionGetRequest.java similarity index 67% rename from FridaLoader/app/src/main/java/com/dns/fridaloader/HttpURLConnectionGetRequest.java rename to FridaLoader/src/main/java/com/dns/fridaloader/HttpURLConnectionGetRequest.java index c5f0c17..c765013 100644 --- a/FridaLoader/app/src/main/java/com/dns/fridaloader/HttpURLConnectionGetRequest.java +++ b/FridaLoader/src/main/java/com/dns/fridaloader/HttpURLConnectionGetRequest.java @@ -7,7 +7,6 @@ import org.json.JSONObject; import java.io.BufferedReader; -import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; @@ -18,24 +17,20 @@ class HttpURLConnectionGetRequest extends AsyncTask { String finalURL = ""; String deviceArchitectureType = "x86"; + @Override protected String doInBackground(String... parameters) { try { - URL siteURL = new URL(parameters[0]); - switch(parameters[1].trim()) { - case "x86": - deviceArchitectureType = parameters[1].trim(); + switch (parameters[1].trim()) { + case "x86_64": + deviceArchitectureType = "x86_64" ; break; case "arm64-v8a": deviceArchitectureType = "arm64"; break; - case "x86_64": - deviceArchitectureType = "arm"; - break; case "armeabi-v7a": - deviceArchitectureType = "arm"; - break; case "armeabi": + case "armeabi-v7a": deviceArchitectureType = "arm"; break; default: @@ -45,51 +40,38 @@ protected String doInBackground(String... parameters) { HttpURLConnection httpConn = (HttpURLConnection) siteURL.openConnection(); httpConn.setRequestMethod("GET"); httpConn.connect(); - InputStream inputStream = httpConn.getInputStream(); InputStreamReader inputStreamReader = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String line = bufferedReader.readLine(); - // System.out.println("content="+line); - JSONObject jsonObj = new JSONObject(line); JSONArray jArray = jsonObj.getJSONArray("assets"); - // System.out.println("jArray length="+jArray.length()); - - for (int i=0; i < jArray.length(); i++) - { + for (int i = 0; i < jArray.length(); i++) { try { JSONObject oneObject = jArray.getJSONObject(i); - String oneObjectsItem = oneObject.getString("browser_download_url"); - // if(oneObjectsItem.contains("server") && oneObjectsItem.contains("android-x86.xz")){ - if(oneObjectsItem.contains("server") && oneObjectsItem.contains("android-"+deviceArchitectureType+".xz")){ - // System.out.println("Download Links = "+oneObjectsItem); + String oneObjectsItem = oneObject.getString("browser_download_url"); + if (oneObjectsItem.contains("server") && oneObjectsItem.contains("android-" + deviceArchitectureType + ".xz")) { final Matcher matcher = Pattern.compile("download/").matcher(oneObjectsItem); - if(matcher.find()){ - System.out.println("XXXXMatching is: "+oneObjectsItem.substring(matcher.end()).trim()); + if (matcher.find()) { + System.out.println("XXXXMatching is: " + oneObjectsItem.substring(matcher.end()).trim()); finalURL = oneObjectsItem.substring(matcher.end()).trim(); } } } catch (JSONException e) { - // Oops + e.printStackTrace(); + return "ERROR JSONObject for procedure."; } } - - - } catch (Exception e) { e.printStackTrace(); return "ERROR"; } - // return "SUCCESS"; return finalURL; } @Override - protected void onPostExecute(String result){ + protected void onPostExecute(String result) { super.onPostExecute(result); System.out.println("Request Status: " + result); } - - } diff --git a/FridaLoader/src/main/java/com/dns/fridaloader/MainActivity.java b/FridaLoader/src/main/java/com/dns/fridaloader/MainActivity.java new file mode 100644 index 0000000..22995db --- /dev/null +++ b/FridaLoader/src/main/java/com/dns/fridaloader/MainActivity.java @@ -0,0 +1,316 @@ +package com.dns.fridaloader; + +import android.annotation.SuppressLint; +import android.graphics.Color; +import android.os.Bundle; +import android.os.Environment; +import android.os.SystemClock; +import android.util.Log; +import android.widget.Button; +import android.widget.ProgressBar; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +import com.crowdfire.cfalertdialog.CFAlertDialog; +import com.downloader.Error; +import com.downloader.OnDownloadListener; +import com.downloader.PRDownloader; +import com.downloader.Status; +import com.muddzdev.styleabletoast.StyleableToast; + +import org.tukaani.xz.XZInputStream; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStreamReader; + +import life.sabujak.roundedbutton.RoundedButton; + +public class MainActivity extends AppCompatActivity { + String receivedData = ""; + int downloadIdOne; + private static String dirPath; + String request_endpoint = "https://api.github.com/repos/frida/frida/releases/latest"; + String URL1 = ""; + String frida_url_prefix = "https://github.com/frida/frida/releases/download/"; + Button performDownloadCancel, performDownload; + RoundedButton reCheckStatusButton; + ProgressBar downloadProgressBar; + TextView textViewActionProgress, fridaStatusTextView; + String command_ls, command_cp, command_chmod, command_launch_frida, command_ps1, command_ps2, command_kill_frida, command_frida_search; + String appDir = Environment.getExternalStorageDirectory().getPath() + "/Android/data/com.dns.fridaloader/files/"; + String temp_data = Environment.getDataDirectory().getPath() + "/local/tmp/"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + if (rootedUsingMagisk()) { + command_ls = "su -c /system/bin/ls"; + command_cp = "su -c /system/bin/cp -rf " + appDir + "frida-server-latest-decompressed " + temp_data + "frida-server-latest"; + command_chmod = "su -c /system/bin/chmod +x " + temp_data + "frida-server-latest"; + command_launch_frida = "su -c " + temp_data + "frida-server-latest &"; + command_ps1 = "su -c /system/bin/ps -A"; + command_ps2 = "su -c /system/bin/ps"; + command_kill_frida = "su -c /system/bin/killall frida-server-latest"; + command_frida_search = "su -c /system/bin/ls " + temp_data + "frida-server-latest"; + } else { + command_ls = "su 0 /system/bin/ls"; + command_cp = "su 0 /system/bin/cp -rf " + appDir + "frida-server-latest-decompressed " + temp_data + "frida-server-latest"; + command_chmod = "su 0 /system/bin/chmod +x " + temp_data + "frida-server-latest"; + command_launch_frida = "su 0 " + temp_data + "frida-server-latest &"; + command_ps1 = "su 0 /system/bin/ps -A"; + command_ps2 = "su 0 /system/bin/ps"; + command_kill_frida = "su 0 /system/bin/killall frida-server-latest"; + command_frida_search = "su 0 /system/bin/ls " + temp_data + "frida-server-latest"; + } + executeCommand(command_ls, true); + dirPath = Util.getRootDirPath(getApplicationContext()); + performDownloadCancel = (Button) findViewById(R.id.button_cancel_frida); + downloadProgressBar = (ProgressBar) findViewById(R.id.progressBarOne); + textViewActionProgress = (TextView) findViewById(R.id.textViewActionProgress); + fridaStatusTextView = (TextView) findViewById(R.id.fridaStatusTextView); + performDownload = (Button) findViewById(R.id.button_download_frida); + reCheckStatusButton = (RoundedButton) findViewById(R.id.reCheckFridaStatus); + performDownload.setOnClickListener(v -> performDownloadAndStartFrida()); + reCheckStatusButton.setOnClickListener(v -> doFridaStuff()); + SystemClock.sleep(2000); + doFridaStuff(); + } + + private void doFridaStuff() { + boolean fridaStatus = checkFridaStatusCode(); + if (fridaStatus) { + //frida already running + fridaAlreadyRunning(); + } else { + //frida not currently running + freshFridaLaunchOptions(); + } + } + + public void setupFridaURL() { + HttpURLConnectionGetRequest requestTypeOne = new HttpURLConnectionGetRequest(); + try { + String archType = execSomeCommandAndGetResponse(); + receivedData = requestTypeOne.execute(request_endpoint, archType).get(); + System.out.println("receivedData = " + receivedData); + if (!receivedData.contains("ERROR")) { + System.out.println("Frida URL found = " + frida_url_prefix.concat(receivedData)); + URL1 = frida_url_prefix.concat(receivedData); + } else { + throw new Exception("ERROR Something Went Wrong while finding latest branch so fallback try later."); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @SuppressLint("SetTextI18n") + private void performDownloadAndStartFrida() { + setupFridaURL(); + if (Status.RUNNING == PRDownloader.getStatus(downloadIdOne)) { + PRDownloader.pause(downloadIdOne); + return; + } + performDownload.setEnabled(false); + downloadProgressBar.setIndeterminate(true); + downloadProgressBar.getIndeterminateDrawable().setColorFilter(Color.BLUE, android.graphics.PorterDuff.Mode.SRC_IN); + if (Status.PAUSED == PRDownloader.getStatus(downloadIdOne)) { + PRDownloader.resume(downloadIdOne); + return; + } + downloadIdOne = PRDownloader.download(URL1, dirPath, "frida-server-latest-xz.xz") + .build() + .setOnStartOrResumeListener(() -> { + reCheckStatusButton.setEnabled(false); + downloadProgressBar.setIndeterminate(false); + performDownload.setEnabled(true); + performDownload.setText("PAUSE PROCESS"); + performDownloadCancel.setEnabled(true); + }) + .setOnPauseListener(() -> performDownload.setText("RESUME PROCESS")) + .setOnCancelListener(() -> { + reCheckStatusButton.setEnabled(true); + performDownload.setText("START PROCESS"); + performDownloadCancel.setEnabled(false); + downloadProgressBar.setProgress(0); + textViewActionProgress.setText(""); + downloadIdOne = 0; + downloadProgressBar.setIndeterminate(false); + }) + .setOnProgressListener(progress -> { + long progressPercent = progress.currentBytes * 100 / progress.totalBytes; + downloadProgressBar.setProgress((int) progressPercent); + textViewActionProgress.setText(Util.getProgressDisplayLine(progress.currentBytes, progress.totalBytes)); + downloadProgressBar.setIndeterminate(false); + }) + .start(new OnDownloadListener() { + @SuppressLint("SetTextI18n") + @Override + public void onDownloadComplete() { + performDownloadCancel.setEnabled(false); + performDownload.setText("DOWNLOAD & RUN AGAIN"); + System.out.println("Now uncompressing"); + try { + FileInputStream fin = new FileInputStream(appDir + "frida-server-latest-xz.xz"); + BufferedInputStream in = new BufferedInputStream(fin); + FileOutputStream out = new FileOutputStream(appDir + "frida-server-latest-decompressed"); + XZInputStream xzIn = new XZInputStream(in); + final byte[] buffer = new byte[8192]; + int n; + while (-1 != (n = xzIn.read(buffer))) { + out.write(buffer, 0, n); + } + xzIn.close(); + fin.close(); + out.close(); + } catch (Exception e) { + Log.e("Decompress", "unzip", e); + } + executeCommand(command_cp, false); + SystemClock.sleep(2000); + executeCommand(command_chmod, true); + SystemClock.sleep(2000); + executeCommand(command_launch_frida, true); + SystemClock.sleep(2000); + fridaStatusTextView.setText("Running"); + fridaStatusTextView.setTextColor(Color.parseColor("#ACF7C1")); + doFridaStuff(); + reCheckStatusButton.setEnabled(true); + } + + @SuppressLint("SetTextI18n") + @Override + public void onError(Error error) { + performDownload.setText("Start"); + StyleableToast.makeText(MainActivity.this, "Something Went Wrong" + " " + "1", Toast.LENGTH_LONG, R.style.red).show(); + textViewActionProgress.setText(""); + downloadProgressBar.setProgress(0); + downloadIdOne = 0; + performDownloadCancel.setEnabled(false); + downloadProgressBar.setIndeterminate(false); + performDownload.setEnabled(true); + reCheckStatusButton.setEnabled(true); + } + }); + } + + private boolean checkFridaStatusCode() { + String status = executeCommand(command_ps1, false); + if (status.contains("frida-server-latest")) { + return true; + } else { + status = executeCommand(command_ps2, false); + return status.contains("frida-server-latest"); + } + } + + private String execSomeCommandAndGetResponse() { + return executeCommand("getprop ro.product.cpu.abi", false); + } + + private boolean rootedUsingMagisk() { + String response = executeCommand("/system/bin/which magisk", false); + return response.contains("magisk"); + } + + @SuppressLint("SetTextI18n") + private void fridaAlreadyRunning() { + System.out.println("FRIDA IS RUNNING"); + fridaStatusTextView.setText("Running"); + fridaStatusTextView.setTextColor(Color.parseColor("#ACF7C1")); + CFAlertDialog.Builder builder = new CFAlertDialog.Builder(this) + .setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) + .setTitle("Frida Status") + .setMessage("Frida Server (frida-server-latest) is already running. How do you want to proceed?") + .addButton("Download & Run Latest Frida Server", -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { + if (checkFridaStatusCode()) { + // sometimes we have to run kill twice for it to work + executeCommand(command_kill_frida, false); + } + if (checkFridaStatusCode()) { + // sometimes we have to run kill twice for it to work + executeCommand(command_kill_frida, false); + } + dialog.dismiss(); + fridaStatusTextView.setText("Terminated"); + performDownloadAndStartFrida(); + SystemClock.sleep(2000); + doFridaStuff(); + }) + .addButton("KILL Frida Server", -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { + if (checkFridaStatusCode()) { + // sometimes we have to run kill twice for it to work + executeCommand(command_kill_frida, false); + } + dialog.dismiss(); + fridaStatusTextView.setText("Terminated"); + SystemClock.sleep(2000); + doFridaStuff(); + }).addButton("Continue", -1, -1, CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> dialog.dismiss()); + builder.show(); + } + + @SuppressLint("SetTextI18n") + private void freshFridaLaunchOptions() { + fridaStatusTextView.setText("Not Running"); + fridaStatusTextView.setTextColor(Color.parseColor("#A50104")); + CFAlertDialog.Builder builder = new CFAlertDialog.Builder(this) + .setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) + .setTitle("Frida Status") + .setMessage("Frida Server (frida-server-latest) is current not running. How do you want to proceed?") + .addButton("Install & Run Latest Frida Server", -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { + performDownloadAndStartFrida(); + dialog.dismiss(); + }) + .addButton("Force Start Existing Frida Server", -1, -1, CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { + String status = executeCommand(command_frida_search, false); + if (!status.contains("frida-server-latest")) { + System.out.println("No such file or directory"); + dialog.dismiss(); + fridaStatusTextView.setText("Server Not Found"); + fridaStatusTextView.setTextColor(Color.parseColor("#A50104")); + StyleableToast.makeText(MainActivity.this, "Server Not Found", Toast.LENGTH_LONG, R.style.red).show(); + } else { + StyleableToast.makeText(MainActivity.this, "Server Found. Starting it now.", Toast.LENGTH_LONG, R.style.green).show(); + executeCommand(command_launch_frida, true); + dialog.dismiss(); + SystemClock.sleep(2000); + fridaStatusTextView.setText("Running"); + fridaStatusTextView.setTextColor(Color.parseColor("#ACF7C1")); + doFridaStuff(); + } + }) + .addButton("Continue", -1, -1, CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> dialog.dismiss()); + builder.show(); + } + + private String executeCommand(String command, boolean standardOutExclude) { + int readData; + char[] buffer; + buffer = new char[4096]; + StringBuilder outputData; + BufferedReader reader; + try { + Process process = Runtime.getRuntime().exec(command); + if (standardOutExclude) { + return ""; + } + reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + outputData = new StringBuilder(); + while ((readData = reader.read(buffer)) > 0) { + outputData.append(buffer, 0, readData); + } + reader.close(); + process.waitFor(); + return outputData.toString(); + } catch (Exception e) { + throw new RuntimeException("ERROR command -> " + e); + } + } +} diff --git a/FridaLoader/app/src/main/java/com/dns/fridaloader/MainApp.java b/FridaLoader/src/main/java/com/dns/fridaloader/MainApp.java similarity index 83% rename from FridaLoader/app/src/main/java/com/dns/fridaloader/MainApp.java rename to FridaLoader/src/main/java/com/dns/fridaloader/MainApp.java index 8adc2cc..77124d5 100644 --- a/FridaLoader/app/src/main/java/com/dns/fridaloader/MainApp.java +++ b/FridaLoader/src/main/java/com/dns/fridaloader/MainApp.java @@ -6,14 +6,10 @@ import com.downloader.PRDownloaderConfig; public class MainApp extends Application { - @Override public void onCreate() { super.onCreate(); - PRDownloaderConfig config = PRDownloaderConfig.newBuilder() - .setDatabaseEnabled(true) - .build(); + PRDownloaderConfig config = PRDownloaderConfig.newBuilder().setDatabaseEnabled(true).build(); PRDownloader.initialize(this, config); } - } diff --git a/FridaLoader/app/src/main/java/com/dns/fridaloader/Util.java b/FridaLoader/src/main/java/com/dns/fridaloader/Util.java similarity index 88% rename from FridaLoader/app/src/main/java/com/dns/fridaloader/Util.java rename to FridaLoader/src/main/java/com/dns/fridaloader/Util.java index dc8d498..8321afc 100644 --- a/FridaLoader/app/src/main/java/com/dns/fridaloader/Util.java +++ b/FridaLoader/src/main/java/com/dns/fridaloader/Util.java @@ -1,23 +1,20 @@ package com.dns.fridaloader; - import android.content.Context; import android.os.Environment; + import androidx.core.content.ContextCompat; import java.io.File; import java.util.Locale; public final class Util { - private Util() { - } public static String getRootDirPath(Context context) { if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { - File file = ContextCompat.getExternalFilesDirs(context.getApplicationContext(), - null)[0]; + File file = ContextCompat.getExternalFilesDirs(context.getApplicationContext(),null)[0]; return file.getAbsolutePath(); } else { return context.getApplicationContext().getFilesDir().getAbsolutePath(); @@ -28,8 +25,7 @@ public static String getProgressDisplayLine(long currentBytes, long totalBytes) return getBytesToMBString(currentBytes) + "/" + getBytesToMBString(totalBytes); } - private static String getBytesToMBString(long bytes){ + private static String getBytesToMBString(long bytes) { return String.format(Locale.ENGLISH, "%.2fMb", bytes / (1024.00 * 1024.00)); } - } diff --git a/FridaLoader/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/FridaLoader/src/main/res/drawable-v24/ic_launcher_foreground.xml similarity index 100% rename from FridaLoader/app/src/main/res/drawable-v24/ic_launcher_foreground.xml rename to FridaLoader/src/main/res/drawable-v24/ic_launcher_foreground.xml diff --git a/FridaLoader/app/src/main/res/drawable/button_states.xml b/FridaLoader/src/main/res/drawable/button_states.xml similarity index 100% rename from FridaLoader/app/src/main/res/drawable/button_states.xml rename to FridaLoader/src/main/res/drawable/button_states.xml diff --git a/FridaLoader/app/src/main/res/drawable/ic_launcher_background.xml b/FridaLoader/src/main/res/drawable/ic_launcher_background.xml similarity index 100% rename from FridaLoader/app/src/main/res/drawable/ic_launcher_background.xml rename to FridaLoader/src/main/res/drawable/ic_launcher_background.xml diff --git a/FridaLoader/app/src/main/res/layout/activity_main.xml b/FridaLoader/src/main/res/layout/activity_main.xml similarity index 100% rename from FridaLoader/app/src/main/res/layout/activity_main.xml rename to FridaLoader/src/main/res/layout/activity_main.xml diff --git a/FridaLoader/src/main/res/mipmap-hdpi/ic_launcher.png b/FridaLoader/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..0c82ef4 Binary files /dev/null and b/FridaLoader/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/FridaLoader/src/main/res/mipmap-hdpi/ic_launcher_round.png b/FridaLoader/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..411ec80 Binary files /dev/null and b/FridaLoader/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/FridaLoader/src/main/res/mipmap-mdpi/ic_launcher.png b/FridaLoader/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..0f0243d Binary files /dev/null and b/FridaLoader/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/FridaLoader/src/main/res/mipmap-mdpi/ic_launcher_round.png b/FridaLoader/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..5d221d1 Binary files /dev/null and b/FridaLoader/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/FridaLoader/src/main/res/mipmap-xhdpi/ic_launcher.png b/FridaLoader/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..3bf58ad Binary files /dev/null and b/FridaLoader/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/FridaLoader/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/FridaLoader/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..d89a0ba Binary files /dev/null and b/FridaLoader/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/FridaLoader/src/main/res/mipmap-xxhdpi/ic_launcher.png b/FridaLoader/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..6f993f9 Binary files /dev/null and b/FridaLoader/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/FridaLoader/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/FridaLoader/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..5700aed Binary files /dev/null and b/FridaLoader/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/FridaLoader/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/FridaLoader/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..b14da5e Binary files /dev/null and b/FridaLoader/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/FridaLoader/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/FridaLoader/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..dd58348 Binary files /dev/null and b/FridaLoader/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/FridaLoader/app/src/main/res/values/colors.xml b/FridaLoader/src/main/res/values/colors.xml similarity index 100% rename from FridaLoader/app/src/main/res/values/colors.xml rename to FridaLoader/src/main/res/values/colors.xml diff --git a/FridaLoader/app/src/main/res/values/strings.xml b/FridaLoader/src/main/res/values/strings.xml similarity index 100% rename from FridaLoader/app/src/main/res/values/strings.xml rename to FridaLoader/src/main/res/values/strings.xml diff --git a/FridaLoader/app/src/main/res/values/styles.xml b/FridaLoader/src/main/res/values/styles.xml similarity index 100% rename from FridaLoader/app/src/main/res/values/styles.xml rename to FridaLoader/src/main/res/values/styles.xml diff --git a/FridaLoader/app/src/test/java/com/dns/fridaloader/ExampleUnitTest.java b/FridaLoader/src/test/java/com/dns/fridaloader/ExampleUnitTest.java similarity index 100% rename from FridaLoader/app/src/test/java/com/dns/fridaloader/ExampleUnitTest.java rename to FridaLoader/src/test/java/com/dns/fridaloader/ExampleUnitTest.java diff --git a/README.md b/README.md index f267b9c..5e4a662 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# FridaLoader +# FridaLoader [![Android CI](https://github.com/Furtif/FridaLoader/actions/workflows/android.yml/badge.svg)](https://github.com/Furtif/FridaLoader/actions/workflows/android.yml) A quick and dirty Android app to download and launch the latest version of Frida server on Genymotion Emulator and Rooted Android Physical Devices. Auto-downloads the Frida server based off the architecture of the device/emulator. diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..9bd85a4 --- /dev/null +++ b/build.gradle @@ -0,0 +1,24 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + google() + gradlePluginPortal() + mavenCentral() + } + dependencies { + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + classpath 'com.android.tools.build:gradle:7.4.2' + } +} +allprojects { + repositories { + google() + gradlePluginPortal() + mavenCentral() + } +} +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/gen_keys.bat b/gen_keys.bat new file mode 100644 index 0000000..1481ff7 --- /dev/null +++ b/gen_keys.bat @@ -0,0 +1,3 @@ +@echo off +keytool -genkey -v -keystore FridaLoader/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 +keytool -genkey -v -keystore FridaLoader/release.keystore -storepass android -alias androidreleasekey -keypass android -keyalg RSA -keysize 2048 -validity 10000 \ No newline at end of file diff --git a/FridaLoader/gradle.properties b/gradle.properties similarity index 99% rename from FridaLoader/gradle.properties rename to gradle.properties index d546dea..8de5058 100644 --- a/FridaLoader/gradle.properties +++ b/gradle.properties @@ -13,5 +13,3 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true - - diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..41d9927 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/FridaLoader/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties similarity index 80% rename from FridaLoader/gradle/wrapper/gradle-wrapper.properties rename to gradle/wrapper/gradle-wrapper.properties index 44f6d27..8049c68 100644 --- a/FridaLoader/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Wed Jun 12 23:26:23 CDT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..1b6c787 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/FridaLoader/gradlew.bat b/gradlew.bat similarity index 66% rename from FridaLoader/gradlew.bat rename to gradlew.bat index e95643d..107acd3 100644 --- a/FridaLoader/gradlew.bat +++ b/gradlew.bat @@ -1,84 +1,89 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..9c32357 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':FridaLoader'